#41398 [Opn->WFx]: [chm] bug on function.dom-domdocument-loadxml.html

From: Date: Wed, 16 May 2007 11:56:20 +0000
Subject: #41398 [Opn->WFx]: [chm] bug on function.dom-domdocument-loadxml.html
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-112680@lists.php.net to get a copy of this message
ID: 41398 Updated by: rrichards@php.net Reported By: RQuadling at GMail dot com -Status: Open +Status: Wont fix Bug Type: DOM XML related Operating System: Windows XP SP2 PHP Version: 5CVS-2007-05-15 (snap) New Comment: It is there for convenience (even though there are some that do not agree with it) - and its not going to be changed in any event for BC reasons. When E_STRICT is enabled the user is told that Strict standards are enabled and that they should not call the method statically (it says should not because the call still works). When E_STRICT is not enabled then no messages and no problems (and again is still works). Previous Comments: ------------------------------------------------------------------------ [2007-05-15 12:48:22] RQuadling at GMail dot com Description: ------------ DOMDocument->loadXML() is documented as being able to be called statically - DOMDocument::loadXML() But this generates a strict error. I don't know if this is doc bug or a libxml/DOM bug. $doc will be correctly populated and workable. I know that "loadXML() is not a true static function. It is just allowed to be called statically. When called statically within a method of an instantiated DOMDocument object it acts as if the method had been called directly from the object itself rather than statically." (I've read the bugs), but what does this mean for the user where the documentation says it a static call IS allowed and the that the static call actually works (but gives the Strict warning). The error says "should not", not "cannot". In looking at all the methods in all the extensions in php-src, all those with ZEND_ACC_ALLOW_STATIC, when called statically, result in the warning shown. Either it shouldn't be allowed to be called Statically (and the documentation amended to remove this option) or it should be allowed to be called statically (and the strict message is removed). Either way something isn't right. There are only 4 files in the whole of the php-src/ext folder with ZEND_ACC_ALLOW_STATIC com_persist.c, document.c, domimplementation.c and php_xmlreader.c The example in the dox for DOMImplementation->hasFeature() uses a static call ... ... if (DOMImplementation::hasFeature($key, '2.0')) { ... And this results in a lot of Strict errors. Clearly, not what you would be expecting. Without the ZEND_ACC_ALLOW_STRICT, I assume you wouldn't be able to call them statically (it seems that way in zend_vm_execute.h, so should this be removed from these extensions? Reproduce code: --------------- <?php $domxml = DOMDocument::loadXML('<root><node /></root>'); $domhtml = DOMDocument::loadHTML('<html><head><title>Title</title></head><body>Stuff</body></html>'); $xmlxml = XMLReader::XML('<html><head><title>Title</title></head><body>Stuff</body></html>'); $features = array( 'Core' => 'Core module', 'XML' => 'XML module', 'HTML' => 'HTML module', 'Views' => 'Views module', 'Stylesheets' => 'Style Sheets module', 'CSS' => 'CSS module', 'CSS2' => 'CSS2 module', 'Events' => 'Events module', 'UIEvents' => 'User interface Events module', 'MouseEvents' => 'Mouse Events module', 'MutationEvents' => 'Mutation Events module', 'HTMLEvents' => 'HTML Events module', 'Range' => 'Range module', 'Traversal' => 'Traversal module' ); foreach ($features as $key => $name) { if (!DOMImplementation::hasFeature($key, '2.0')) { echo "Has feature $name\n"; } else { echo "Missing feature $name\n"; } } ?> Expected result: ---------------- Has feature Core module Missing feature XML module Has feature HTML module Has feature Views module Has feature Style Sheets module Has feature CSS module Has feature CSS2 module Has feature Events module Has feature User interface Events module Has feature Mouse Events module Has feature Mutation Events module Has feature HTML Events module Has feature Range module Has feature Traversal module Actual result: -------------- Strict Standards: Non-static method DOMDocument::loadXML() should not be called statically in C:\static_calls.php on line 2 Strict Standards: Non-static method DOMDocument::loadHTML() should not be called statically in C:\static_calls.php on line 3 Strict Standards: Non-static method XMLReader::XML() should not be called statically in C:\static_calls.php on line 4 Strict Standards: Non-static method DOMImplementation::hasFeature() should not be called statically in C:\static_calls.php on line 24 Has feature Core module Strict Standards: Non-static method DOMImplementation::hasFeature() should not be called statically in C:\static_calls.php on line 24 Missing feature XML module Strict Standards: Non-static method DOMImplementation::hasFeature() should not be called statically in C:\static_calls.php on line 24 Has feature HTML module Strict Standards: Non-static method DOMImplementation::hasFeature() should not be called statically in C:\static_calls.php on line 24 Has feature Views module Strict Standards: Non-static method DOMImplementation::hasFeature() should not be called statically in C:\static_calls.php on line 24 Has feature Style Sheets module Strict Standards: Non-static method DOMImplementation::hasFeature() should not be called statically in C:\static_calls.php on line 24 Has feature CSS module Strict Standards: Non-static method DOMImplementation::hasFeature() should not be called statically in C:\static_calls.php on line 24 Has feature CSS2 module Strict Standards: Non-static method DOMImplementation::hasFeature() should not be called statically in C:\static_calls.php on line 24 Has feature Events module Strict Standards: Non-static method DOMImplementation::hasFeature() should not be called statically in C:\static_calls.php on line 24 Has feature User interface Events module Strict Standards: Non-static method DOMImplementation::hasFeature() should not be called statically in C:\static_calls.php on line 24 Has feature Mouse Events module Strict Standards: Non-static method DOMImplementation::hasFeature() should not be called statically in C:\static_calls.php on line 24 Has feature Mutation Events module Strict Standards: Non-static method DOMImplementation::hasFeature() should not be called statically in C:\static_calls.php on line 24 Has feature HTML Events module Strict Standards: Non-static method DOMImplementation::hasFeature() should not be called statically in C:\static_calls.php on line 24 Has feature Range module Strict Standards: Non-static method DOMImplementation::hasFeature() should not be called statically in C:\static_calls.php on line 24 Has feature Traversal module ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41398&edit=1

« previous php.bugs (#112680) next »