ID: 9005
Updated by: zeev
Reported By: [EMAIL PROTECTED]
Old-Status: Open
Status: Closed
Bug Type: Scripting Engine problem
Assigned To:
Comments:
class::method() isn't a static call in PHP (it isn't always a static call in C++
either).
The primary use for class::method() is actually calling methods from your parent
class, not calling 'static methods' (the ability to create static classes and call
their methods is pretty much a positive 'side effect').
So, this is the intended behavior.
Previous Comments:
---------------------------------------------------------------------------
[2001-01-30 13:39:15] [EMAIL PROTECTED]
If you call a static method from within an object, the static method will inherit the
$this pointer of the calling object. This script demonstrates the problem:
<?php
error_reporting(E_ALL);
class StaticClass {
function doSomething() {
echo $this->data;
}
}
class Instantiated {
var $data;
function Instantiated($data) {
$this->data = $data;
StaticClass::doSomething();
}
}
$ob = new Instantiated('foo');
?>
This is rather confusing behavior - $this should be out of scope inside static methods
no matter what.
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=9005&edit=2
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]