Bug #70606 [NEW]: The documented signature for SplObjectStorage methods is wrong

From: Date: Wed, 30 Sep 2015 10:16:10 +0000
Subject: Bug #70606 [NEW]: The documented signature for SplObjectStorage methods is wrong
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-12790@lists.php.net to get a copy of this message
From: stof at notk dot org Operating system: n/a PHP version: 5.6.13 Package: Documentation problem Bug Type: Bug Bug description:The documented signature for SplObjectStorage methods is wrong Description: ------------ The documentation for the addAll, removeAll and removeAllExcept methods of the SplObjectStorage shows that the argument is typehinted as SplObjectStorage: http://php.net/manual/en/splobjectstorage.addall.php While this is true that they accept only SplObjectStorage instances, the methods are NOT typehinted, which cause issues when trying to overwrite them. We receive an error saying that the signature does not match, while we follow the documentation. I had to go read the C source code to understand the actual issue (and I think many people would not do it). https://github.com/php/php-src/blob/PHP-5.6/ext/spl/spl_observer.c#L972 https://github.com/php/php-src/blob/PHP-5.6/ext/spl/spl_observer.c#L940 Test script: --------------- <?php class MyObjectStorage extends SplObjectStorage { public function addAll(SplObjectStorage $object) {} } Actual result: -------------- T -- Edit bug report at https://bugs.php.net/bug.php?id=70606&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70606&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70606&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70606&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70606&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70606&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70606&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70606&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70606&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70606&r=support Expected behavior: https://bugs.php.net/fix.php?id=70606&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70606&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70606&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70606&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70606&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70606&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70606&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70606&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70606&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70606&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70606&r=mysqlcfg

« previous php.doc.bugs (#12790) next »