ZF-3340: PHP 5.2.6 RecursiveDirectoryIterator changes break Zend_Translate scan directory


In PHP 5.2.6, the output of RecursiveDirectoryIterator's __toString when using KEY_AS_PATHNAME changed in such a way that Zend_Translate is no longer able to use the directory scanning method. You can see the change by running the following script:

<?php $iterator = new RecursiveDirectoryIterator('/some/directory', RecursiveDirectoryIterator::KEY_AS_PATHNAME);

foreach($iterator as $item) { echo (string) $item . "\n"; }

On 5.2.5, only the filename is output, but on 5.2.6, the path and filename are output.

The obvious fix is to stop relying on the __toString() method and use the getFilename() method.


Fixed in trunk.

I hate it when PHP changes how things work without any notification. They should also use unit testing. :-)

Updating for the 1.6.0 release.