--TEST-- Bug #48912 (Namespace causes unexpected strict behaviour with extract()) --FILE-- 1)); echo "ok\n"; ?> --EXPECT-- ok --TEST-- jump 05: goto from loop (forward) --FILE-- --EXPECT-- 1: ok 2: ok 3: ok --TEST-- Bug #54265 (crash when variable gets reassigned in error handler) --FILE-- errormsg = "xyz"); echo "ok\n"; ?> --EXPECT-- EROOR: Creating default object from empty value ok --TEST-- Testing __debugInfo() magic method with bad returns ONE (float) --FILE-- val; } public function __construct($val) { $this->val = $val; } } $c = new C(1.0); var_dump($c); --EXPECTF-- Fatal error: __debuginfo() must return an array in %s%eZend%etests%edebug_info-error-1.0.php on line %d --TEST-- list() with keys, evaluation order #2 --FILE-- $a, 1 => $b) = ['a', 'b']; var_dump($a); var_dump($b); list(1 => $b, 0 => $a) = ['a', 'b']; var_dump($a); var_dump($b); $arr = []; list($arr[], $arr[]) = ['a', 'b']; var_dump($arr[0]); var_dump($arr[1]); $arr = []; list(0 => $arr[], 1 => $arr[]) = ['a', 'b']; var_dump($arr[0]); var_dump($arr[1]); $arr = []; list(1 => $arr[], 0 => $arr[]) = ['b', 'a']; var_dump($arr[0]); var_dump($arr[1]); $arr = []; list(list(1 => $arr[], 0 => $arr[])) = [['b', 'a']]; var_dump($arr[0]); var_dump($arr[1]); $arr = []; list('key1' => $arr[], 'key2' => $arr[]) = ['key2' => 'b', 'key1' => 'a']; var_dump($arr[0]); var_dump($arr[1]); // This should print 'foo' $a = 0; list($a => $a) = ['foo', 'bar']; var_dump($a); // This should print 'bar' then 'foo' $a = 0; $b = 1; list($b => $a, $a => $c) = ['bar' => 'foo', 1 => 'bar']; var_dump($a); var_dump($c); ?> --EXPECT-- string(1) "a" string(1) "b" string(1) "a" string(1) "b" string(1) "a" string(1) "b" string(1) "a" string(1) "b" string(1) "a" string(1) "b" string(1) "a" string(1) "b" string(1) "a" string(1) "b" string(1) "a" string(1) "b" string(3) "foo" string(3) "bar" string(3) "foo" --TEST-- class constants basic tests --FILE-- --EXPECTF-- string(6) "string" int(1) Fatal error: Uncaught Error: Undefined class constant 'val3' in %s:%d Stack trace: #0 {main} thrown in %s on line %d --TEST-- braces variable replacement test (nowdoc) --FILE-- --EXPECT-- This is nowdoc test #{$a}. This is nowdoc test #{$b}. --TEST-- errmsg: default value for parameters with array type can only be an array or NULL --FILE-- --EXPECTF-- Fatal error: Default value for parameters with array type can only be an array or NULL in %s on line %d --TEST-- Catch method calls on non-objects raise recoverable errors --FILE-- method()); } catch (Error $e) { var_dump($e->getCode(), $e->getMessage()); } echo "Alive\n"; ?> --EXPECTF-- int(0) string(%d) "Call to a member function method() on null" Alive --TEST-- Bug #22836 (returning references to NULL) --FILE-- --EXPECT-- string(3) "foo" 'foo' string(3) "foo" 'foo' string(3) "foo" 'foo' string(3) "foo" 'foo' string(3) "foo" 'foo' string(3) "foo" 'foo' string(3) "foo" 'foo' string(3) "foo" 'foo' --TEST-- Bug #40705 (Iterating within function moves original array pointer) --FILE-- $v) { // do stuff } } $foo = array('foo', 'bar', 'baz'); var_dump(key($foo)); doForeach($foo); var_dump(key($foo)); foreach ($foo as $k => $v) { var_dump($k); } var_dump(key($foo)); --EXPECT-- int(0) int(0) int(0) int(1) int(2) int(0) --TEST-- Constant arrays --INI-- zend.enable_gc=1 --FILE-- 'bar']]); const FOO_BAR = [1, 2, 3, ['foo' => 'bar']]; $x = FOOBAR; $x[0] = 7; var_dump($x, FOOBAR); $x = FOO_BAR; $x[0] = 7; var_dump($x, FOO_BAR); // ensure references are removed $x = 7; $y = [&$x]; define('QUX', $y); $y[0] = 3; var_dump($x, $y, QUX); // ensure objects not allowed in arrays var_dump(define('ELEPHPANT', [new StdClass])); // ensure recursion doesn't crash $recursive = []; $recursive[0] = &$recursive; var_dump(define('RECURSION', $recursive)); --EXPECTF-- array(4) { [0]=> int(7) [1]=> int(2) [2]=> int(3) [3]=> array(1) { ["foo"]=> string(3) "bar" } } array(4) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> array(1) { ["foo"]=> string(3) "bar" } } array(4) { [0]=> int(7) [1]=> int(2) [2]=> int(3) [3]=> array(1) { ["foo"]=> string(3) "bar" } } array(4) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> array(1) { ["foo"]=> string(3) "bar" } } int(3) array(1) { [0]=> &int(3) } array(1) { [0]=> int(7) } Warning: Constants may only evaluate to scalar values, arrays or resources in %s on line %d bool(false) Warning: Constants cannot be recursive arrays in %s on line %d bool(false) --TEST-- traverse an array and use its keys to unset GLOBALS --FILE-- 1, "b" => 2); foreach ($arr as $key => $val) { unset($GLOBALS[$key]); } var_dump($arr); echo "Done\n"; ?> --EXPECT-- array(2) { ["a"]=> int(1) ["b"]=> int(2) } Done --TEST-- ZE2 Late Static Binding testing get_called_class() --FILE-- ==DONE== --EXPECT-- TestClass ChildClass ==DONE== --TEST-- Bug #38779 (engine crashes when require()'ing file with syntax error through userspace stream wrapper) --FILE-- data = '<' . "?php \n\"\";ll l\n ?" . '>'; $this->position = 0; return true; } function stream_read($count) { $ret = substr($this->data, $this->position, $count); $this->position += strlen($ret); return $ret; } function stream_eof() { return $this->position >= strlen($this->data); } function stream_flush() { var_dump("flush!"); } function stream_close() { @unlink(dirname(__FILE__)."/bug38779.txt"); var_dump("close!"); } } stream_wrapper_register('Loader', 'Loader'); $fp = fopen ('Loader://qqq.php', 'r'); $filename = dirname(__FILE__)."/bug38779.txt"; $fp1 = fopen($filename, "w"); fwrite($fp1, "<"."?php blah blah?".">"); fclose($fp1); include $filename; echo "Done\n"; ?> --CLEAN-- --EXPECTF-- Parse error: %s error%sin %s on line %d string(6) "close!" 0=0&~2000000000 --TEST-- Bug #70748 (Segfault in ini_lex () at Zend/zend_ini_scanner.l) --FILE-- --CLEAN-- --EXPECTF-- Warning: syntax error, unexpected $end, expecting '}' in %sbug70748.ini on line %d in %sbug70748.php on line %d bool(false) --TEST-- Leak in JMP_SET --SKIPIF-- --FILE-- DONE --EXPECT-- DONE --TEST-- Bug #44913 (Segfault when using return in combination with nested loops and continue 2) --FILE-- --EXPECT-- ok --TEST-- 037: Name ambiguity (namespace name or namespace's class name) --FILE-- --EXPECTF-- Notice: Constant 1 already defined in %s on line %d int(2) int(2) int(2) int(1) int(3) --TEST-- Bug #69568: call a private function in closure failed --FILE-- --EXPECT-- 1 --TEST-- casting different variables to object --FILE-- --EXPECTF-- object(stdClass)#%d (1) { ["scalar"]=> string(6) "string" } object(stdClass)#%d (1) { ["scalar"]=> string(7) "8754456" } object(stdClass)#%d (1) { ["scalar"]=> string(0) "" } object(stdClass)#%d (1) { ["scalar"]=> string(1) "" } object(stdClass)#%d (1) { ["scalar"]=> int(9876545) } object(stdClass)#%d (1) { ["scalar"]=> float(0.1) } object(stdClass)#%d (0) { } object(stdClass)#%d (3) { ["0"]=> int(1) ["1"]=> int(2) ["2"]=> int(3) } object(stdClass)#%d (1) { ["scalar"]=> bool(false) } object(stdClass)#%d (1) { ["scalar"]=> bool(true) } object(stdClass)#%d (0) { } object(stdClass)#%d (1) { ["scalar"]=> resource(%d) of type (stream) } object(test)#%d (0) { } Done --TEST-- instanceof self outside a class --FILE-- getMessage(), "\n"; } }; $fn(); ?> --EXPECT-- Cannot access self:: when no class scope is active --TEST-- Bug #34064 (arr[] as param to function in class gives invalid opcode) --FILE-- test_ref($ar[]); var_dump($ar); $this->test($ar[]); } } $o = new XmlTest(); $o->run(); ?> --EXPECTF-- array(1) { [0]=> string(2) "ok" } Fatal error: Uncaught Error: Cannot use [] for reading in %sbug34064.php:18 Stack trace: #0 %s(%d): XmlTest->run() #1 {main} thrown in %sbug34064.php on line 18 --TEST-- Closure 047: Use in preg_replace_callback() using variables by reference --FILE-- --EXPECT-- a=0 a=0, b=1 a=0, b=1, c=2 Done --TEST-- Bug #48248 (SIGSEGV when access to private property via &__get) --FILE-- test; } } class B extends A { private $test; } $b = new B; var_dump($b->test); ?> --EXPECTF-- Notice: Undefined property: B::$test in %s on line %d Notice: Only variable references should be returned by reference in %s on line %d NULL --TEST-- Bug #40509 (key() function changed behaviour if global array is used within function) --FILE-- $v) { var_dump($k); } var_dump(key($arr["v"])); --EXPECT-- int(0) int(0) int(0) int(0) --TEST-- using multiple access modifiers (static methods) --FILE-- --EXPECTF-- Fatal error: Multiple static modifiers are not allowed in %s on line %d --TEST-- Bug #27304 (Static functions don't function properly) --FILE-- test(); ?> ===DONE=== --EXPECT-- bool(false) bool(false) ===DONE=== --TEST-- Passing Closure as parameter to an non-existent function --FILE-- --EXPECTF-- Deprecated: %son-static method foo::teste() should not be called statically in %s on line %d string(1) "x" array(1) { [0]=> object(Closure)#%d (1) { ["parameter"]=> array(2) { ["$a"]=> string(10) "" ["$b"]=> string(10) "" } } } int(1) --TEST-- 084: unbracketed namespace with nested bracketed namespace --FILE-- ===DONE=== --EXPECTF-- Fatal error: Cannot mix bracketed namespace declarations with unbracketed namespace declarations in %sns_084.php on line 9 --TEST-- GC 021: GC detach reference with assign by reference --INI-- zend.enable_gc=1 --FILE-- --EXPECT-- int(2) ok --TEST-- Bug #26166 (__toString() crash when no values returned) --FILE-- obj = new Foo(); } function __toString() { return $this->obj->__toString(); } } $o = new Bar; echo $o; echo "===NONE===\n"; function my_error_handler($errno, $errstr, $errfile, $errline) { var_dump($errstr); } set_error_handler('my_error_handler'); class NoneTest { function __toString() { } } $o = new NoneTest; echo $o; echo "===THROW===\n"; class ErrorTest { function __toString() { throw new Exception("This is an error!"); } } $o = new ErrorTest; try { echo $o; } catch (Exception $e) { echo "Got the exception\n"; } ?> ===DONE=== --EXPECTF-- Hello World! ===NONE=== string(%d) "Method NoneTest::__toString() must return a string value" ===THROW=== Fatal error: Method ErrorTest::__toString() must not throw an exception, caught Exception: This is an error! in %sbug26166.php on line %d --TEST-- Heredoc with double quotes and wrong prefix --FILE-- --EXPECTF-- Parse error: %s in %sheredoc_013.php on line %d --TEST-- errmsg: cannot use 'parent' as class name --FILE-- --EXPECTF-- Fatal error: Cannot use 'parent' as class name as it is reserved in %s on line %d --TEST-- Testing class_alias() with abstract class using an arbitrary class name as alias --FILE-- --EXPECTF-- Fatal error: Uncaught Error: Cannot instantiate abstract class foo in %s:%d Stack trace: #0 {main} thrown in %s on line %d --TEST-- Accessing members of standard object through of variable variable --FILE-- a =& $$test; $$test->a->b[] = 2; var_dump($$test); ?> --EXPECTF-- object(stdClass)#%d (2) { ["a"]=> *RECURSION* ["b"]=> array(1) { [0]=> int(2) } } --TEST-- $this in foreach --FILE-- --EXPECTF-- Fatal error: Cannot re-assign $this in %sthis_in_foreach_001.php on line 3 --TEST-- exception handler tests - 4 --FILE-- --EXPECTF-- Warning: set_exception_handler() expects the argument (fo) to be a valid callback in %s on line %d Warning: set_exception_handler() expects the argument (::) to be a valid callback in %s on line %d Warning: set_exception_handler() expects exactly 1 parameter, 0 given in %s on line %d Warning: set_exception_handler() expects exactly 1 parameter, 2 given in %s on line %d Done --TEST-- 054: namespace and interfaces --FILE-- attach($foo); $foo->update($bar); ?> --EXPECT-- ok ok --TEST-- Const array deference --FILE-- --EXPECTF-- int(4) Notice: Undefined index: foo in %sconst_dereference_001.php on line %d NULL int(6) 123 --TEST-- Test nowdoc and line numbering --FILE-- --EXPECT-- 6 string(0) "" 10 string(0) "" 14 string(4) "test" 19 string(4) "test" 24 string(20) "test1 test2 test3 " 34 string(20) "test1 test2 test3 " 44 ok --TEST-- Bug #35106 (nested foreach fails when array variable has a reference) --FILE-- --EXPECT-- 12 --TEST-- Assign concat of array and empty string --FILE-- --EXPECTF-- Notice: Array to string conversion in %s on line %d string(5) "Array" --TEST-- goto inside foreach --FILE-- --EXPECT-- loop done --TEST-- 026: Name ambiguity (class name & namespace name) --INI-- opcache.optimization_level=0 --FILE-- --EXPECT-- ok ok ok --TEST-- method overloading with different method signature --INI-- error_reporting=8191 --FILE-- --EXPECTF-- Warning: Declaration of test3::foo() should be compatible with & test::foo() in %s on line %d Done --TEST-- Testing func_get_args() --FILE-- --EXPECTF-- Warning: func_get_args(): Called from the global scope - no function context in %s on line 3 --TEST-- assgin to object leaks with ref --FILE-- a = a(1); unset($this->a); } } $a = new A; $a->test(); $a->test(); echo "okey"; ?> --EXPECT-- okey --TEST-- Bug #74862 (Unable to clone instance when private __clone defined) --FILE-- cloneIt(); var_dump($e); ?> --EXPECT-- object(c)#2 (0) { } --TEST-- Bug #48693 (Double declaration of __lambda_func when lambda wrongly formatted) --FILE-- --EXPECTF-- Deprecated: Function create_function() is deprecated in %s on line %d ParseError: syntax error, unexpected '}', expecting end of file in %sbug48693.php(4) : runtime-created function:1 Stack trace: #0 %sbug48693.php(4): create_function('', 'return 1; }') #1 {main} Deprecated: Function create_function() is deprecated in %s on line %d Deprecated: Function create_function() is deprecated in %s on line %d ParseError: syntax error, unexpected end of file in %sbug48693.php(14) : runtime-created function:1 Stack trace: #0 %sbug48693.php(14): create_function('', '{') #1 {main} Deprecated: Function create_function() is deprecated in %s on line %d int(2) int(3) --TEST-- Bug #71724: yield from does not count EOLs --FILE-- current()); ?> --EXPECT-- int(10) --EXPECTF-- Fatal error: Multiple access type modifiers are not allowed in %s on line %d --TEST-- GC 006: Simple array-object cycle --INI-- zend.enable_gc=1 --FILE-- a = array(); $a->a[0] =& $a; var_dump($a); unset($a); var_dump(gc_collect_cycles()); echo "ok\n" ?> --EXPECTF-- object(stdClass)#%d (1) { ["a"]=> array(1) { [0]=> *RECURSION* } } int(2) ok --TEST-- Unmixed group use declarations mustn't allow more than one comma --FILE-- --EXPECTF-- Parse error: syntax error, unexpected ',', expecting '}' in %s on line %d --TEST-- Case-insensitive constants are deprecated --FILE-- --EXPECTF-- Deprecated: define(): Declaration of case-insensitive constants is deprecated in %s on line 4 Deprecated: define(): Declaration of case-insensitive constants is deprecated in %s on line 5 int(42) Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 8 int(42) Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 9 int(42) int(24) int(24) Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 13 int(24) bool(true) bool(true) bool(true) bool(true) bool(true) int(42) Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 22 int(42) int(24) int(24) Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 25 int(24) int(24) Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 30 int(24) int(24) Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 35 int(24) int(42) Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 40 int(42) bool(true) bool(true) bool(true) bool(true) bool(true) int(42) Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 49 int(42) int(24) int(24) Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 52 int(24) int(42) Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 56 int(42) int(43) Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 60 int(43) --TEST-- Bug #44660 (Indexed and reference assignment to propery of non-object don't trigger warning) --FILE-- read access: "; echo $a->p; echo "\n--> direct assignment: "; $a->p = $s; echo "\n--> increment: "; $a->p++; echo "\n--> reference assignment:"; $a->p =& $s; echo "\n--> reference assignment:"; $s =& $a->p; echo "\n--> indexed assignment:"; $a->p[0] = $s; echo "\n--> Confirm assignments have had no impact:\n"; var_dump($a); ?> --EXPECTF-- --> read access: Notice: Trying to get property 'p' of non-object in %sbug44660.php on line 6 --> direct assignment: Warning: Attempt to assign property 'p' of non-object in %sbug44660.php on line 9 --> increment: Warning: Attempt to increment/decrement property 'p' of non-object in %sbug44660.php on line 12 --> reference assignment: Warning: Attempt to modify property 'p' of non-object in %sbug44660.php on line 15 --> reference assignment: Warning: Attempt to modify property 'p' of non-object in %sbug44660.php on line 18 --> indexed assignment: Warning: Attempt to modify property 'p' of non-object in %sbug44660.php on line 21 --> Confirm assignments have had no impact: bool(true) --TEST-- array_shift() function precerve foreach by reference iterator pointer --FILE-- --EXPECT-- 1 2 3 4 array(0) { } --TEST-- Bug #53958 (Closures can't 'use' shared variables by value and by reference) --FILE-- --EXPECT-- 1 1 1 1 5 6 7 8 5 1 6 1 1 5 1 6 --TEST-- Flexible heredoc syntax error 3: mixing spaces and tabs in ending marker --FILE-- --EXPECTF-- Parse error: Invalid indentation - tabs and spaces cannot be mixed in %s on line %d