#42955 [Opn->Bgs]: Public method can be call as static method
| From: | bjori@php.net | Date: | Sat, 13 Oct 2007 11:47:02 +0000 |
| Subject: | #42955 [Opn->Bgs]: Public method can be call as static method | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-118504@lists.php.net to get a copy of this message | ||
ID: 42955
Updated by: bjori@php.net
Reported By: nicolas_boiteux at yahoo dot fr
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: all
PHP Version: 5.2.4
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
PHP Strict Standards: Non-static method job::doit() should not be
called statically in /home/bjori/- on line 11
Previous Comments:
------------------------------------------------------------------------
[2007-10-13 09:46:45] nicolas_boiteux at yahoo dot fr
Description:
------------
Without instanciate object, its methods can be call directly as static
methods.
This bug is also relative to this one:
http://bugs.php.net/bug.php?id=42016
Reproduce code:
---------------
<?php
class job{
public function doit(){
echo("yes");
}
}
job::doit();
?>
other exemple which return the normal error message:
<?php
class job{
private $foo;
public function doit(){
echo($this->foo);
}
}
job::doit();
?>
error message returned:
Fatal error: Using $this when not in object context in
Expected result:
----------------
should return a fatal error:
Fatal error: Using public method when not in object context in .. on
line...
as doit is not a static method, and not in an objet context.
Actual result:
--------------
print "yes"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42955&edit=1