--- /dev/null
+--TEST--
+Testing operations with undefined variable
+--FILE--
+<?php
+
+var_dump($a[1]);
+var_dump($a[$c]);
+var_dump($a + 1);
+var_dump($a + $b);
+var_dump($a++);
+var_dump(++$b);
+var_dump($a->$b);
+var_dump($a->$b);
+var_dump($a->$b->$c[1]);
+
+?>
+--EXPECTF--
+Notice: Undefined variable: a in %s on line %d
+NULL
+
+Notice: Undefined variable: c in %s on line %d
+
+Notice: Undefined variable: a in %s on line %d
+NULL
+
+Notice: Undefined variable: a in %s on line %d
+int(1)
+
+Notice: Undefined variable: b in %s on line %d
+
+Notice: Undefined variable: a in %s on line %d
+int(0)
+
+Notice: Undefined variable: a in %s on line %d
+NULL
+
+Notice: Undefined variable: b in %s on line %d
+int(1)
+
+Notice: Trying to get property of non-object in %s on line %d
+NULL
+
+Notice: Trying to get property of non-object in %s on line %d
+NULL
+
+Notice: Undefined variable: c in %s on line %d
+
+Notice: Trying to get property of non-object in %s on line %d
+
+Notice: Trying to get property of non-object in %s on line %d
+NULL
--- /dev/null
+--TEST--
+Testing dynamic calls
+--FILE--
+<?php
+
+class foo {
+ static public function a() {
+ print "ok\n";
+ }
+}
+
+$a = 'a';
+$b = 'a';
+
+$class = 'foo';
+
+foo::a();
+foo::$a();
+foo::$$b();
+
+$class::a();
+$class::$a();
+$class::$$b();
+
+?>
+--EXPECT--
+ok
+ok
+ok
+ok
+ok
+ok
--- /dev/null
+--TEST--
+Trying assign value to property when an object is not returned in a function
+--FILE--
+<?php
+
+class foo {
+ public function a() {
+ }
+}
+
+$test = new foo;
+
+$test->a()->a;
+print "ok\n";
+
+$test->a()->a = 1;
+print "ok\n";
+
+?>
+--EXPECTF--
+Notice: Trying to get property of non-object in %s on line %d
+ok
+
+Strict Standards: Creating default object from empty value in %s on line %d
+ok
--- /dev/null
+--TEST--
+Testing dynamic calls using variable variables with curly syntax
+--FILE--
+<?php
+
+$a = 'b';
+$b = 'c';
+$c = 'strtoupper';
+
+var_dump(${${$a}}('foo') == 'FOO');
+
+$a = 'b';
+$b = 'c';
+$c = 'strtoupper';
+$strtoupper = 'strtolower';
+
+var_dump(${${++$a}}('FOO') == 'foo');
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
--- /dev/null
+--TEST--
+Testing function call through of array item
+--FILE--
+<?php
+
+$arr = array('strtoupper', 'strtolower');
+
+$k = 0;
+
+var_dump($arr[0]('foo') == 'FOO');
+var_dump($arr[$k]('foo') == 'FOO');
+var_dump($arr[++$k]('FOO') == 'foo');
+var_dump($arr[++$k]('FOO') == 'foo');
+
+?>
+--EXPECTF--
+bool(true)
+bool(true)
+bool(true)
+
+Notice: Undefined offset: 2 in %s on line %d
+
+Fatal error: Function name must be a string in %s on line %d
--- /dev/null
+--TEST--
+Testing assign to property of an object in an array
+--FILE--
+<?php
+
+$arr = array(new stdClass);
+
+$arr[0]->a = clone $arr[0];
+var_dump($arr);
+
+$arr[0]->b = new $arr[0];
+var_dump($arr);
+
+$arr[0]->c = $arr[0]->a;
+var_dump($arr);
+
+?>
+--EXPECT--
+array(1) {
+ [0]=>
+ object(stdClass)#1 (1) {
+ ["a"]=>
+ object(stdClass)#2 (0) {
+ }
+ }
+}
+array(1) {
+ [0]=>
+ object(stdClass)#1 (2) {
+ ["a"]=>
+ object(stdClass)#2 (0) {
+ }
+ ["b"]=>
+ object(stdClass)#3 (0) {
+ }
+ }
+}
+array(1) {
+ [0]=>
+ object(stdClass)#1 (3) {
+ ["a"]=>
+ object(stdClass)#2 (0) {
+ }
+ ["b"]=>
+ object(stdClass)#3 (0) {
+ }
+ ["c"]=>
+ object(stdClass)#2 (0) {
+ }
+ }
+}
+--UEXPECT--
+array(1) {
+ [0]=>
+ object(stdClass)#1 (1) {
+ [u"a"]=>
+ object(stdClass)#2 (0) {
+ }
+ }
+}
+array(1) {
+ [0]=>
+ object(stdClass)#1 (2) {
+ [u"a"]=>
+ object(stdClass)#2 (0) {
+ }
+ [u"b"]=>
+ object(stdClass)#3 (0) {
+ }
+ }
+}
+array(1) {
+ [0]=>
+ object(stdClass)#1 (3) {
+ [u"a"]=>
+ object(stdClass)#2 (0) {
+ }
+ [u"b"]=>
+ object(stdClass)#3 (0) {
+ }
+ [u"c"]=>
+ object(stdClass)#2 (0) {
+ }
+ }
+}
--- /dev/null
+--TEST--
+Overriding $this in catch and checking the object properties later.
+--FILE--
+<?php
+
+class foo {
+ public $test = 0;
+ private $test_2 = 1;
+ protected $test_3 = 2;
+
+ public function bar() {
+ try {
+ throw new Exception('foo');
+ } catch (Exception $this) {
+ var_dump($this);
+ }
+
+ $this->baz();
+ }
+
+ public function baz() {
+ foreach ($this as $k => $v) {
+ printf("'%s' => '%s'\n", $k, $v);
+ }
+ print "ok\n";
+ }
+}
+
+$test = new foo;
+$test->bar();
+
+?>
+--EXPECTF--
+object(Exception)#2 (6) {
+ ["message":protected]=>
+ string(3) "foo"
+ ["string":"Exception":private]=>
+ string(0) ""
+ ["code":protected]=>
+ int(0)
+ ["file":protected]=>
+ string(%d) "%s"
+ ["line":protected]=>
+ int(%d)
+ ["trace":"Exception":private]=>
+ array(1) {
+ [0]=>
+ array(6) {
+ ["file"]=>
+ string(%d) "%s"
+ ["line"]=>
+ int(%d)
+ ["function"]=>
+ string(3) "bar"
+ ["class"]=>
+ string(3) "foo"
+ ["type"]=>
+ string(2) "->"
+ ["args"]=>
+ array(0) {
+ }
+ }
+ }
+}
+'test' => '0'
+'test_2' => '1'
+'test_3' => '2'
+ok
+--UEXPECTF--
+object(Exception)#2 (6) {
+ ["message":protected]=>
+ string(3) "foo"
+ ["string":"Exception":private]=>
+ string(0) ""
+ ["code":protected]=>
+ int(0)
+ ["file":protected]=>
+ string(32) "%s"
+ ["line":protected]=>
+ int(%d)
+ ["trace":"Exception":private]=>
+ array(1) {
+ [0]=>
+ array(6) {
+ ["file"]=>
+ string(32) "%s"
+ ["line"]=>
+ int(%d)
+ ["function"]=>
+ string(3) "bar"
+ ["class"]=>
+ string(3) "foo"
+ ["type"]=>
+ string(2) "->"
+ ["args"]=>
+ array(0) {
+ }
+ }
+ }
+}
+'test' => '0'
+'test_2' => '1'
+'test_3' => '2'
+ok