From: Operating system: Linux PHP version: 5.4.0alpha2 Package: SPL related Bug Type: Bug Bug description:\DirectoryIterator, parent::__construct() and \LogicException
Description: ------------ In PHP 5.4, an exception was throwed if a call to parent::__construct() is not done in the constructor of a class which extends \DirectoryIterator. Exception was not throwed in previous version of PHP, so it's a BC break. And this BC break must be annoying in unit test, because it's impossible to mock the \DirectoryIterator class. Test script: --------------- <?php class myDirectoryIterator extends \DirectoryIterator { public function __construct() { } } $directoryIterator = new myDirectoryIterator(); ?> Expected result: ---------------- Nothing. Actual result: -------------- Fatal error: Uncaught exception 'LogicException' with message 'In the constructor of myDirectoryIterator, parent::__construct() must be called and its exceptions cannot be cleared' in /path/to/directoryIterator.php:10 Stack trace: #0 /path/to/directoryIterator.php(10): myDirectoryIterator->internal_construction_wrapper() #1 {main} thrown in /path/to/directoryIterator.php on line 10 -- Edit bug report at https://bugs.php.net/bug.php?id=55300&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55300&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55300&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55300&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=55300&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55300&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=55300&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=55300&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=55300&r=needscript Try newer version: https://bugs.php.net/fix.php?id=55300&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=55300&r=support Expected behavior: https://bugs.php.net/fix.php?id=55300&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=55300&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=55300&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=55300&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55300&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=55300&r=dst IIS Stability: https://bugs.php.net/fix.php?id=55300&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=55300&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=55300&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=55300&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=55300&r=mysqlcfg