Date: 01/03/01
- Next message: Zeev Suraski: "[PHP-DEV] 4.0.4pl1 RC1 rolled"
- Previous message: Zeev Suraski: "Re: [PHP-DEV] array_*() fixes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
While working on Mail_rfc822:: for PEAR, I came across the following scenario:
<?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 results in no errors of any kind and the output 'foo';
I would expect $this to be undefined inside static method calls; instead, it
seems to be defined to the $this pointer of the calling object, if you are
indeed calling from within an object.
Is this just a side effect? I think $this should be undefined inside all static
method calls (even if you call a method in the class - you might _want_ static
behavior sometimes), but I don't know how feasible that is, and I'm interested
what Zeev and co. have to say...
-chuck
-- Charles Hagenbuch, <chuck <email protected>> "If you can't stand the heat, get out of the chicken!" - Baby Blues-- 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: Zeev Suraski: "[PHP-DEV] 4.0.4pl1 RC1 rolled"
- Previous message: Zeev Suraski: "Re: [PHP-DEV] array_*() fixes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

