#40886 [NEW]: static methods assigned to instances
| From: | andrea at 3site dot it | Date: | Wed, 21 Mar 2007 18:56:55 +0000 |
| Subject: | #40886 [NEW]: static methods assigned to instances | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-110657@lists.php.net to get a copy of this message | ||
From: andrea at 3site dot it
Operating system: Windows XP SP2
PHP version: 5.2.1
PHP Bug Type: Class/Object related
Bug description: static methods assigned to instances
Description:
------------
Description:
------------
I don't know if it is by design, but this is not what I would expect
logically ... (and with static variables it doesn't happen so it should be
a _strange_ logic)
I suppose this problem is related with this one:
http://bugs.php.net/bug.php?id=40837
but I think this one is *not* callable Irrelevant
Reproduce code:
---------------
<?php
class ExampleClass {
public static function StaticExample(){
echo "StaticExample", "<br />";
}
public function InstanceExample(){
echo "InstanceExample", "<br />";
}
}
$test = new ExampleClass();
ExampleClass::StaticExample(); // ok
$test->InstanceExample(); // ok
$test->StaticExample(); // what the hell?
?>
Expected result:
----------------
StaticExample
InstanceExample
FATAL ERROR ... undefined method StaticExample
Actual result:
--------------
StaticExample
InstanceExample
StaticExample
--
Edit bug report at http://bugs.php.net/?id=40886&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40886&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40886&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40886&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40886&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=40886&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=40886&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=40886&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=40886&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=40886&r=support
Expected behavior: http://bugs.php.net/fix.php?id=40886&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=40886&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=40886&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40886&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40886&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40886&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=40886&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=40886&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=40886&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=40886&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=40886&r=mysqlcfg