2009-06-22 01:42:13 +08:00
|
|
|
--TEST--
|
|
|
|
Test to catch early assignment of $this
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
class first {
|
|
|
|
|
|
|
|
function me() { echo "first"; }
|
|
|
|
|
2018-09-17 01:16:42 +08:00
|
|
|
function who() {
|
2009-06-22 01:42:13 +08:00
|
|
|
global $a,$b;
|
|
|
|
$this->me();
|
|
|
|
$a->me();
|
|
|
|
$b->me();
|
|
|
|
$b = new second();
|
|
|
|
$this->me();
|
|
|
|
$a->me();
|
|
|
|
$b->me();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class second {
|
|
|
|
|
2018-09-17 01:16:42 +08:00
|
|
|
function who() {
|
2009-06-22 01:42:13 +08:00
|
|
|
global $a,$b;
|
|
|
|
$this->me();
|
|
|
|
$a->me();
|
|
|
|
$b->me();
|
|
|
|
}
|
|
|
|
function me() { echo "second"; }
|
|
|
|
}
|
|
|
|
|
|
|
|
$a = new first();
|
|
|
|
$b = &$a;
|
|
|
|
|
|
|
|
$a->who();
|
|
|
|
$b->who();
|
|
|
|
|
|
|
|
echo "\n";
|
|
|
|
?>
|
|
|
|
===DONE===
|
|
|
|
--EXPECT--
|
|
|
|
firstfirstfirstfirstsecondsecondsecondsecondsecond
|
2014-12-15 02:20:23 +08:00
|
|
|
===DONE===
|