diff options
| author | Andre Langhorst <waldschrott@php.net> | 2000-12-06 17:56:53 +0000 |
|---|---|---|
| committer | Andre Langhorst <waldschrott@php.net> | 2000-12-06 17:56:53 +0000 |
| commit | 45c218968cbe46d5bf89dd73a5c7b90246eb5237 (patch) | |
| tree | 129daa98135a744f4b86a1ed2c1250bd31bc5b34 /tests | |
| parent | 7e28784de3c13d7834b619fd6113e906eb3e9255 (diff) | |
| download | php-git-45c218968cbe46d5bf89dd73a5c7b90246eb5237.tar.gz | |
added $this in constructor test (fails currently)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/lang/030.phpt | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/lang/030.phpt b/tests/lang/030.phpt new file mode 100644 index 0000000000..9215404a4d --- /dev/null +++ b/tests/lang/030.phpt @@ -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 |
