#39057 [Bgs->Opn]: Docs for DOMDocument::load() describe it as static, but gives error in E_STRICT.
| From: | nickj-phpbugs at nickj dot org | Date: | Thu, 07 Dec 2006 01:18:59 +0000 |
| Subject: | #39057 [Bgs->Opn]: Docs for DOMDocument::load() describe it as static, but gives error in E_STRICT. | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969374551@lists.php.net to get a copy of this message | ||
ID: 39057
User updated by: nickj-phpbugs at nickj dot org
-Summary: Documented static method isn't
Reported By: nickj-phpbugs at nickj dot org
-Status: Bogus
+Status: Open
Bug Type: Documentation problem
Operating System: Ubuntu Linux
PHP Version: 5CVS-2006-10-06 (snap)
New Comment:
> The method _can_ be called statically, but it shouldn't.
Well in that case, there is definitely a documentation bug. Please tell
me, where does it say this in the documentation?
It should say "Calling this method statically is deprecated, and will
generate an error in E_STRICT error logging mode".
Instead it says this method can be called statically, period.
Calling a method in a way that the documentation says is valid, and
getting a error (even under the strictest error logging) is a bug -
reopening.
Please either fix the method to not generate an error, or fix the
documentation to say "you shouldn't do this".
> Most internal object methods cannot be called statically.
How is that relevant? This method's documentation explicitly says it
_can_ be called statically. To then generate an error that says
DOMDocument::load() is a "Non-static method" is at best misleading, and
at worst just plain wrong.
Previous Comments:
------------------------------------------------------------------------
[2006-12-02 07:57:48] bjori@php.net
The method _can_ be called statically, but it shouldn't.
Most internal object methods cannot be called statically.
------------------------------------------------------------------------
[2006-10-06 08:17:51] nickj-phpbugs at nickj dot org
Description:
------------
From http://php.net/manual/en/function.dom-domdocument-load.php
: "This
method may also be called statically to load and create a DOMDocument
object." There is also a code example. Running the static example code
with E_ALL | E_STRICT error_reporting generates a warning.
Reproduce code:
---------------
echo "<blah/>" > file.xml
php5.2-200610042230/sapi/cli/php -r 'error_reporting(E_ALL |
E_STRICT); $doc = DOMDocument::load("file.xml");'
Expected result:
----------------
No error.
Actual result:
--------------
PHP Strict Standards: Non-static method DOMDocument::load() should not
be called statically in Command line code on line 1
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39057&edit=1