diff options
Diffstat (limited to 'tests/lang/this_assignment.phpt')
-rw-r--r-- | tests/lang/this_assignment.phpt | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/lang/this_assignment.phpt b/tests/lang/this_assignment.phpt new file mode 100644 index 0000000..7158a34 --- /dev/null +++ b/tests/lang/this_assignment.phpt @@ -0,0 +1,43 @@ +--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===
\ No newline at end of file |