Bug #69264 [NEW]: __debugInfo() ignored while extending SPL datastructures
From: grzegorz129 at gmail dot com
Operating system: All
PHP version: 5.6.6
Package: SPL related
Bug Type: Bug
Bug description:__debugInfo() ignored while extending SPL datastructures
Description:
------------
Magic method __debugInfo() should be always called while object is
printed using var_dump(). Unfortunately it behaves differently if any
class in chain extends SPL datastructure - it's simply ignored.
Test script:
---------------
<?php
class foo extends SplStack {
public function __debugInfo() { return ['foo']; }
}
class bar extends foo {
public function __debugInfo() { return ['bar']; }
}
class bar2 extends SplObjectStorage {
public function __debugInfo() { return ['bar2']; }
}
var_dump((new bar), (new bar2));
Expected result:
----------------
object(bar)#1 (1) {
[0]=>
string(3) "bar"
}
object(bar2)#2 (1) {
[0]=>
string(4) "bar2"
}
Actual result:
--------------
object(bar)#1 (2) {
["flags":"SplDoublyLinkedList":private]=>
int(6)
["dllist":"SplDoublyLinkedList":private]=>
array(0) {
}
}
object(bar2)#2 (1) {
["storage":"SplObjectStorage":private]=>
array(0) {
}
}
--
Edit bug report at https://bugs.php.net/bug.php?id=69264&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69264&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69264&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69264&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69264&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69264&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69264&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69264&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69264&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69264&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69264&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69264&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69264&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69264&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69264&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69264&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69264&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69264&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69264&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69264&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69264&r=mysqlcfg
Thread (10 messages)
- grzegorz129 at gmail dot com