Bug #70026 [Opn->Wfx]: Instances of DOMDocument lose derived class information when refcount low
| From: | beberlei@php.net | Date: | Sun, 22 Sep 2019 22:35:17 +0000 |
| Subject: | Bug #70026 [Opn->Wfx]: Instances of DOMDocument lose derived class information when refcount low | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-222878@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70026&edit=1
ID: 70026
Updated by: beberlei@php.net
Reported by: dexen dot devries at gmail dot com
Summary: Instances of DOMDocument lose derived class
information when refcount low
-Status: Open
+Status: Wont fix
Type: Bug
Package: DOM XML related
Operating System: Linux
PHP Version: 5.6.10
-Assigned To:
+Assigned To: beberlei
Block user comment: N
Private report: N
New Comment:
This is not a bug. You should see the document property as using "magic" __get and
creating new DOMDocument objects as it needs them based on the underlying libxml DOM structure that
is managed. ext/dom does not guarantee reference equality of nodes.
Previous Comments:
------------------------------------------------------------------------
[2015-07-10 16:04:36] cmb@php.net
That seems to be related to bug #61797.
------------------------------------------------------------------------
[2015-07-08 15:18:21] dexen dot devries at gmail dot com
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 this bug report at https://bugs.php.net/bug.php?id=70026&edit=1