From: RQuadling at GMail dot com
Operating system: Windows XP SP2
PHP version: 5CVS-2007-05-15 (snap)
PHP Bug Type: DOM XML related
Bug description: [chm] bug on function.dom-domdocument-loadxml.html
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 bug report at http://bugs.php.net/?id=41398&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=41398&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=41398&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=41398&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41398&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=41398&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=41398&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=41398&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=41398&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=41398&r=support
Expected behavior: http://bugs.php.net/fix.php?id=41398&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=41398&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=41398&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41398&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41398&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41398&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=41398&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=41398&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=41398&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=41398&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=41398&r=mysqlcfg