Req #80780 [Opn]: var_export return an empty an incomplete representation

From: Date: Mon, 22 Feb 2021 14:54:00 +0000
Subject: Req #80780 [Opn]: var_export return an empty an incomplete representation
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-232327@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80780&edit=1 ID: 80780 Updated by: cmb@php.net Reported by: glash dot gnome at gmail dot com Summary: var_export return an empty an incomplete representation Status: Open Type: Feature/Change Request Package: DOM XML related Operating System: GNU Lunix PHP Version: Irrelevant Block user comment: N Private report: N New Comment: > In an extension, to enable var_dump() we need to implement : > zend_object_handlers.get_debug_info Better implement zend_object_handlers.get_properties_for()[1]. That can be used for var_export() as well, but still evaluating the results would not work. I'm not convinced that supporting var_export() without supporting __set_state() is a good idea. [1] <https://github.com/php/php-src/pull/5428#issuecomment-620599894> Previous Comments: ------------------------------------------------------------------------ [2021-02-21 15:55:02] glash dot gnome at gmail dot com Description: ------------ If I var_export() a DOMDocument, I get an incomplete representation of the DOM data. "That's funny, it did it a moment ago." If I var_dump() a DOMDocument, I get a complete representation of the DOM data. "So then I tried SimpleXML" If I use SimpleXML, var_export() and var_dump() returns me a full representation of data. "Show me." In an extension, to enable var_dump() we need to implement : zend_object_handlers.get_debug_info What should be implemented to enable var_export() ? Test script: --------------- $doc = new DOMDocument(); $doc->loadXML("<root><item>Text</item></root>"); var_export($doc); Expected result: ---------------- DOMDocument::__set_state(array( 'doctype' => NULL, 'implementation' => '(object value omitted)', 'documentElement' => '(object value omitted)', 'actualEncoding' => NULL, 'encoding' => NULL, 'xmlEncoding' => NULL, 'standalone' => true, 'xmlStandalone' => true, 'version' => '1.0', 'xmlVersion' => '1.0', 'strictErrorChecking' => true, 'documentURI' => '[...]', 'config' => NULL, 'formatOutput' => false, 'validateOnParse' => false, 'resolveExternals' => false, 'preserveWhiteSpace' => true, 'recover' => false, 'substituteEntities' => false, 'nodeName' => '#document', 'nodeValue' => NULL, 'nodeType' => 9, 'parentNode' => NULL, 'childNodes' => '(object value omitted)', 'firstChild' => '(object value omitted)', 'lastChild' => '(object value omitted)', 'previousSibling' => NULL, 'nextSibling' => NULL, 'attributes' => NULL, 'ownerDocument' => NULL, 'namespaceURI' => NULL, 'prefix' => '', 'localName' => NULL, 'baseURI' => '[...]', 'textContent' => 'Text', )) Actual result: -------------- DOMDocument::__set_state(array( )) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80780&edit=1

« previous php.bugs (#232327) next »