diff options
Diffstat (limited to 'Zend/tests')
83 files changed, 761 insertions, 150 deletions
diff --git a/Zend/tests/anon/015.phpt b/Zend/tests/anon/015.phpt new file mode 100644 index 0000000000..f55c4b2605 --- /dev/null +++ b/Zend/tests/anon/015.phpt @@ -0,0 +1,30 @@ +--TEST-- +static variables in methods inherited from parent class +--FILE-- +<?php +class C { + function foo ($y = null) { + static $x = null; + if (!is_null($y)) { + $x = [$y]; + } + return $x; + } +} +$c = new C(); +$c->foo(42); +$d = new class extends C {}; +var_dump($d->foo()); +var_dump($d->foo(24)); +var_dump($c->foo()); +?> +--EXPECT-- +NULL +array(1) { + [0]=> + int(24) +} +array(1) { + [0]=> + int(42) +} diff --git a/Zend/tests/anon/016.phpt b/Zend/tests/anon/016.phpt new file mode 100644 index 0000000000..a5607cda74 --- /dev/null +++ b/Zend/tests/anon/016.phpt @@ -0,0 +1,31 @@ +--TEST-- +static variables in methods inherited from parent class (can't cache objects) +--FILE-- +<?php +class C { + function foo ($y = null) { + static $x = null; + if (!is_null($y)) { + $x = [$y]; + } + return $x; + } +} +$c = new C(); +$c->foo(new stdClass); +$d = new class extends C {}; +var_dump($d->foo()); +var_dump($d->foo(24)); +var_dump($c->foo()); +?> +--EXPECT-- +NULL +array(1) { + [0]=> + int(24) +} +array(1) { + [0]=> + object(stdClass)#2 (0) { + } +} diff --git a/Zend/tests/array_self_add_globals.phpt b/Zend/tests/array_self_add_globals.phpt index ebad7c3fdf..78dd3bf9a3 100644 --- a/Zend/tests/array_self_add_globals.phpt +++ b/Zend/tests/array_self_add_globals.phpt @@ -2,7 +2,6 @@ Add $GLOBALS to itself --FILE-- <?php -$GLOBALS += $GLOBALS; $x = $GLOBALS + $GLOBALS; ?> ===DONE=== diff --git a/Zend/tests/array_unpack/non_integer_keys.phpt b/Zend/tests/array_unpack/non_integer_keys.phpt index a5e407743c..ab7a20ac86 100644 --- a/Zend/tests/array_unpack/non_integer_keys.phpt +++ b/Zend/tests/array_unpack/non_integer_keys.phpt @@ -1,5 +1,5 @@ --TEST-- -Array unpacking does not work with non-integer keys +Array unpacking does not work with non-integer/string keys --FILE-- <?php function gen() { @@ -15,4 +15,4 @@ try { ?> --EXPECT-- -Exception: Cannot unpack Traversable with non-integer keys +Exception: Keys must be of type int|string during array unpacking diff --git a/Zend/tests/array_unpack/string_keys.phpt b/Zend/tests/array_unpack/string_keys.phpt index e4cfd77f58..d446e69cab 100644 --- a/Zend/tests/array_unpack/string_keys.phpt +++ b/Zend/tests/array_unpack/string_keys.phpt @@ -1,22 +1,58 @@ --TEST-- -array unpacking with string keys (not supported) +Array unpacking with string keys --FILE-- <?php -try { - $array = [1, 2, "foo" => 3, 4]; - var_dump([...$array]); -} catch (Error $ex) { - var_dump($ex->getMessage()); -} -try { - $iterator = new ArrayIterator([1, 2, "foo" => 3, 4]); - var_dump([...$iterator]); -} catch (Error $ex) { - var_dump($ex->getMessage()); +// Works with both arrays and Traversables. +$array = [1, 2, "foo" => 3, 4]; +var_dump([...$array]); + +$iterator = new ArrayIterator([1, 2, "foo" => 3, 4]); +var_dump([...$iterator]); + +// Test overwriting behavior. +$array1 = ["foo" => 1]; +$array2 = ["foo" => 2]; +var_dump(["foo" => 0, ...$array1, ...$array2]); +var_dump(["foo" => 0, ...$array1, ...$array2, "foo" => 3]); + +// Test numeric string key from iterator. +function gen() { + yield "42" => 42; } +var_dump([...gen()]); ?> --EXPECT-- -string(36) "Cannot unpack array with string keys" -string(42) "Cannot unpack Traversable with string keys" +array(4) { + [0]=> + int(1) + [1]=> + int(2) + ["foo"]=> + int(3) + [2]=> + int(4) +} +array(4) { + [0]=> + int(1) + [1]=> + int(2) + ["foo"]=> + int(3) + [2]=> + int(4) +} +array(1) { + ["foo"]=> + int(2) +} +array(1) { + ["foo"]=> + int(3) +} +array(1) { + [0]=> + int(42) +} diff --git a/Zend/tests/array_unpack/unpack_string_keys_compile_time.phpt b/Zend/tests/array_unpack/unpack_string_keys_compile_time.phpt index 1401fb9bd5..df58d78a6a 100644 --- a/Zend/tests/array_unpack/unpack_string_keys_compile_time.phpt +++ b/Zend/tests/array_unpack/unpack_string_keys_compile_time.phpt @@ -1,10 +1,23 @@ --TEST-- -Unpacking of string keys detected at compile-time +Unpacking of string keys is supported at compile-time --FILE-- <?php var_dump([...['a' => 'b']]); +var_dump(['a' => 'X', ...['a' => 'b']]); +var_dump([...['a' => 'b'], 'a' => 'X']); ?> ---EXPECTF-- -Fatal error: Cannot unpack array with string keys in %s on line %d +--EXPECT-- +array(1) { + ["a"]=> + string(1) "b" +} +array(1) { + ["a"]=> + string(1) "b" +} +array(1) { + ["a"]=> + string(1) "X" +} diff --git a/Zend/tests/attributes/016_custom_attribute_validation.phpt b/Zend/tests/attributes/016_custom_attribute_validation.phpt index 0f3167f986..11ffeaa774 100644 --- a/Zend/tests/attributes/016_custom_attribute_validation.phpt +++ b/Zend/tests/attributes/016_custom_attribute_validation.phpt @@ -2,8 +2,8 @@ Attribute validation callback of internal attributes. --SKIPIF-- <?php -if (!extension_loaded('zend-test')) { - echo "skip requires zend-test extension\n"; +if (!extension_loaded('zend_test')) { + echo "skip requires zend_test extension\n"; } --FILE-- <?php diff --git a/Zend/tests/bug27798.phpt b/Zend/tests/bug27798.phpt index 310fd97991..c16c5c825d 100644 --- a/Zend/tests/bug27798.phpt +++ b/Zend/tests/bug27798.phpt @@ -57,12 +57,12 @@ array(3) { } Child::__construct array(3) { - ["Baz"]=> - int(4) ["Foo"]=> int(1) ["Bar"]=> int(2) + ["Baz"]=> + int(4) } array(1) { ["Foo"]=> diff --git a/Zend/tests/bug43201.phpt b/Zend/tests/bug43201.phpt index 49816ea1c1..c93b118e16 100644 --- a/Zend/tests/bug43201.phpt +++ b/Zend/tests/bug43201.phpt @@ -30,25 +30,37 @@ Warning: Undefined variable $ref in %s on line %d Warning: Undefined variable $undef in %s on line %d +Deprecated: chop(): Passing null to parameter #1 ($string) of type string is deprecated in %s on line %d + Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17 Warning: Undefined variable $undef in %s on line %d +Deprecated: chop(): Passing null to parameter #1 ($string) of type string is deprecated in %s on line %d + Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17 Warning: Undefined variable $undef in %s on line %d +Deprecated: chop(): Passing null to parameter #1 ($string) of type string is deprecated in %s on line %d + Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17 Warning: Undefined variable $undef in %s on line %d +Deprecated: chop(): Passing null to parameter #1 ($string) of type string is deprecated in %s on line %d + Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17 Warning: Undefined variable $undef in %s on line %d +Deprecated: chop(): Passing null to parameter #1 ($string) of type string is deprecated in %s on line %d + Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17 Warning: Undefined variable $undef in %s on line %d +Deprecated: chop(): Passing null to parameter #1 ($string) of type string is deprecated in %s on line %d + Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17 ok diff --git a/Zend/tests/bug53826.phpt b/Zend/tests/bug53826.phpt new file mode 100644 index 0000000000..3f0a069536 --- /dev/null +++ b/Zend/tests/bug53826.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #53826: __callStatic fired in base class through a parent call if the method is private +--FILE-- +<?php + +class A1 { + public function __call($method, $args) { echo "__call\n"; } + public static function __callStatic($method, $args) { echo "__callStatic\n"; } +} + +class A2 { // A1 with private function test + public function __call($method, $args) { echo "__call\n"; } + public static function __callStatic($method, $args) { echo "__callStatic\n"; } + private function test() {} +} + +class B1 extends A1 { + public function test(){ parent::test(); } +} + +class B2 extends A2 { + public function test(){ parent::test(); } +} + +$test1 = new B1; +$test2 = new B2; +$test1->test(); +$test2->test(); + +?> +--EXPECT-- +__call +__call diff --git a/Zend/tests/bug60536_003.phpt b/Zend/tests/bug60536_003.phpt index 3ba23b9288..8696591bb2 100644 --- a/Zend/tests/bug60536_003.phpt +++ b/Zend/tests/bug60536_003.phpt @@ -32,14 +32,14 @@ var_dump($b); ?> --EXPECTF-- object(SubclassA)#%d (2) { - ["hello":"SubclassA":private]=> - int(0) ["hello":"BaseWithPropA":private]=> int(0) + ["hello":"SubclassA":private]=> + int(0) } object(SubclassB)#%d (2) { - ["hello":"SubclassB":private]=> - int(0) ["hello":"BaseWithTPropB":private]=> int(0) + ["hello":"SubclassB":private]=> + int(0) } diff --git a/Zend/tests/bug64677.phpt b/Zend/tests/bug64677.phpt index 2dcd00ce0a..c3b168bd83 100644 --- a/Zend/tests/bug64677.phpt +++ b/Zend/tests/bug64677.phpt @@ -7,7 +7,7 @@ class cat { } } $cat = new cat(); -$cat->show_output('Files: ', trim(`cd .`)); // this gives invalid args to shell_exec +$cat->show_output('Files: ', trim((string) `cd .`)); // this gives invalid args to shell_exec $cat->show_output('Files: ', `cd .`); // this causes a segmentation fault $cat->show_output(`cd .`); // this causes a segmentation fault diff --git a/Zend/tests/bug70895.phpt b/Zend/tests/bug70895.phpt index 1a28d9ef5c..afbea1c91d 100644 --- a/Zend/tests/bug70895.phpt +++ b/Zend/tests/bug70895.phpt @@ -20,6 +20,6 @@ try { } ?> --EXPECT-- -array_map(): Argument #1 ($callback) must be a valid callback, function "%n" not found or invalid function name -array_map(): Argument #1 ($callback) must be a valid callback, function "%n %i" not found or invalid function name -array_map(): Argument #1 ($callback) must be a valid callback, function "%n %i aoeu %f aoeu %p" not found or invalid function name +array_map(): Argument #1 ($callback) must be a valid callback or null, function "%n" not found or invalid function name +array_map(): Argument #1 ($callback) must be a valid callback or null, function "%n %i" not found or invalid function name +array_map(): Argument #1 ($callback) must be a valid callback or null, function "%n %i aoeu %f aoeu %p" not found or invalid function name diff --git a/Zend/tests/bug70898.phpt b/Zend/tests/bug70898.phpt index 2aff5109d8..d3d2cf79a9 100644 --- a/Zend/tests/bug70898.phpt +++ b/Zend/tests/bug70898.phpt @@ -13,4 +13,4 @@ try { } ?> --EXPECT-- -array_map(): Argument #1 ($callback) must be a valid callback, function "0000000000000000000000000000000000" not found or invalid function name +array_map(): Argument #1 ($callback) must be a valid callback or null, function "0000000000000000000000000000000000" not found or invalid function name diff --git a/Zend/tests/bug71539_6.phpt b/Zend/tests/bug71539_6.phpt deleted file mode 100644 index d690538595..0000000000 --- a/Zend/tests/bug71539_6.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -Bug #71539.5 (Memory error on $arr[$a] =& $arr[$b] if RHS rehashes) ---FILE-- -<?php -$name = 'a'; -for ($i = 0; $i < 100000; $i++) { - if ($name != 'i') { - $$name =& $GLOBALS; - } - $name++; -} -?> -OK ---EXPECT-- -OK diff --git a/Zend/tests/bug71695.phpt b/Zend/tests/bug71695.phpt deleted file mode 100644 index 31ae73a99d..0000000000 --- a/Zend/tests/bug71695.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Bug #71695 (Global variables are reserved before execution) ---FILE-- -<?php -function provideGlobals() { - var_dump(array_key_exists("foo", $GLOBALS)); - var_dump(isset($GLOBALS["foo"])); - $GLOBALS += array("foo" => "foo"); -} - -provideGlobals(); -echo $foo; -?> ---EXPECT-- -bool(false) -bool(false) -foo diff --git a/Zend/tests/bug75474.phpt b/Zend/tests/bug75474.phpt new file mode 100644 index 0000000000..f71e3c6b2e --- /dev/null +++ b/Zend/tests/bug75474.phpt @@ -0,0 +1,75 @@ +--TEST-- +Bug #75474: function scope static variables are not bound to a unique function +--FILE-- +<?php + +function bar($k, $v) { + static $foo = []; + $foo[$k] = $v; + return $foo; +} + +var_dump(bar(0, 0)); +var_dump(Closure::fromCallable("bar")(1, 1)); +var_dump(bar(2, 2)); +var_dump(Closure::fromCallable("bar")(3, 3)); +$RF = new ReflectionFunction("bar"); +var_dump($RF->getClosure()(4, 4)); +var_dump(bar(5, 5)); + +?> +--EXPECT-- +array(1) { + [0]=> + int(0) +} +array(2) { + [0]=> + int(0) + [1]=> + int(1) +} +array(3) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) +} +array(4) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) +} +array(5) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) +} +array(6) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) +} diff --git a/Zend/tests/bug78239.phpt b/Zend/tests/bug78239.phpt index 1ecad67460..50dd46c971 100644 --- a/Zend/tests/bug78239.phpt +++ b/Zend/tests/bug78239.phpt @@ -1,7 +1,7 @@ --TEST-- Bug #78239: Deprecation notice during string conversion converted to exception hangs --SKIPIF-- -<?php if (!extension_loaded("zend-test")) die("skip requires zend-test extension"); ?> +<?php if (!extension_loaded("zend_test")) die("skip requires zend_test extension"); ?> --FILE-- <?php function handleError($level, $message, $file = '', $line = 0, $context = []) diff --git a/Zend/tests/bug78335_2.phpt b/Zend/tests/bug78335_2.phpt index 5fb5fcb788..5f2c9ed9df 100644 --- a/Zend/tests/bug78335_2.phpt +++ b/Zend/tests/bug78335_2.phpt @@ -1,7 +1,7 @@ --TEST-- Bug #78335: Static properties containing cycles report as leak (internal class variant) --SKIPIF-- -<?php if (!extension_loaded("zend-test")) die("skip requires zend-test"); ?> +<?php if (!extension_loaded("zend_test")) die("skip requires zend_test"); ?> --FILE-- <?php diff --git a/Zend/tests/bug79862.phpt b/Zend/tests/bug79862.phpt index b923da78b4..a04dc5c9ac 100644 --- a/Zend/tests/bug79862.phpt +++ b/Zend/tests/bug79862.phpt @@ -45,14 +45,14 @@ NULL NULL NULL object(c)#1 (6) { - ["prop1"]=> - int(1) - ["prop2":protected]=> - int(2) ["prop3":"a":private]=> int(3) ["prop4":"a":private]=> int(4) + ["prop1"]=> + int(1) + ["prop2":protected]=> + int(2) ["prop5"]=> int(5) ["prop6"]=> diff --git a/Zend/tests/call_to_deprecated_function_args.phpt b/Zend/tests/call_to_deprecated_function_args.phpt index c7781e30e0..7bb9039b46 100644 --- a/Zend/tests/call_to_deprecated_function_args.phpt +++ b/Zend/tests/call_to_deprecated_function_args.phpt @@ -2,7 +2,7 @@ Check that arguments are freed when calling a deprecated function --SKIPIF-- <?php -if (!extension_loaded('zend-test')) die('skip zend-test extension not loaded'); +if (!extension_loaded('zend_test')) die('skip zend_test extension not loaded'); --FILE-- <?php diff --git a/Zend/tests/class_exists_002.phpt b/Zend/tests/class_exists_002.phpt index 5e5df1d371..e020c1d623 100644 --- a/Zend/tests/class_exists_002.phpt +++ b/Zend/tests/class_exists_002.phpt @@ -8,7 +8,6 @@ class foo { } var_dump(class_exists('')); -var_dump(class_exists(NULL)); var_dump(class_exists('FOO')); var_dump(class_exists('bar')); var_dump(class_exists(1)); @@ -16,7 +15,6 @@ var_dump(class_exists(1)); ?> --EXPECT-- bool(false) -bool(false) bool(true) bool(false) bool(false) diff --git a/Zend/tests/closure_bindTo_preserves_used_variables.phpt b/Zend/tests/closure_bindTo_preserves_used_variables.phpt new file mode 100644 index 0000000000..cec68ea70a --- /dev/null +++ b/Zend/tests/closure_bindTo_preserves_used_variables.phpt @@ -0,0 +1,17 @@ +--TEST-- +Closure::bindTo() should preserve used variables +--FILE-- +<?php + +$var = 0; +$fn = function() use($var) { + var_dump($var); +}; +$fn(); +$fn = $fn->bindTo(null, null); +$fn(); + +?> +--EXPECT-- +int(0) +int(0) diff --git a/Zend/tests/closures/closure_from_callable_gc.phpt b/Zend/tests/closures/closure_from_callable_gc.phpt new file mode 100644 index 0000000000..e326fc3b09 --- /dev/null +++ b/Zend/tests/closures/closure_from_callable_gc.phpt @@ -0,0 +1,27 @@ +--TEST-- +Closure::fromCallable() and GC +--FILE-- +<?php + +class Test { + public function method() {} + + public function method2($y) { + static $x; + $x = $y; + } +} + +$fn = Closure::fromCallable([new Test, 'method2']); +$fn($fn); +unset($fn); // Still referenced from static var. +gc_collect_cycles(); + +$fn = Closure::fromCallable([new Test, 'method']); +$fn2 = $fn; unset($fn2); // Add to root buffer. +gc_collect_cycles(); + +?> +===DONE=== +--EXPECT-- +===DONE=== diff --git a/Zend/tests/const_deprecation.phpt b/Zend/tests/const_deprecation.phpt index b7cf99d52e..08de4229b9 100644 --- a/Zend/tests/const_deprecation.phpt +++ b/Zend/tests/const_deprecation.phpt @@ -2,7 +2,7 @@ Internal constant deprecation --SKIPIF-- <?php -if (!extension_loaded('zend-test')) die('skip requires zend-test'); +if (!extension_loaded('zend_test')) die('skip requires zend_test'); ?> --FILE-- <?php diff --git a/Zend/tests/exception_001.phpt b/Zend/tests/exception_001.phpt index 232ef012ed..aba29d4aa3 100644 --- a/Zend/tests/exception_001.phpt +++ b/Zend/tests/exception_001.phpt @@ -7,7 +7,7 @@ try { try { try { try { - throw new Exception(NULL); + throw new Exception(); } catch (Exception $e) { var_dump($e->getMessage()); throw $e; diff --git a/Zend/tests/gc_010.phpt b/Zend/tests/gc_010.phpt deleted file mode 100644 index 756c8ebc2a..0000000000 --- a/Zend/tests/gc_010.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -GC 010: Cycle with reference to $GLOBALS ---INI-- -zend.enable_gc=1 ---FILE-- -<?php -$a = array(); -$a[] =& $a; -var_dump($a); -$a[] =& $GLOBALS; -unset($a); -var_dump(gc_collect_cycles()); -echo "ok\n" -?> ---EXPECT-- -array(1) { - [0]=> - *RECURSION* -} -int(1) -ok diff --git a/Zend/tests/get_mangled_object_vars.phpt b/Zend/tests/get_mangled_object_vars.phpt index 735548579e..f9ad008a33 100644 --- a/Zend/tests/get_mangled_object_vars.phpt +++ b/Zend/tests/get_mangled_object_vars.phpt @@ -33,10 +33,10 @@ echo "\n"; ?> --EXPECT-- array ( - '' . "\0" . 'B' . "\0" . 'priv' => 4, 'pub' => 1, '' . "\0" . '*' . "\0" . 'prot' => 2, '' . "\0" . 'A' . "\0" . 'priv' => 3, + '' . "\0" . 'B' . "\0" . 'priv' => 4, 'dyn' => 5, 6 => 6, ) diff --git a/Zend/tests/globals_001.phpt b/Zend/tests/globals_001.phpt index 069e88730c..7c54046212 100644 --- a/Zend/tests/globals_001.phpt +++ b/Zend/tests/globals_001.phpt @@ -29,6 +29,6 @@ string(%d) "%s" Warning: Undefined array key "PHP_SELF" in %s on line %d NULL -Warning: Undefined variable $_SERVER in %s on line %d +Warning: Undefined global variable $_SERVER in %s on line %d NULL Done diff --git a/Zend/tests/globals_002.phpt b/Zend/tests/globals_002.phpt index d8f9ad4aa2..faa9b94ade 100644 --- a/Zend/tests/globals_002.phpt +++ b/Zend/tests/globals_002.phpt @@ -32,6 +32,6 @@ string(%d) "%s" Warning: Undefined array key "PHP_SELF" in %s on line %d NULL -Warning: Undefined variable $_SERVER in %s on line %d +Warning: Undefined global variable $_SERVER in %s on line %d NULL Done diff --git a/Zend/tests/globals_003.phpt b/Zend/tests/globals_003.phpt index 6ac9d9f779..36e74bde64 100644 --- a/Zend/tests/globals_003.phpt +++ b/Zend/tests/globals_003.phpt @@ -38,6 +38,6 @@ string(%d) "%s" Warning: Undefined array key "PHP_SELF" in %s on line %d NULL -Warning: Undefined variable $_SERVER in %s on line %d +Warning: Undefined global variable $_SERVER in %s on line %d NULL Done diff --git a/Zend/tests/globals_004.phpt b/Zend/tests/globals_004.phpt index 27520a220c..4c81e5e57a 100644 --- a/Zend/tests/globals_004.phpt +++ b/Zend/tests/globals_004.phpt @@ -23,6 +23,6 @@ string(%d) "%s" Warning: Undefined array key "PHP_SELF" in %s on line %d NULL -Warning: Undefined variable $_SERVER in %s on line %d +Warning: Undefined global variable $_SERVER in %s on line %d NULL Done diff --git a/Zend/tests/inherit_internal_static.phpt b/Zend/tests/inherit_internal_static.phpt index 4716717f15..6e29301b74 100644 --- a/Zend/tests/inherit_internal_static.phpt +++ b/Zend/tests/inherit_internal_static.phpt @@ -1,7 +1,7 @@ --TEST-- Inherit internal static property into userland class --SKIPIF-- -<?php if (!extension_loaded('zend-test')) die('skip requires zend-test'); ?> +<?php if (!extension_loaded('zend_test')) die('skip requires zend_test'); ?> --FILE-- <?php diff --git a/Zend/tests/interface_exists_001.phpt b/Zend/tests/interface_exists_001.phpt index 84e9c6df1e..4bc01221a8 100644 --- a/Zend/tests/interface_exists_001.phpt +++ b/Zend/tests/interface_exists_001.phpt @@ -8,10 +8,8 @@ interface foo { var_dump(interface_exists('foo')); var_dump(interface_exists(1)); -var_dump(interface_exists(NULL)); ?> --EXPECT-- bool(true) bool(false) -bool(false) diff --git a/Zend/tests/invalid_const_class_name.phpt b/Zend/tests/invalid_const_class_name.phpt new file mode 100644 index 0000000000..bedd74e1df --- /dev/null +++ b/Zend/tests/invalid_const_class_name.phpt @@ -0,0 +1,8 @@ +--TEST-- +Invalid constant class name in nested class constant access +--FILE-- +<?php +[]::X::X; +?> +--EXPECTF-- +Fatal error: Illegal class name in %s on line %d diff --git a/Zend/tests/iterable_or_null.phpt b/Zend/tests/iterable_or_null.phpt index 9f798af06d..19cb854437 100644 --- a/Zend/tests/iterable_or_null.phpt +++ b/Zend/tests/iterable_or_null.phpt @@ -2,7 +2,7 @@ Test Z_PARAM_ITERABLE() and Z_PARAM_ITERABLE_OR_NULL --SKIPIF-- <?php -if (!extension_loaded('zend-test')) die('skip zend-test extension not loaded'); +if (!extension_loaded('zend_test')) die('skip zend_test extension not loaded'); ?> --FILE-- <?php diff --git a/Zend/tests/list_keyed_leading_comma.phpt b/Zend/tests/list_keyed_leading_comma.phpt new file mode 100644 index 0000000000..dcadcbf393 --- /dev/null +++ b/Zend/tests/list_keyed_leading_comma.phpt @@ -0,0 +1,10 @@ +--TEST-- +Leading comma in keyed list assignment +--FILE-- +<?php + +[, "a" => $b] = [1, "a" => 2]; + +?> +--EXPECTF-- +Fatal error: Cannot use empty array entries in keyed array assignment in %s on line %d diff --git a/Zend/tests/lsb_023.phpt b/Zend/tests/lsb_023.phpt new file mode 100644 index 0000000000..a8051aa85f --- /dev/null +++ b/Zend/tests/lsb_023.phpt @@ -0,0 +1,26 @@ +--TEST-- +Late Static Binding static:: calls protected / public method of child class even then +the method is private in parent class +--FILE-- +<?php +class A { + public static function out() { + echo static::value(), PHP_EOL; + } + + private static function value() { return 'A'; } +} +class B extends A { + protected static function value() { return 'B'; } +} +class C extends A { + public static function value() { return 'C'; } +} +A::out(); +B::out(); +C::out(); +echo PHP_EOL; +--EXPECT-- +A +B +C diff --git a/Zend/tests/lsb_024.phpt b/Zend/tests/lsb_024.phpt new file mode 100644 index 0000000000..2c71c678d3 --- /dev/null +++ b/Zend/tests/lsb_024.phpt @@ -0,0 +1,25 @@ +--TEST-- +Late Static Binding static:: accesses protected / public static variables of child +class when the variable is private in parent class +--FILE-- +<?php +class A { + private static $value = 'A'; + + public static function out() { + echo static::$value, PHP_EOL; + } +} +class B extends A { + protected static $value = 'B'; +} +class C extends A { + public static $value = 'C'; +} +A::out(); +B::out(); +C::out(); +--EXPECT-- +A +B +C diff --git a/Zend/tests/method_static_var.phpt b/Zend/tests/method_static_var.phpt index 06574732d7..f92e6d3a5d 100644 --- a/Zend/tests/method_static_var.phpt +++ b/Zend/tests/method_static_var.phpt @@ -3,8 +3,6 @@ Initial value of static var in method depends on the include time of the class d --FILE-- <?php -/* The current behavior is probably a bug, but we should still test how it currently works. */ - class Foo { public static function test() { static $i = 0; @@ -22,5 +20,5 @@ Bar::test(); --EXPECT-- int(1) int(2) +int(1) int(2) -int(3) diff --git a/Zend/tests/multibyte/multibyte_encoding_001.phpt b/Zend/tests/multibyte/multibyte_encoding_001.phpt index 3b26dcb989..f95b4311a9 100644 --- a/Zend/tests/multibyte/multibyte_encoding_001.phpt +++ b/Zend/tests/multibyte/multibyte_encoding_001.phpt @@ -13,7 +13,7 @@ internal_encoding=SJIS <?php declare(encoding='Shift_JIS'); $s = "•\"; // 0x95+0x5c in script, not somewhere else " -printf("%x:%x\n", ord($s[0]), ord($s[1])); +printf("%x:%x", ord($s[0]), ord($s[1])); ?> --EXPECT-- 95:5c diff --git a/Zend/tests/multibyte/multibyte_encoding_003.phpt b/Zend/tests/multibyte/multibyte_encoding_003.phpt Binary files differindex a0983329f4..f0fb60f6cd 100644 --- a/Zend/tests/multibyte/multibyte_encoding_003.phpt +++ b/Zend/tests/multibyte/multibyte_encoding_003.phpt diff --git a/Zend/tests/named_params/undef_var.phpt b/Zend/tests/named_params/undef_var.phpt index b1d5682434..5ef41e26dd 100644 --- a/Zend/tests/named_params/undef_var.phpt +++ b/Zend/tests/named_params/undef_var.phpt @@ -1,5 +1,5 @@ --TEST-- -Passing undefined variabled to named arg +Passing undefined variable to named arg --FILE-- <?php diff --git a/Zend/tests/null_to_non_nullable_special_func.phpt b/Zend/tests/null_to_non_nullable_special_func.phpt new file mode 100644 index 0000000000..9dc1c96f72 --- /dev/null +++ b/Zend/tests/null_to_non_nullable_special_func.phpt @@ -0,0 +1,12 @@ +--TEST-- +Test null arg behavior for special functions +--FILE-- +<?php + +$null = null; +var_dump(strlen($null)); + +?> +--EXPECTF-- +Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in %s on line %d +int(0) diff --git a/Zend/tests/nullsafe_operator/013.phpt b/Zend/tests/nullsafe_operator/013.phpt index fd1fbc9006..595f292f6f 100644 --- a/Zend/tests/nullsafe_operator/013.phpt +++ b/Zend/tests/nullsafe_operator/013.phpt @@ -38,14 +38,21 @@ dump_error(fn() => array_key_exists('foo', $foo?->foo())); ?> --EXPECTF-- +Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in %s on line %d int(0) bool(true) bool(false) bool(false) bool(false) bool(false) + +Deprecated: defined(): Passing null to parameter #1 ($constant_name) of type string is deprecated in %s on line %d bool(false) + +Deprecated: chr(): Passing null to parameter #1 ($codepoint) of type int is deprecated in %s on line %d string(1) "%s" + +Deprecated: ord(): Passing null to parameter #1 ($character) of type string is deprecated in %s on line %d int(0) string(98) "call_user_func_array(): Argument #1 ($function) must be a valid callback, no array or string given" string(77) "call_user_func_array(): Argument #2 ($args) must be of type array, null given" @@ -55,6 +62,8 @@ string(4) "NULL" string(52) "func_num_args() expects exactly 0 arguments, 1 given" string(52) "func_get_args() expects exactly 0 arguments, 1 given" string(69) "array_slice(): Argument #1 ($array) must be of type array, null given" + +Deprecated: array_slice(): Passing null to parameter #2 ($offset) of type int is deprecated in %s on line %d array(1) { [0]=> string(3) "foo" diff --git a/Zend/tests/objects_033.phpt b/Zend/tests/objects_033.phpt index 3c19864490..edb722b040 100644 --- a/Zend/tests/objects_033.phpt +++ b/Zend/tests/objects_033.phpt @@ -24,5 +24,5 @@ print_r($a, true); var_dump($a < $b); ?> --EXPECT-- -bool(false) -bool(false) +bool(true) +bool(true) diff --git a/Zend/tests/oct_whitespace.phpt b/Zend/tests/oct_whitespace.phpt new file mode 100644 index 0000000000..cb0bf4ad7a --- /dev/null +++ b/Zend/tests/oct_whitespace.phpt @@ -0,0 +1,8 @@ +--TEST-- +Octal literal followed by whitespace and another number +--FILE-- +<?php +var_dump(0o0 2); +?> +--EXPECTF-- +Parse error: syntax error, unexpected integer "2", expecting ")" in %s on line %d diff --git a/Zend/tests/overloaded_func_001.phpt b/Zend/tests/overloaded_func_001.phpt index 7fc435f920..d78ef1971c 100644 --- a/Zend/tests/overloaded_func_001.phpt +++ b/Zend/tests/overloaded_func_001.phpt @@ -2,7 +2,7 @@ Overloaded function 001 --SKIPIF-- <?php -if (!extension_loaded('zend-test')) die('skip zend-test extension not loaded'); +if (!extension_loaded('zend_test')) die('skip zend_test extension not loaded'); ?> --FILE-- <?php diff --git a/Zend/tests/overloaded_func_002.phpt b/Zend/tests/overloaded_func_002.phpt index a02f1e8e37..0a3107182a 100644 --- a/Zend/tests/overloaded_func_002.phpt +++ b/Zend/tests/overloaded_func_002.phpt @@ -2,7 +2,7 @@ Overloaded function 002 --SKIPIF-- <?php -if (!extension_loaded('zend-test')) die('skip zend-test extension not loaded'); +if (!extension_loaded('zend_test')) die('skip zend_test extension not loaded'); ?> --FILE-- <?php diff --git a/Zend/tests/resource_key.phpt b/Zend/tests/resource_key.phpt new file mode 100644 index 0000000000..fddd41bcad --- /dev/null +++ b/Zend/tests/resource_key.phpt @@ -0,0 +1,36 @@ +--TEST-- +Behavior of resources as array keys +--FILE-- +<?php + +$r = fopen(__FILE__, 'r'); +$a = []; +echo "Assign:"; +$a[$r] = 1; +echo "Add assign:"; +$a[$r] += 1; +echo "Inc:"; +$a[$r]++; +echo "Get:"; +var_dump($a[$r]); +echo "Isset:"; +var_dump(isset($a[$r])); +echo "Unset:"; +unset($a[$r]); + +?> +--EXPECTF-- +Assign: +Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d +Add assign: +Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d +Inc: +Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d +Get: +Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d +int(3) +Isset: +Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d +bool(true) +Unset: +Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d diff --git a/Zend/tests/restrict_globals/globals_in_globals.phpt b/Zend/tests/restrict_globals/globals_in_globals.phpt new file mode 100644 index 0000000000..fbb811708c --- /dev/null +++ b/Zend/tests/restrict_globals/globals_in_globals.phpt @@ -0,0 +1,11 @@ +--TEST-- +$GLOBALS no longer contains 'GLOBALS' +--FILE-- +<?php + +$g = $GLOBALS; +var_dump(isset($g['GLOBALS'])); + +?> +--EXPECT-- +bool(false) diff --git a/Zend/tests/restrict_globals/invalid_append.phpt b/Zend/tests/restrict_globals/invalid_append.phpt new file mode 100644 index 0000000000..8e8b99fb9b --- /dev/null +++ b/Zend/tests/restrict_globals/invalid_append.phpt @@ -0,0 +1,10 @@ +--TEST-- +Cannot append to $GLOBALS +--FILE-- +<?php + +$GLOBALS[] = 1; + +?> +--EXPECTF-- +Fatal error: Cannot append to $GLOBALS in %s on line %d diff --git a/Zend/tests/restrict_globals/invalid_append_isset.phpt b/Zend/tests/restrict_globals/invalid_append_isset.phpt new file mode 100644 index 0000000000..6cb57351e7 --- /dev/null +++ b/Zend/tests/restrict_globals/invalid_append_isset.phpt @@ -0,0 +1,8 @@ +--TEST-- +Cannot append to $GLOBALS in isset() +--FILE-- +<?php +isset($GLOBALS[]); +?> +--EXPECTF-- +Fatal error: Cannot use [] for reading in %s on line %d diff --git a/Zend/tests/restrict_globals/invalid_append_unset.phpt b/Zend/tests/restrict_globals/invalid_append_unset.phpt new file mode 100644 index 0000000000..b7c06179c7 --- /dev/null +++ b/Zend/tests/restrict_globals/invalid_append_unset.phpt @@ -0,0 +1,8 @@ +--TEST-- +Cannot append to $GLOBALS in unset() +--FILE-- +<?php +unset($GLOBALS[]); +?> +--EXPECTF-- +Fatal error: Cannot use [] for unsetting in %s on line %d diff --git a/Zend/tests/restrict_globals/invalid_assign.phpt b/Zend/tests/restrict_globals/invalid_assign.phpt new file mode 100644 index 0000000000..c42cc9e1f9 --- /dev/null +++ b/Zend/tests/restrict_globals/invalid_assign.phpt @@ -0,0 +1,10 @@ +--TEST-- +Cannot assign to $GLOBALS +--FILE-- +<?php + +$GLOBALS = []; + +?> +--EXPECTF-- +Fatal error: $GLOBALS can only be modified using the $GLOBALS[$name] = $value syntax in %s on line %d diff --git a/Zend/tests/restrict_globals/invalid_assign_list.phpt b/Zend/tests/restrict_globals/invalid_assign_list.phpt new file mode 100644 index 0000000000..8fc3e524a9 --- /dev/null +++ b/Zend/tests/restrict_globals/invalid_assign_list.phpt @@ -0,0 +1,10 @@ +--TEST-- +Cannot list-assign to $GLOBALS +--FILE-- +<?php + +list($GLOBALS) = [1]; + +?> +--EXPECTF-- +Fatal error: $GLOBALS can only be modified using the $GLOBALS[$name] = $value syntax in %s on line %d diff --git a/Zend/tests/restrict_globals/invalid_assign_list_ref.phpt b/Zend/tests/restrict_globals/invalid_assign_list_ref.phpt new file mode 100644 index 0000000000..594a308ea1 --- /dev/null +++ b/Zend/tests/restrict_globals/invalid_assign_list_ref.phpt @@ -0,0 +1,10 @@ +--TEST-- +Cannot list-assign to $GLOBALS (by-ref) +--FILE-- +<?php + +list(&$GLOBALS) = [1]; + +?> +--EXPECTF-- +Fatal error: Cannot assign reference to non referencable value in %s on line %d diff --git a/Zend/tests/restrict_globals/invalid_assign_op.phpt b/Zend/tests/restrict_globals/invalid_assign_op.phpt new file mode 100644 index 0000000000..a9b36853ea --- /dev/null +++ b/Zend/tests/restrict_globals/invalid_assign_op.phpt @@ -0,0 +1,10 @@ +--TEST-- +Cannot compound assign to $GLOBALS +--FILE-- +<?php + +$GLOBALS += []; + +?> +--EXPECTF-- +Fatal error: $GLOBALS can only be modified using the $GLOBALS[$name] = $value syntax in %s on line %d diff --git a/Zend/tests/restrict_globals/invalid_assign_ref_lhs.phpt b/Zend/tests/restrict_globals/invalid_assign_ref_lhs.phpt new file mode 100644 index 0000000000..b14c167646 --- /dev/null +++ b/Zend/tests/restrict_globals/invalid_assign_ref_lhs.phpt @@ -0,0 +1,11 @@ +--TEST-- +Cannot by-ref assign to $GLOBALS (LHS) +--FILE-- +<?php + +$var = []; +$GLOBALS =& $var; + +?> +--EXPECTF-- +Fatal error: $GLOBALS can only be modified using the $GLOBALS[$name] = $value syntax in %s on line %d diff --git a/Zend/tests/restrict_globals/invalid_assign_ref_rhs.phpt b/Zend/tests/restrict_globals/invalid_assign_ref_rhs.phpt new file mode 100644 index 0000000000..3cdab0f9c9 --- /dev/null +++ b/Zend/tests/restrict_globals/invalid_assign_ref_rhs.phpt @@ -0,0 +1,11 @@ +--TEST-- +Cannot by-ref assign to $GLOBALS (RHS) +--FILE-- +<?php + +$var = []; +$var =& $GLOBALS; + +?> +--EXPECTF-- +Fatal error: Cannot acquire reference to $GLOBALS in %s on line %d diff --git a/Zend/tests/restrict_globals/invalid_foreach.phpt b/Zend/tests/restrict_globals/invalid_foreach.phpt new file mode 100644 index 0000000000..0e7c74881a --- /dev/null +++ b/Zend/tests/restrict_globals/invalid_foreach.phpt @@ -0,0 +1,10 @@ +--TEST-- +Cannot use $GLOBALS as foreach result variable +--FILE-- +<?php + +foreach ([1] as $GLOBALS) {} + +?> +--EXPECTF-- +Fatal error: $GLOBALS can only be modified using the $GLOBALS[$name] = $value syntax in %s on line %d diff --git a/Zend/tests/restrict_globals/invalid_foreach_ref.phpt b/Zend/tests/restrict_globals/invalid_foreach_ref.phpt new file mode 100644 index 0000000000..2c355c09ae --- /dev/null +++ b/Zend/tests/restrict_globals/invalid_foreach_ref.phpt @@ -0,0 +1,10 @@ +--TEST-- +Cannot use $GLOBALS as foreach result variable (by-ref) +--FILE-- +<?php + +foreach ([1] as &$GLOBALS) {} + +?> +--EXPECTF-- +Fatal error: $GLOBALS can only be modified using the $GLOBALS[$name] = $value syntax in %s on line %d diff --git a/Zend/tests/restrict_globals/invalid_pass_by_ref.phpt b/Zend/tests/restrict_globals/invalid_pass_by_ref.phpt new file mode 100644 index 0000000000..a0145a0624 --- /dev/null +++ b/Zend/tests/restrict_globals/invalid_pass_by_ref.phpt @@ -0,0 +1,23 @@ +--TEST-- +$GLOBALS cannot be passed by reference (runtime error) +--FILE-- +<?php + +function by_ref(&$ref) {} +try { + by_ref($GLOBALS); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} + +try { + by_ref2($GLOBALS); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} +function by_ref2(&$ref) {} + +?> +--EXPECT-- +by_ref(): Argument #1 ($ref) cannot be passed by reference +by_ref2(): Argument #1 ($ref) cannot be passed by reference diff --git a/Zend/tests/restrict_globals/invalid_unset.phpt b/Zend/tests/restrict_globals/invalid_unset.phpt new file mode 100644 index 0000000000..781388b9b2 --- /dev/null +++ b/Zend/tests/restrict_globals/invalid_unset.phpt @@ -0,0 +1,10 @@ +--TEST-- +Cannot unset $GLOBALS +--FILE-- +<?php + +unset($GLOBALS); + +?> +--EXPECTF-- +Fatal error: $GLOBALS can only be modified using the $GLOBALS[$name] = $value syntax in %s on line %d diff --git a/Zend/tests/restrict_globals/key_canonicalization.phpt b/Zend/tests/restrict_globals/key_canonicalization.phpt new file mode 100644 index 0000000000..66d9a29a92 --- /dev/null +++ b/Zend/tests/restrict_globals/key_canonicalization.phpt @@ -0,0 +1,11 @@ +--TEST-- +$GLOBALS should have canonicalized keys +--FILE-- +<?php + +${1} = 42; +var_dump($GLOBALS[1]); + +?> +--EXPECT-- +int(42) diff --git a/Zend/tests/restrict_globals/valid.phpt b/Zend/tests/restrict_globals/valid.phpt new file mode 100644 index 0000000000..b99bbe402f --- /dev/null +++ b/Zend/tests/restrict_globals/valid.phpt @@ -0,0 +1,52 @@ +--TEST-- +Supported operations on $GLOBALS +--FILE-- +<?php + +function test() { + var_dump($GLOBALS['x']); + $GLOBALS['x'] = 1; + var_dump($GLOBALS['x']); + $GLOBALS['x']++; + var_dump($GLOBALS['x']); + $GLOBALS['x'] += 2; + var_dump($GLOBALS['x']); + unset($GLOBALS['y']); + var_dump(isset($GLOBALS['x'])); + var_dump(isset($GLOBALS['y'])); + $GLOBALS['z'][] = 1; +} + +$y = 1; +test(); +var_dump($x, $y, $z); + +$ref = 1; +$GLOBALS['z'] =& $ref; +$ref++; +var_dump($z); + +$x = 1; +$ref2 =& $GLOBALS['x']; +$ref2++; +var_dump($x); + +?> +--EXPECTF-- +Warning: Undefined global variable $x in %s on line %d +NULL +int(1) +int(2) +int(4) +bool(true) +bool(false) + +Warning: Undefined variable $y in %s on line %d +int(4) +NULL +array(1) { + [0]=> + int(1) +} +int(2) +int(2) diff --git a/Zend/tests/return_types/internal_functions001.phpt b/Zend/tests/return_types/internal_functions001.phpt index 153e32ca6e..183f394c9b 100644 --- a/Zend/tests/return_types/internal_functions001.phpt +++ b/Zend/tests/return_types/internal_functions001.phpt @@ -2,7 +2,7 @@ Return type for internal functions --SKIPIF-- <?php -if (!extension_loaded('zend-test')) die('skip zend-test extension not loaded'); +if (!extension_loaded('zend_test')) die('skip zend_test extension not loaded'); // Internal function return types are only checked in debug builds if (!PHP_DEBUG) die('skip requires debug build'); ?> diff --git a/Zend/tests/return_types/internal_functions002.phpt b/Zend/tests/return_types/internal_functions002.phpt index 531b6c452d..f6287b72f0 100644 --- a/Zend/tests/return_types/internal_functions002.phpt +++ b/Zend/tests/return_types/internal_functions002.phpt @@ -2,7 +2,7 @@ Return type for internal functions 2 --SKIPIF-- <?php -if (!extension_loaded('zend-test')) die('skip zend-test extension not loaded'); +if (!extension_loaded('zend_test')) die('skip zend_test extension not loaded'); --FILE-- <?php zend_test_nullable_array_return(); diff --git a/Zend/tests/return_types/internal_functions003.phpt b/Zend/tests/return_types/internal_functions003.phpt index a7e71204fa..754b14574d 100644 --- a/Zend/tests/return_types/internal_functions003.phpt +++ b/Zend/tests/return_types/internal_functions003.phpt @@ -2,7 +2,7 @@ Return type for internal functions 3: Void return type --SKIPIF-- <?php -if (!extension_loaded('zend-test')) die('skip zend-test extension not loaded'); +if (!extension_loaded('zend_test')) die('skip zend_test extension not loaded'); --FILE-- <?php var_dump(zend_test_void_return()); diff --git a/Zend/tests/static_variable_in_dynamic_function.phpt b/Zend/tests/static_variable_in_dynamic_function.phpt new file mode 100644 index 0000000000..77b71a4883 --- /dev/null +++ b/Zend/tests/static_variable_in_dynamic_function.phpt @@ -0,0 +1,21 @@ +--TEST-- +Static variables in dynamically declared function (first use before dynamic def dtor) +--FILE-- +<?php + +$code = <<<'CODE' +if (1) { + function test() { + static $x = 0; + var_dump(++$x); + } + test(); +} +CODE; +eval($code); +test(); + +?> +--EXPECT-- +int(1) +int(2) diff --git a/Zend/tests/static_variable_in_dynamic_function_2.phpt b/Zend/tests/static_variable_in_dynamic_function_2.phpt new file mode 100644 index 0000000000..f7c160325f --- /dev/null +++ b/Zend/tests/static_variable_in_dynamic_function_2.phpt @@ -0,0 +1,21 @@ +--TEST-- +Static variables in dynamically declared function (first use after dynamic def dtor) +--FILE-- +<?php + +$code = <<<'CODE' +if (1) { + function test() { + static $x = 0; + var_dump(++$x); + } +} +CODE; +eval($code); +test(); +test(); + +?> +--EXPECT-- +int(1) +int(2) diff --git a/Zend/tests/str_or_obj_of_class_zpp.phpt b/Zend/tests/str_or_obj_of_class_zpp.phpt index b8f5d8492f..04a321a692 100644 --- a/Zend/tests/str_or_obj_of_class_zpp.phpt +++ b/Zend/tests/str_or_obj_of_class_zpp.phpt @@ -2,7 +2,7 @@ Test Z_PARAM_OBJ_OF_CLASS_OR_STR() and Z_PARAM_OBJ_OF_CLASS_OR_STR_OR_NULL --SKIPIF-- <?php -if (!extension_loaded('zend-test')) die('skip zend-test extension not loaded'); +if (!extension_loaded('zend_test')) die('skip zend_test extension not loaded'); ?> --FILE-- <?php @@ -51,9 +51,11 @@ try { } ?> ---EXPECT-- +--EXPECTF-- string(6) "string" string(1) "1" + +Deprecated: zend_string_or_stdclass(): Passing null to parameter #1 ($param) of type string is deprecated in %s on line %d string(0) "" object(stdClass)#1 (0) { } diff --git a/Zend/tests/str_or_obj_zpp.phpt b/Zend/tests/str_or_obj_zpp.phpt index 301abd8ddc..00eec7a688 100644 --- a/Zend/tests/str_or_obj_zpp.phpt +++ b/Zend/tests/str_or_obj_zpp.phpt @@ -2,7 +2,7 @@ Test Z_PARAM_OBJ_OR_STR() and Z_PARAM_OBJ_OR_STR_OR_NULL --SKIPIF-- <?php -if (!extension_loaded('zend-test')) die('skip zend-test extension not loaded'); +if (!extension_loaded('zend_test')) die('skip zend_test extension not loaded'); ?> --FILE-- <?php @@ -34,9 +34,11 @@ try { } ?> ---EXPECT-- +--EXPECTF-- string(6) "string" string(1) "1" + +Deprecated: zend_string_or_object(): Passing null to parameter #1 ($param) of type object|string is deprecated in %s on line %d string(0) "" object(stdClass)#1 (0) { } diff --git a/Zend/tests/trait_exists_001.phpt b/Zend/tests/trait_exists_001.phpt index 8a7c55d586..8699b07cef 100644 --- a/Zend/tests/trait_exists_001.phpt +++ b/Zend/tests/trait_exists_001.phpt @@ -8,10 +8,8 @@ trait foo { var_dump(trait_exists('foo')); var_dump(trait_exists(1)); -var_dump(trait_exists(NULL)); ?> --EXPECT-- bool(true) bool(false) -bool(false) diff --git a/Zend/tests/traits/bug69579.phpt b/Zend/tests/traits/bug69579.phpt index 94387ce3cd..c12f54a374 100644 --- a/Zend/tests/traits/bug69579.phpt +++ b/Zend/tests/traits/bug69579.phpt @@ -2,7 +2,7 @@ Bug #69579 (Internal trait double-free) --SKIPIF-- <?php -if (!extension_loaded('zend-test')) die('skip zend-test extension not loaded'); +if (!extension_loaded('zend_test')) die('skip zend_test extension not loaded'); ?> --FILE-- <?php diff --git a/Zend/tests/traits/get_declared_traits_004.phpt b/Zend/tests/traits/get_declared_traits_004.phpt new file mode 100644 index 0000000000..88149686f7 --- /dev/null +++ b/Zend/tests/traits/get_declared_traits_004.phpt @@ -0,0 +1,16 @@ +--TEST-- +Testing get_declared_traits() and class_alias() +--FILE-- +<?php + +trait T { } +class_alias("T", "A"); +foreach (get_declared_traits() as $name) { + if (strlen($name) == 1) { + echo $name; + } +} +echo "\n"; +?> +--EXPECT-- +Ta diff --git a/Zend/tests/traits/property008.phpt b/Zend/tests/traits/property008.phpt index ff265be2a0..d4d57f379a 100644 --- a/Zend/tests/traits/property008.phpt +++ b/Zend/tests/traits/property008.phpt @@ -42,20 +42,20 @@ var_dump($b); ?> --EXPECT-- object(SubclassClassicInheritance)#1 (2) { - ["hello":"SubclassClassicInheritance":private]=> - int(0) ["hello":"BaseWithPropA":private]=> int(0) + ["hello":"SubclassClassicInheritance":private]=> + int(0) } object(SubclassA)#2 (2) { - ["hello":"SubclassA":private]=> - int(0) ["hello":"BaseWithPropA":private]=> int(0) + ["hello":"SubclassA":private]=> + int(0) } object(SubclassB)#3 (2) { - ["hello":"SubclassB":private]=> - int(0) ["hello":"BaseWithTPropB":private]=> int(0) + ["hello":"SubclassB":private]=> + int(0) } diff --git a/Zend/tests/type_declarations/internal_function_strict_mode.phpt b/Zend/tests/type_declarations/internal_function_strict_mode.phpt index 04c59ae341..455164f327 100644 --- a/Zend/tests/type_declarations/internal_function_strict_mode.phpt +++ b/Zend/tests/type_declarations/internal_function_strict_mode.phpt @@ -30,6 +30,6 @@ try { *** Trying Ord With Integer *** Caught ord(): Argument #1 ($character) must be of type string, int given *** Trying Array Map With Invalid Callback -*** Caught array_map(): Argument #1 ($callback) must be a valid callback, first array member is not a valid class name or object +*** Caught array_map(): Argument #1 ($callback) must be a valid callback or null, first array member is not a valid class name or object *** Trying Strlen With Float *** Caught strlen(): Argument #1 ($str) must be of type string, float given diff --git a/Zend/tests/type_declarations/typed_properties_095.phpt b/Zend/tests/type_declarations/typed_properties_095.phpt index 8470d4f437..7e92cec682 100644 --- a/Zend/tests/type_declarations/typed_properties_095.phpt +++ b/Zend/tests/type_declarations/typed_properties_095.phpt @@ -1,7 +1,7 @@ --TEST-- Typed properties in internal classes --SKIPIF-- -<?php if (!extension_loaded('zend-test')) die('skip requires zend-test'); ?> +<?php if (!extension_loaded('zend_test')) die('skip requires zend_test'); ?> --FILE-- <?php diff --git a/Zend/tests/type_declarations/union_types/inheritance_internal.phpt b/Zend/tests/type_declarations/union_types/inheritance_internal.phpt index bb53411cad..84d0f88211 100644 --- a/Zend/tests/type_declarations/union_types/inheritance_internal.phpt +++ b/Zend/tests/type_declarations/union_types/inheritance_internal.phpt @@ -2,7 +2,7 @@ Inheritance of union type from internal class --SKIPIF-- <?php -if (!extension_loaded('zend-test')) die('skip requires zend-test extension'); +if (!extension_loaded('zend_test')) die('skip requires zend_test extension'); ?> --FILE-- <?php diff --git a/Zend/tests/undef_index_to_exception.phpt b/Zend/tests/undef_index_to_exception.phpt index c01aaba658..bbe13c0e71 100644 --- a/Zend/tests/undef_index_to_exception.phpt +++ b/Zend/tests/undef_index_to_exception.phpt @@ -42,5 +42,5 @@ array(0) { Undefined array key "key" array(0) { } -Undefined array key "test" +Undefined global variable $test Undefined variable $test diff --git a/Zend/tests/unset_cv09.phpt b/Zend/tests/unset_cv09.phpt deleted file mode 100644 index 63a7eab0f2..0000000000 --- a/Zend/tests/unset_cv09.phpt +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -unset() CV 9 (unset() of global variable in array_pop($GLOBALS)) ---FILE-- -<?php -$x = "ok\n"; -echo array_pop($GLOBALS); -echo $x; -echo "ok\n"; -?> ---EXPECTF-- -ok - -Warning: Undefined variable $x in %s on line %d -ok diff --git a/Zend/tests/unset_cv10.phpt b/Zend/tests/unset_cv10.phpt index c62b8ae57a..e8908be0f7 100644 --- a/Zend/tests/unset_cv10.phpt +++ b/Zend/tests/unset_cv10.phpt @@ -2,6 +2,7 @@ unset() CV 10 (unset() of global variable in ArrayObject::offsetUnset($GLOBALS)) --FILE-- <?php +/* This is working on a copy of $GLOBALS, so nothing interesting happens here. */ $a = new ArrayObject($GLOBALS); $x = "ok\n"; echo $x; @@ -12,5 +13,6 @@ echo "ok\n"; --EXPECTF-- ok -Warning: Undefined variable $x in %s on line %d +Warning: Undefined array key "x" in %s on line %d +ok ok |