Bug #70026 [NEW]: Instances of DOMDocument lose derived class information when refcount low

From: Date: Wed, 08 Jul 2015 15:18:21 +0000
Subject: Bug #70026 [NEW]: Instances of DOMDocument lose derived class information when refcount low
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194220@lists.php.net to get a copy of this message
From: dexen dot devries at gmail dot com Operating system: Linux PHP version: 5.6.10 Package: DOM XML related Bug Type: Bug Bug description:Instances of DOMDocument lose derived class information when refcount low Description: ------------ DOMXPath instances mis-handle instances of classes derived from DOMDocument in some cases, as accessible via $document property. Instances of classes derived from DOMDocument can suffer loss of information, both on derived class type and properties of the derived class. Both derived class name and properties of instance of the derived class are lost. Problems seems to be related to refcount going down to zero; can be reliably triggered both by returning instance of DOMDocument derived class from function, and by manually unset()ting all variables refering to the instance of class derived from DOMDocument. Test script: --------------- http://pastebin.ca/3051231 Expected result: ---------------- Instance of DOMXPath should hold the original DOMDocument instances in $document property. Actual result: -------------- Instance of DOMXPath holds some sort of copy of DOMDocument instance in $document, if refcount goes to zero, resulting in loss of both derived class information, and properties of the derived class. -- Edit bug report at https://bugs.php.net/bug.php?id=70026&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70026&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70026&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70026&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70026&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70026&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70026&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70026&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70026&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70026&r=support Expected behavior: https://bugs.php.net/fix.php?id=70026&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70026&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70026&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70026&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70026&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70026&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70026&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70026&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70026&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70026&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70026&r=mysqlcfg

« previous php.bugs (#194220) next »