Date: 03/08/01
- Next message: achim <email protected>: "[PHP-DEV] PHP 4.0 Bug #9617: fileposition error"
- Previous message: Zeev Suraski: "Re: [PHP-DEV] zend_ticks crash and question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ID: 9005
Updated by: zeev
Reported By: chuck <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] chuck <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: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: achim <email protected>: "[PHP-DEV] PHP 4.0 Bug #9617: fileposition error"
- Previous message: Zeev Suraski: "Re: [PHP-DEV] zend_ticks crash and question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

