Bug #46584
closedFAL: Segfault with some PHP versions in copy/move operations
100%
Description
Due to a (meanwhile fixed) bug in PHP 5.4 < 5.4.6 (?), object comparisons can lead to segfaults. See https://bugs.php.net/bug.php?id=61557 for details.
We experienced this in the ResourceStorage class in copy/move operations, where the source and target storages have to be compared to check if the operation is within the same or between two different storages.
The segfaults occured on these environments:- Linux, PHP 5.4.6, mod_php
- Windows, PHP 5.4.8, FastCGI
The fix is simple: Use strict object comparison (===) for comparing the storages. This only checks the internal object identifier, not the object properties (see http://php.net/manual/en/language.oop5.object-comparison.php). The only problem is that this will fail if there are two objects for the same storage - but this is an unsupported behaviour that should not arise when the FAL API (Repositories, Factories) are properly used.