mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
added $this in constructor test (fails currently)
This commit is contained in:
parent
7e28784de3
commit
45c218968c
33
tests/lang/030.phpt
Normal file
33
tests/lang/030.phpt
Normal file
@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
$this in constructor test
|
||||
--POST--
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php
|
||||
class foo {
|
||||
function foo($name) {
|
||||
$GLOBALS['List']= &$this;
|
||||
$this->Name = $name;
|
||||
$GLOBALS['List']->echoName(); }
|
||||
|
||||
function echoName() {
|
||||
$GLOBALS['names'][]=$this->Name; } }
|
||||
|
||||
function &foo2(&$foo) {
|
||||
return $foo; }
|
||||
|
||||
|
||||
$bar1 = new foo('constructor');
|
||||
$bar1->Name = 'outside';
|
||||
$bar1->echoName();
|
||||
|
||||
$bar1 = foo2(new foo('constructor'));
|
||||
$bar1->Name = 'outside';
|
||||
$bar1->echoName();
|
||||
|
||||
$List->echoName();
|
||||
|
||||
print ($names==array('constructor','constructor','constructor','constructor','constructor')) ? 'success:':'failure';
|
||||
?>
|
||||
--EXPECT--
|
||||
success
|
Loading…
Reference in New Issue
Block a user