Sebastian Bergmann wrote:
> I was not able to strip the application I'm seeing this in down to a
> small, reproducing snippet, yet.
Okay, here goes:
<?php
class Foo {
function doFoo() {
print_r($this);
}
}
class Bar {
function doBar() {
Foo::doFoo();
}
}
$bar = new Bar;
$bar->doBar();
?>
bar Object
(
)
I know that this code's logic is wrong (after the latest refactoring of
the previously mentioned application I had a leftover (no unit tests,
yet *sigh*) where a method was previously static).
But still. Is this the correct behaviour?
And why does
class Foo {
static function doFoo() {
print_r($this);
}
}
give a
Notice: Undefined variable: this
instead of the appropriate $this / object context warning?
Confused,
Sebastian
--
Sebastian Bergmann
http://sebastian-bergmann.de/ http://phpOpenTracker.de/
Das Buch zu PHP 5: http://professionelle-softwareentwicklung-mit-php5.de/
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php