mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
44 lines
583 B
PHP
44 lines
583 B
PHP
--TEST--
|
|
Test to catch early assignment of $this
|
|
--FILE--
|
|
<?php
|
|
class first {
|
|
|
|
function me() { echo "first"; }
|
|
|
|
function who() {
|
|
global $a,$b;
|
|
$this->me();
|
|
$a->me();
|
|
$b->me();
|
|
$b = new second();
|
|
$this->me();
|
|
$a->me();
|
|
$b->me();
|
|
}
|
|
}
|
|
|
|
class second {
|
|
|
|
function who() {
|
|
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
|
|
===DONE===
|