diff options
Diffstat (limited to 'ext/standard/tests/array')
46 files changed, 772 insertions, 675 deletions
diff --git a/ext/standard/tests/array/array_diff_ukey_variation10.phpt b/ext/standard/tests/array/array_diff_ukey_variation10.phpt index 0d93928d86..58a040b0a7 100644 --- a/ext/standard/tests/array/array_diff_ukey_variation10.phpt +++ b/ext/standard/tests/array/array_diff_ukey_variation10.phpt @@ -33,7 +33,7 @@ NULL Warning: array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d NULL -Notice: Use of undefined constant unknown_function - assumed 'unknown_function' in %s on line %d +Warning: Use of undefined constant unknown_function - assumed 'unknown_function' (this will throw an Error in a future version of PHP) in %s on line %d Warning: array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d NULL diff --git a/ext/standard/tests/array/array_fill_object.phpt b/ext/standard/tests/array/array_fill_object.phpt index 86773b17f8..aa1db044cc 100644 --- a/ext/standard/tests/array/array_fill_object.phpt +++ b/ext/standard/tests/array/array_fill_object.phpt @@ -1,7 +1,5 @@ --TEST-- Test array_fill() function : usage variations - various object values for 'val' argument ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.4.0', '>=')) die('skip ZendEngine 2.3 or below needed'); ?> --FILE-- <?php /* Prototype : array array_fill(int $start_key, int $num, mixed $val) @@ -290,23 +288,23 @@ array(2) { object(Child_test2)#%d (4) { ["member1":"Child_test2":private]=> int(102) - ["member1":"Test2":private]=> - int(100) ["var1"]=> int(30) ["var2"]=> int(101) + ["member1":"Test2":private]=> + int(100) } [1]=> object(Child_test2)#%d (4) { ["member1":"Child_test2":private]=> int(102) - ["member1":"Test2":private]=> - int(100) ["var1"]=> int(30) ["var2"]=> int(101) + ["member1":"Test2":private]=> + int(100) } } -- Iteration 6 -- diff --git a/ext/standard/tests/array/array_fill_object_2_4.phpt b/ext/standard/tests/array/array_fill_object_2_4.phpt deleted file mode 100644 index fb8179766c..0000000000 --- a/ext/standard/tests/array/array_fill_object_2_4.phpt +++ /dev/null @@ -1,434 +0,0 @@ ---TEST-- -Test array_fill() function : usage variations - various object values for 'val' argument ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.4.0', '<')) die('skip ZendEngine 2.4 needed'); ?> ---FILE-- -<?php -/* Prototype : array array_fill(int $start_key, int $num, mixed $val) - * Description: Create an array containing num elements starting with index start_key each initialized to val - * Source code: ext/standard/array.c - */ - -/* - * testing array_fill() by passing various object values for 'val' argument - */ - -echo "*** Testing array_fill() : usage variations ***\n"; - -// Initialise function arguments not being substituted -$start_key = 0; -$num = 2; - -// class without a member -class Test -{ -} - -//class with public member, static member , constant and consturctor to initialize the public member -class Test1 -{ - const test1_constant = "test1"; - public static $test1_static = 0; - public $member1; - var $var1 = 30; - var $var2; - - function __construct($value1 , $value2) - { - $this->member1 = $value1; - $this->var2 = $value2; - } -} - -// child class which inherits parent class test1 -class Child_test1 extends Test1 -{ - public $member2; - - function __construct($value1 , $value2 , $value3) - { - parent::__construct($value1 , $value2); - $this->member2 = $value3; - } -} - -//class with private member, static member, constant and constructor to initialize the private member -class Test2 -{ - const test2_constant = "test2"; - public static $test2_static = 0; - private $member1; - var $var1 = 30; - var $var2; - - function __construct($value1 , $value2) - { - $this->member1 = $value1; - $this->var2 = $value2; - } -} - -// child class which inherits parent class test2 -class Child_test2 extends Test2 -{ - private $member1; - - function __construct($value1 , $value2 , $value3) - { - parent::__construct($value1 , $value2); - $this->member1 = $value3; - } -} - -// class with protected member, static member, constant and consturctor to initialize the protected member -class Test3 -{ - const test3_constant = "test3"; - public static $test3_static = 0; - protected $member1; - var $var1 = 30; - var $var2; - - function __construct($value1 , $value2) - { - $this->member1 = $value1; - $this->var2 = $value2; - } -} - -// child class which inherits parent class test3 -class Child_test3 extends Test3 -{ - protected $member1; - - function __construct($value1 , $value2 , $value3) - { - parent::__construct($value1 , $value2); - $this->member1 = $value3; - } -} - -// class with public, private, protected members, static, constant members and constructor to initialize all the members -class Test4 -{ - const test4_constant = "test4"; - public static $test4_static = 0; - public $member1; - private $member2; - protected $member3; - - function __construct($value1 , $value2 , $value3) - { - $this->member1 = $value1; - $this->member2 = $value2; - $this->member3 = $value3; - } -} - -// child class which inherits parent class test4 -class Child_test4 extends Test4 -{ - var $var1; - - function __construct($value1 , $value2 , $value3 , $value4) - { - parent::__construct($value1 , $value2 , $value3); - $this->var1 = $value4; - } -} - -// abstract class with public, private, protected members -abstract class AbstractClass -{ - public $member1; - private $member2; - protected $member3; - var $var1 = 30; - - abstract protected function display(); -} - -// implement abstract 'AbstractClass' class -class ConcreteClass1 extends AbstractClass -{ - protected function display() - { - echo "class name is ConcreteClass1 \n"; - } -} - - -// declarationn of the interface 'iTemplate' -interface iTemplate -{ - public function display(); -} - -// implement the interface 'iTemplate' -class Template1 implements iTemplate -{ - public function display() - { - echo "class name is Template1\n"; - } -} - -//array of object values for 'val' argument -$objects = array( - - /* 1 */ new Test(), - new Test1(100 , 101), - new Child_test1(100 , 101 , 102), - new Test2(100 , 101), - /* 5 */ new Child_test2(100 , 101 , 102), - new Test3(100 , 101), - new Child_test3(100 , 101 , 102), - new Test4( 100 , 101 , 102), - new Child_test4(100 , 101 , 102 , 103), - new ConcreteClass1(), - /* 11 */ new Template1() -); - -// loop through each element of the array for 'val' argument -// check the working of array_fill() -echo "--- Testing array_fill() with different object values for 'val' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($objects); $index ++) -{ - echo "-- Iteration $counter --\n"; - $val = $objects[$index]; - - var_dump( array_fill($start_key,$num,$val) ); - - $counter++; -} - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_fill() : usage variations *** ---- Testing array_fill() with different object values for 'val' argument --- --- Iteration 1 -- -array(2) { - [0]=> - object(Test)#%d (0) { - } - [1]=> - object(Test)#%d (0) { - } -} --- Iteration 2 -- -array(2) { - [0]=> - object(Test1)#%d (3) { - ["member1"]=> - int(100) - ["var1"]=> - int(30) - ["var2"]=> - int(101) - } - [1]=> - object(Test1)#%d (3) { - ["member1"]=> - int(100) - ["var1"]=> - int(30) - ["var2"]=> - int(101) - } -} --- Iteration 3 -- -array(2) { - [0]=> - object(Child_test1)#%d (4) { - ["member2"]=> - int(102) - ["member1"]=> - int(100) - ["var1"]=> - int(30) - ["var2"]=> - int(101) - } - [1]=> - object(Child_test1)#%d (4) { - ["member2"]=> - int(102) - ["member1"]=> - int(100) - ["var1"]=> - int(30) - ["var2"]=> - int(101) - } -} --- Iteration 4 -- -array(2) { - [0]=> - object(Test2)#%d (3) { - ["member1":"Test2":private]=> - int(100) - ["var1"]=> - int(30) - ["var2"]=> - int(101) - } - [1]=> - object(Test2)#%d (3) { - ["member1":"Test2":private]=> - int(100) - ["var1"]=> - int(30) - ["var2"]=> - int(101) - } -} --- Iteration 5 -- -array(2) { - [0]=> - object(Child_test2)#%d (4) { - ["member1":"Child_test2":private]=> - int(102) - ["var1"]=> - int(30) - ["var2"]=> - int(101) - ["member1":"Test2":private]=> - int(100) - } - [1]=> - object(Child_test2)#%d (4) { - ["member1":"Child_test2":private]=> - int(102) - ["var1"]=> - int(30) - ["var2"]=> - int(101) - ["member1":"Test2":private]=> - int(100) - } -} --- Iteration 6 -- -array(2) { - [0]=> - object(Test3)#%d (3) { - ["member1":protected]=> - int(100) - ["var1"]=> - int(30) - ["var2"]=> - int(101) - } - [1]=> - object(Test3)#%d (3) { - ["member1":protected]=> - int(100) - ["var1"]=> - int(30) - ["var2"]=> - int(101) - } -} --- Iteration 7 -- -array(2) { - [0]=> - object(Child_test3)#%d (3) { - ["member1":protected]=> - int(102) - ["var1"]=> - int(30) - ["var2"]=> - int(101) - } - [1]=> - object(Child_test3)#%d (3) { - ["member1":protected]=> - int(102) - ["var1"]=> - int(30) - ["var2"]=> - int(101) - } -} --- Iteration 8 -- -array(2) { - [0]=> - object(Test4)#%d (3) { - ["member1"]=> - int(100) - ["member2":"Test4":private]=> - int(101) - ["member3":protected]=> - int(102) - } - [1]=> - object(Test4)#%d (3) { - ["member1"]=> - int(100) - ["member2":"Test4":private]=> - int(101) - ["member3":protected]=> - int(102) - } -} --- Iteration 9 -- -array(2) { - [0]=> - object(Child_test4)#%d (4) { - ["var1"]=> - int(103) - ["member1"]=> - int(100) - ["member2":"Test4":private]=> - int(101) - ["member3":protected]=> - int(102) - } - [1]=> - object(Child_test4)#%d (4) { - ["var1"]=> - int(103) - ["member1"]=> - int(100) - ["member2":"Test4":private]=> - int(101) - ["member3":protected]=> - int(102) - } -} --- Iteration 10 -- -array(2) { - [0]=> - object(ConcreteClass1)#%d (4) { - ["member1"]=> - NULL - ["member2":"AbstractClass":private]=> - NULL - ["member3":protected]=> - NULL - ["var1"]=> - int(30) - } - [1]=> - object(ConcreteClass1)#%d (4) { - ["member1"]=> - NULL - ["member2":"AbstractClass":private]=> - NULL - ["member3":protected]=> - NULL - ["var1"]=> - int(30) - } -} --- Iteration 11 -- -array(2) { - [0]=> - object(Template1)#%d (0) { - } - [1]=> - object(Template1)#%d (0) { - } -} -Done diff --git a/ext/standard/tests/array/array_filter_variation7.phpt b/ext/standard/tests/array/array_filter_variation7.phpt index cb856f713d..79fb574e23 100644 --- a/ext/standard/tests/array/array_filter_variation7.phpt +++ b/ext/standard/tests/array/array_filter_variation7.phpt @@ -17,19 +17,19 @@ $input = array(0, 1, -1, 10, 100, 1000, 'Hello', null); // anonymous callback function echo "Anonymous callback function with regular parameter and statement\n"; -var_dump( array_filter($input, create_function('$input', 'return ($input > 1);') ) ); +var_dump( array_filter($input, function($input) { return ($input > 1); }) ); // anonymous callback function with reference echo "Anonymous callback function with reference parameter\n"; -var_dump( array_filter($input, create_function('&$input', 'return ($input < 1);') ) ); +var_dump( array_filter($input, function(&$input) { return ($input < 1); }) ); // anonymous callback function with null argument echo "Anonymous callback funciton with null argument\n"; -var_dump( array_filter($input, create_function(null, 'return true;') ) ); +var_dump( array_filter($input, function() { return true; }) ); // anonymous callback function with argument and null statement echo "Anonymous callback function with regular argument and null statement\n"; -var_dump( array_filter($input, create_function('$input', null) ) ); +var_dump( array_filter($input, function($input) { }) ); echo "Done" ?> diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation9.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation9.phpt index 64f58a6d1e..fc7c526ed1 100644 --- a/ext/standard/tests/array/array_intersect_uassoc_variation9.phpt +++ b/ext/standard/tests/array/array_intersect_uassoc_variation9.phpt @@ -32,7 +32,7 @@ NULL Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d NULL -Notice: Use of undefined constant unknown_function - assumed 'unknown_function' in %s on line %d +Warning: Use of undefined constant unknown_function - assumed 'unknown_function' (this will throw an Error in a future version of PHP) in %s on line %d Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d NULL diff --git a/ext/standard/tests/array/array_intersect_ukey_variation8.phpt b/ext/standard/tests/array/array_intersect_ukey_variation8.phpt index 3d580e1e02..89286f8986 100644 --- a/ext/standard/tests/array/array_intersect_ukey_variation8.phpt +++ b/ext/standard/tests/array/array_intersect_ukey_variation8.phpt @@ -32,7 +32,7 @@ NULL Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d NULL -Notice: Use of undefined constant unknown_function - assumed 'unknown_function' in %s on line %d +Warning: Use of undefined constant unknown_function - assumed 'unknown_function' (this will throw an Error in a future version of PHP) in %s on line %d Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d NULL diff --git a/ext/standard/tests/array/array_key_exists_object1.phpt b/ext/standard/tests/array/array_key_exists_object1.phpt index 4ffafc4539..3b263df474 100644 --- a/ext/standard/tests/array/array_key_exists_object1.phpt +++ b/ext/standard/tests/array/array_key_exists_object1.phpt @@ -57,11 +57,11 @@ $key = var3: bool(true) $class1: object(myClass)#1 (3) { - [%b|u%"var1"]=> - %unicode|string%(1) "a" - [%b|u%"var2"]=> - %unicode|string%(1) "b" - [%b|u%"var3"]=> + ["var1"]=> + string(1) "a" + ["var2"]=> + string(1) "b" + ["var3"]=> NULL } @@ -70,11 +70,11 @@ $key = var3: bool(true) $class2: object(myClass)#2 (3) { - [%b|u%"var1"]=> - %unicode|string%(1) "x" - [%b|u%"var2"]=> - %unicode|string%(1) "y" - [%b|u%"var3"]=> - %unicode|string%(1) "z" + ["var1"]=> + string(1) "x" + ["var2"]=> + string(1) "y" + ["var3"]=> + string(1) "z" } Done diff --git a/ext/standard/tests/array/array_key_exists_object2.phpt b/ext/standard/tests/array/array_key_exists_object2.phpt index 39bb129e39..4a790e9d37 100644 --- a/ext/standard/tests/array/array_key_exists_object2.phpt +++ b/ext/standard/tests/array/array_key_exists_object2.phpt @@ -61,11 +61,11 @@ $key = var3: bool(false) $class1: object(myClass)#1 (3) { - [%b|u%"var1"]=> - %unicode|string%(1) "a" - [%b|u%"var2":protected]=> - %unicode|string%(1) "b" - [%b|u%"var3":%b|u%"myClass":private]=> + ["var1"]=> + string(1) "a" + ["var2":protected]=> + string(1) "b" + ["var3":"myClass":private]=> NULL } @@ -74,11 +74,11 @@ $key = var3: bool(false) $class2: object(myClass)#2 (3) { - [%b|u%"var1"]=> - %unicode|string%(1) "x" - [%b|u%"var2":protected]=> - %unicode|string%(1) "y" - [%b|u%"var3":%b|u%"myClass":private]=> - %unicode|string%(1) "z" + ["var1"]=> + string(1) "x" + ["var2":protected]=> + string(1) "y" + ["var3":"myClass":private]=> + string(1) "z" } Done diff --git a/ext/standard/tests/array/array_map_variation10.phpt b/ext/standard/tests/array/array_map_variation10.phpt index ecf9157620..effda06745 100644 --- a/ext/standard/tests/array/array_map_variation10.phpt +++ b/ext/standard/tests/array/array_map_variation10.phpt @@ -17,23 +17,23 @@ $array1 = array(1, 2, 3); $array2 = array(3, 4, 5); echo "-- anonymous function with all parameters and body --\n"; -var_dump( array_map( create_function('$a, $b', 'return array($a, $b);'), $array1, $array2)); +var_dump( array_map( function($a, $b) { return array($a, $b); }, $array1, $array2)); echo "-- anonymous function with two parameters and passing one array --\n"; try { - var_dump( array_map( create_function('$a, $b', 'return array($a, $b);'), $array1)); + var_dump( array_map( function($a, $b) { return array($a, $b); }, $array1)); } catch (Throwable $e) { echo "Exception: " . $e->getMessage() . "\n"; } echo "-- anonymous function with NULL parameter --\n"; -var_dump( array_map( create_function(NULL, 'return NULL;'), $array1)); +var_dump( array_map( function() { return NULL; }, $array1)); echo "-- anonymous function with NULL body --\n"; -var_dump( array_map( create_function('$a', NULL), $array1)); +var_dump( array_map( function($a) { }, $array1)); echo "-- passing NULL as 'arr1' --\n"; -var_dump( array_map( create_function('$a', 'return array($a);'), NULL)); +var_dump( array_map( function($a) { return array($a); }, NULL)); echo "Done"; ?> @@ -64,7 +64,7 @@ array(3) { } } -- anonymous function with two parameters and passing one array -- -Exception: Too few arguments to function __lambda_func(), 1 passed and exactly 2 expected +Exception: Too few arguments to function {closure}(), 1 passed and exactly 2 expected -- anonymous function with NULL parameter -- array(3) { [0]=> diff --git a/ext/standard/tests/array/array_unique_variation2.phpt b/ext/standard/tests/array/array_unique_variation2.phpt index 757dd6e057..62dfab4568 100644 --- a/ext/standard/tests/array/array_unique_variation2.phpt +++ b/ext/standard/tests/array/array_unique_variation2.phpt @@ -114,37 +114,37 @@ array(1) { -- Iteration 6 -- array(4) { [0]=> - %unicode|string%(3) "a" + string(3) "a" [1]=> - %unicode|string%(5) "aaaa
" + string(5) "aaaa
" [2]=> - %unicode|string%(1) "b" + string(1) "b" [4]=> - %unicode|string%(27) "\[\]\!\@\#$\%\^\&\*\(\)\{\}" + string(27) "\[\]\!\@\#$\%\^\&\*\(\)\{\}" } -- Iteration 7 -- array(4) { [0]=> - %unicode|string%(5) "a\v\f" + string(5) "a\v\f" [1]=> - %unicode|string%(6) "aaaa\r" + string(6) "aaaa\r" [2]=> - %unicode|string%(1) "b" + string(1) "b" [4]=> - %unicode|string%(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}" + string(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}" } -- Iteration 8 -- array(3) { - [%b|u%"h1"]=> - %unicode|string%(1) " + ["h1"]=> + string(1) " " - [%b|u%"h2"]=> - %unicode|string%(88) "hello world + ["h2"]=> + string(88) "hello world The quick brown fox jumped over; the lazy dog This is a double quoted string" - [%b|u%"h3"]=> - %unicode|string%(88) "hello
world + ["h3"]=> + string(88) "hello
world 1111 != 2222 heredoc double quoted string. withdifferentwhitespaces" @@ -152,15 +152,15 @@ double quoted string. withdifferentwhitespaces" -- Iteration 9 -- array(2) { [1]=> - %unicode|string%(3) "one" + string(3) "one" [2]=> - %unicode|string%(3) "two" + string(3) "two" } -- Iteration 10 -- array(2) { - [%b|u%"one"]=> + ["one"]=> int(1) - [%b|u%"two"]=> + ["two"]=> int(2) } -- Iteration 11 -- @@ -174,55 +174,55 @@ array(3) { } -- Iteration 12 -- array(2) { - [%b|u%"one"]=> - %unicode|string%(3) "ten" - [%b|u%"two"]=> - %unicode|string%(6) "twenty" + ["one"]=> + string(3) "ten" + ["two"]=> + string(6) "twenty" } -- Iteration 13 -- array(3) { - [%b|u%"one"]=> + ["one"]=> int(1) [2]=> - %unicode|string%(3) "two" + string(3) "two" [4]=> - %unicode|string%(4) "four" + string(4) "four" } -- Iteration 14 -- array(2) { - [%b|u%""]=> - %unicode|string%(4) "null" - [%b|u%"NULL"]=> + [""]=> + string(4) "null" + ["NULL"]=> NULL } -- Iteration 15 -- array(4) { [1]=> - %unicode|string%(4) "true" + string(4) "true" [0]=> - %unicode|string%(5) "false" - [%b|u%"false"]=> + string(5) "false" + ["false"]=> bool(false) - [%b|u%"true"]=> + ["true"]=> bool(true) } -- Iteration 16 -- array(2) { - [%b|u%""]=> - %unicode|string%(6) "emptys" - [%b|u%"emptyd"]=> - %unicode|string%(0) "" + [""]=> + string(6) "emptys" + ["emptyd"]=> + string(0) "" } -- Iteration 17 -- array(2) { [1]=> - %unicode|string%(0) "" + string(0) "" [6]=> bool(true) } -- Iteration 18 -- array(3) { - [%b|u%""]=> + [""]=> int(4) [0]=> int(5) diff --git a/ext/standard/tests/array/array_unique_variation6.phpt b/ext/standard/tests/array/array_unique_variation6.phpt index 82442bdfad..15a46518b7 100644 --- a/ext/standard/tests/array/array_unique_variation6.phpt +++ b/ext/standard/tests/array/array_unique_variation6.phpt @@ -39,6 +39,6 @@ array(2) { [0]=> int(0) [1]=> - &%unicode|string%(5) "hello" + &string(5) "hello" } Done diff --git a/ext/standard/tests/array/array_unique_variation8.phpt b/ext/standard/tests/array/array_unique_variation8.phpt index 3b4eac9f75..8b67adfbab 100644 --- a/ext/standard/tests/array/array_unique_variation8.phpt +++ b/ext/standard/tests/array/array_unique_variation8.phpt @@ -36,22 +36,6 @@ Notice: Array to string conversion in %sarray_unique_variation8.php on line %d Notice: Array to string conversion in %sarray_unique_variation8.php on line %d Notice: Array to string conversion in %sarray_unique_variation8.php on line %d - -Notice: Array to string conversion in %sarray_unique_variation8.php on line %d - -Notice: Array to string conversion in %sarray_unique_variation8.php on line %d - -Notice: Array to string conversion in %sarray_unique_variation8.php on line %d - -Notice: Array to string conversion in %sarray_unique_variation8.php on line %d - -Notice: Array to string conversion in %sarray_unique_variation8.php on line %d - -Notice: Array to string conversion in %sarray_unique_variation8.php on line %d - -Notice: Array to string conversion in %sarray_unique_variation8.php on line %d - -Notice: Array to string conversion in %sarray_unique_variation8.php on line %d array(1) { [0]=> array(4) { diff --git a/ext/standard/tests/array/array_walk_object1.phpt b/ext/standard/tests/array/array_walk_object1.phpt index 342e760ce8..3bd83fdab2 100644 --- a/ext/standard/tests/array/array_walk_object1.phpt +++ b/ext/standard/tests/array/array_walk_object1.phpt @@ -51,15 +51,15 @@ echo "Done" ?> --EXPECTF-- *** Testing array_walk() : object functionality *** -%unicode|string%(18) "%r\0%rMyClass%r\0%rpri_value" +string(18) "%r\0%rMyClass%r\0%rpri_value" int(10) int(1) -%unicode|string%(9) "pub_value" +string(9) "pub_value" int(10) int(1) -%unicode|string%(12) "%r\0%r*%r\0%rpro_value" +string(12) "%r\0%r*%r\0%rpro_value" int(10) int(1) diff --git a/ext/standard/tests/array/array_walk_objects.phpt b/ext/standard/tests/array/array_walk_objects.phpt index 506d1cafcf..f9214d25a5 100644 --- a/ext/standard/tests/array/array_walk_objects.phpt +++ b/ext/standard/tests/array/array_walk_objects.phpt @@ -29,16 +29,16 @@ array_walk($var, "walk"); echo "Done\n"; ?> --EXPECTF-- -%unicode|string%(3) "foo" -%unicode|string%(3) "foo" -%unicode|string%(3) "bar" -%unicode|string%(3) "bar" -%unicode|string%(13) "%r\0%rtest%r\0%rvar_pri" -%unicode|string%(12) "test_private" -%unicode|string%(10) "%r\0%r*%r\0%rvar_pro" -%unicode|string%(14) "test_protected" -%unicode|string%(7) "var_pub" -%unicode|string%(11) "test_public" +string(3) "foo" +string(3) "foo" +string(3) "bar" +string(3) "bar" +string(13) "%r\0%rtest%r\0%rvar_pri" +string(12) "test_private" +string(10) "%r\0%r*%r\0%rvar_pro" +string(14) "test_protected" +string(7) "var_pub" +string(11) "test_public" -Warning: array_walk() expects parameter 1 to be array, %unicode_string_optional% given in %s on line %d +Warning: array_walk() expects parameter 1 to be array, string given in %s on line %d Done diff --git a/ext/standard/tests/array/array_walk_rec_objects.phpt b/ext/standard/tests/array/array_walk_rec_objects.phpt index bbd30f37f0..d2fa9b86eb 100644 --- a/ext/standard/tests/array/array_walk_rec_objects.phpt +++ b/ext/standard/tests/array/array_walk_rec_objects.phpt @@ -29,16 +29,16 @@ array_walk_recursive($var, "walk"); echo "Done\n"; ?> --EXPECTF-- -%unicode|string%(3) "foo" -%unicode|string%(3) "foo" -%unicode|string%(3) "bar" -%unicode|string%(3) "bar" -%unicode|string%(13) "%r\0%rtest%r\0%rvar_pri" -%unicode|string%(12) "test_private" -%unicode|string%(10) "%r\0%r*%r\0%rvar_pro" -%unicode|string%(14) "test_protected" -%unicode|string%(7) "var_pub" -%unicode|string%(11) "test_public" +string(3) "foo" +string(3) "foo" +string(3) "bar" +string(3) "bar" +string(13) "%r\0%rtest%r\0%rvar_pri" +string(12) "test_private" +string(10) "%r\0%r*%r\0%rvar_pro" +string(14) "test_protected" +string(7) "var_pub" +string(11) "test_public" -Warning: array_walk_recursive() expects parameter 1 to be array, %unicode_string_optional% given in %s on line %d +Warning: array_walk_recursive() expects parameter 1 to be array, string given in %s on line %d Done diff --git a/ext/standard/tests/array/array_walk_recursive_object1.phpt b/ext/standard/tests/array/array_walk_recursive_object1.phpt index 7ddced7766..5c01c55817 100644 --- a/ext/standard/tests/array/array_walk_recursive_object1.phpt +++ b/ext/standard/tests/array/array_walk_recursive_object1.phpt @@ -49,15 +49,15 @@ echo "Done" ?> --EXPECTF-- *** Testing array_walk_recursive() : object functionality *** -%unicode|string%(18) "%r\0%rMyClass%r\0%rpri_value" +string(18) "%r\0%rMyClass%r\0%rpri_value" int(10) int(1) -%unicode|string%(9) "pub_value" +string(9) "pub_value" int(10) int(1) -%unicode|string%(12) "%r\0%r*%r\0%rpro_value" +string(12) "%r\0%r*%r\0%rpro_value" int(10) int(1) diff --git a/ext/standard/tests/array/array_walk_recursive_variation7.phpt b/ext/standard/tests/array/array_walk_recursive_variation7.phpt index 0cdd6d248d..bc0d205900 100644 --- a/ext/standard/tests/array/array_walk_recursive_variation7.phpt +++ b/ext/standard/tests/array/array_walk_recursive_variation7.phpt @@ -21,19 +21,19 @@ echo "*** Testing array_walk_recursive() : anonymous function as callback ***\n" $input = array( array(2, 5), array(10, 0)); echo "-- Anonymous function with one argument --\n"; -var_dump( array_walk_recursive($input, create_function('$value', 'var_dump($value); echo "\n";'))); +var_dump( array_walk_recursive($input, function($value) { var_dump($value); echo "\n"; })); echo "-- Anonymous function with two arguments --\n"; -var_dump( array_walk_recursive($input, create_function('$value, $key', 'var_dump($key); var_dump($value); echo "\n";'))); +var_dump( array_walk_recursive($input, function($value, $key) { var_dump($key); var_dump($value); echo "\n"; })); echo "-- Anonymous function with three arguments --\n"; -var_dump( array_walk_recursive($input, create_function('$value, $key, $user_data', 'var_dump($key); var_dump($value); var_dump($user_data); echo "\n";'), 10)); +var_dump( array_walk_recursive($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 10)); echo "-- Anonymous function with one more argument --\n"; -var_dump( array_walk_recursive($input, create_function('$value, $key, $user_data', 'var_dump($key); var_dump($value); var_dump($user_data); echo "\n";'), 20, 30)); +var_dump( array_walk_recursive($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 20, 30)); echo "-- Anonymous function with null argument --\n"; -var_dump( array_walk_recursive( $input, create_function(null, 'echo "1\n";'))); +var_dump( array_walk_recursive( $input, function() { echo "1\n"; })); echo "Done" ?> --EXPECTF-- diff --git a/ext/standard/tests/array/array_walk_variation7.phpt b/ext/standard/tests/array/array_walk_variation7.phpt index da85958b8e..692f276628 100644 --- a/ext/standard/tests/array/array_walk_variation7.phpt +++ b/ext/standard/tests/array/array_walk_variation7.phpt @@ -21,19 +21,19 @@ echo "*** Testing array_walk() : anonymous function as callback ***\n"; $input = array(2, 5, 10, 0); echo "-- Anonymous function with one argument --\n"; -var_dump( array_walk($input, create_function('$value', 'var_dump($value); echo "\n";'))); +var_dump( array_walk($input, function($value) { var_dump($value); echo "\n"; })); echo "-- Anonymous function with two arguments --\n"; -var_dump( array_walk($input, create_function('$value, $key', 'var_dump($key); var_dump($value); echo "\n";'))); +var_dump( array_walk($input, function($value, $key) { var_dump($key); var_dump($value); echo "\n"; })); echo "-- Anonymous function with three arguments --\n"; -var_dump( array_walk($input, create_function('$value, $key, $user_data', 'var_dump($key); var_dump($value); var_dump($user_data); echo "\n";'), 10)); +var_dump( array_walk($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 10)); echo "-- Anonymous function with one more argument --\n"; -var_dump( array_walk($input, create_function('$value, $key, $user_data', 'var_dump($key); var_dump($value); var_dump($user_data); echo "\n";'), 20, 30)); +var_dump( array_walk($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 20, 30)); echo "-- Anonymous function with null argument --\n"; -var_dump( array_walk( $input, create_function(null, 'echo "1\n";'))); +var_dump( array_walk( $input, function() { echo "1\n"; })); echo "Done" ?> --EXPECTF-- diff --git a/ext/standard/tests/array/bug14580.phpt b/ext/standard/tests/array/bug14580.phpt index c04d00356e..1cf27f22d6 100644 --- a/ext/standard/tests/array/bug14580.phpt +++ b/ext/standard/tests/array/bug14580.phpt @@ -2,7 +2,7 @@ Bug #14580 (key() not binary safe) --FILE-- <?php - $arr = array (b"foo\0bar" => b"foo\0bar"); + $arr = array ("foo\0bar" => "foo\0bar"); $key = key($arr); echo strlen($key), ': '; echo urlencode($key), "\n"; diff --git a/ext/standard/tests/array/bug44929.phpt b/ext/standard/tests/array/bug44929.phpt index 9dc85acd1f..efcbcda1cc 100644 --- a/ext/standard/tests/array/bug44929.phpt +++ b/ext/standard/tests/array/bug44929.phpt @@ -2,7 +2,7 @@ Bug #44929 (natsort doesn't handle leading zeros well) --FILE-- <?php -$a = array(b'001',b'008',b'005',b'00011',b'03',b'000014',b'-123',b'0.002',b'00',b'0',b'0_0',b'0-0'); +$a = array('001','008','005','00011','03','000014','-123','0.002','00','0','0_0','0-0'); natsort($a); var_dump($a); ?> diff --git a/ext/standard/tests/array/bug48854.phpt b/ext/standard/tests/array/bug48854.phpt index 0908637503..7aaade03a4 100644 --- a/ext/standard/tests/array/bug48854.phpt +++ b/ext/standard/tests/array/bug48854.phpt @@ -24,20 +24,20 @@ var_dump($array1, $array2); ?> --EXPECTF-- array(2) { - [%u|b%"friends"]=> + ["friends"]=> int(5) - [%u|b%"children"]=> + ["children"]=> array(1) { - [%u|b%"dogs"]=> + ["dogs"]=> int(0) } } array(2) { - [%u|b%"friends"]=> + ["friends"]=> int(10) - [%u|b%"children"]=> + ["children"]=> array(1) { - [%u|b%"cats"]=> + ["cats"]=> int(5) } } diff --git a/ext/standard/tests/array/bug65251.phpt b/ext/standard/tests/array/bug65251.phpt new file mode 100644 index 0000000000..014517794c --- /dev/null +++ b/ext/standard/tests/array/bug65251.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #65251: array_merge_recursive() recursion detection broken +--FILE-- +<?php + +array_merge_recursive($GLOBALS, $GLOBALS) + +?> +--EXPECTF-- +Warning: array_merge_recursive(): recursion detected in %s on line %d diff --git a/ext/standard/tests/array/bug75433.phpt b/ext/standard/tests/array/bug75433.phpt new file mode 100644 index 0000000000..650c6ca378 --- /dev/null +++ b/ext/standard/tests/array/bug75433.phpt @@ -0,0 +1,17 @@ +--TEST-- +array_values() preserves next index from source array when shallow-copying +--FILE-- +<?php + +$a = [1,2,3]; +unset($a[2]); +$b = array_values($a); +$b[] = 4; +print_r($b); +--EXPECT-- +Array +( + [0] => 1 + [1] => 2 + [2] => 4 +) diff --git a/ext/standard/tests/array/bug75653.phpt b/ext/standard/tests/array/bug75653.phpt new file mode 100644 index 0000000000..d11c1e0c75 --- /dev/null +++ b/ext/standard/tests/array/bug75653.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #75653: array_values don't work on empty array +--FILE-- +<?php + +$array[] = 'data1'; +unset($array[0]); +$array = array_values($array); +$array[] = 'data2'; +$array[] = 'data3'; +var_dump($array); + +?> +--EXPECT-- +array(2) { + [0]=> + string(5) "data2" + [1]=> + string(5) "data3" +} diff --git a/ext/standard/tests/array/count_invalid.phpt b/ext/standard/tests/array/count_invalid.phpt new file mode 100644 index 0000000000..95da00dac5 --- /dev/null +++ b/ext/standard/tests/array/count_invalid.phpt @@ -0,0 +1,42 @@ +--TEST-- +Only arrays and countable objects can be counted +--FILE-- +<?php + +$result = count(null); +var_dump($result); + +$result = count("string"); +var_dump($result); + +$result = count(123); +var_dump($result); + +$result = count(true); +var_dump($result); + +$result = count(false); +var_dump($result); + +$result = count((object) []); +var_dump($result); + +?> +--EXPECTF-- +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d +int(0) + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) diff --git a/ext/standard/tests/array/count_recursive.phpt b/ext/standard/tests/array/count_recursive.phpt index 16c754e54f..b903d8b189 100644 --- a/ext/standard/tests/array/count_recursive.phpt +++ b/ext/standard/tests/array/count_recursive.phpt @@ -132,7 +132,11 @@ closedir( $resource2 ); --EXPECTF-- *** Testing basic functionality of count() function *** -- Testing NULL -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d COUNT_NORMAL: should be 0, is 0 + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d COUNT_RECURSIVE: should be 0, is 0 -- Testing arrays -- COUNT_NORMAL: should be 2, is 2 @@ -141,9 +145,15 @@ COUNT_RECURSIVE: should be 8, is 8 COUNT_NORMAL: should be 3, is 3 COUNT_RECURSIVE: should be 6, is 6 -- Testing strings -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d COUNT_NORMAL: should be 1, is 1 + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d COUNT_RECURSIVE: should be 1, is 1 -- Testing various types with no second argument -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d COUNT_NORMAL: should be 1, is 1 COUNT_NORMAL: should be 2, is 2 -- Testing really cool arrays -- @@ -184,11 +194,19 @@ COUNT_NORMAL is 4 COUNT_RECURSIVE is 7 -- Testing count() on constants with no second argument -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d COUNT_NORMAL: should be 1, is 1 + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d COUNT_NORMAL: should be 1, is 1 -- Testing count() on NULL and Unset variables -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d COUNT_NORMAL: should be 0, is 0 + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d COUNT_NORMAL: should be 1, is 1 COUNT_NORMAL: should be 0, is 0 @@ -221,7 +239,7 @@ NULL Warning: count() expects at most 2 parameters, 3 given in %s on line %d NULL -Notice: Use of undefined constant ABCD - assumed 'ABCD' in %s on line %d +Warning: Use of undefined constant ABCD - assumed 'ABCD' (this will throw an Error in a future version of PHP) in %s on line %d Warning: count() expects parameter 2 to be integer, %s given in %s on line %d NULL diff --git a/ext/standard/tests/array/count_variation1.phpt b/ext/standard/tests/array/count_variation1.phpt index b40a2ab299..a58473c219 100644 --- a/ext/standard/tests/array/count_variation1.phpt +++ b/ext/standard/tests/array/count_variation1.phpt @@ -97,74 +97,122 @@ echo "Done"; *** Testing count() : usage variations *** -- Iteration 1 -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d int(1) -- Iteration 2 -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d int(1) -- Iteration 3 -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d int(1) -- Iteration 4 -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d int(1) -- Iteration 5 -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d int(1) -- Iteration 6 -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d int(1) -- Iteration 7 -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d int(1) -- Iteration 8 -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d int(1) -- Iteration 9 -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d int(1) -- Iteration 10 -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) -- Iteration 11 -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) -- Iteration 12 -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d int(1) -- Iteration 13 -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d int(1) -- Iteration 14 -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d int(1) -- Iteration 15 -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d int(1) -- Iteration 16 -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d int(1) -- Iteration 17 -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d int(1) -- Iteration 18 -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d int(1) -- Iteration 19 -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d int(1) -- Iteration 20 -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d int(1) -- Iteration 21 -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d int(1) -- Iteration 22 -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) -- Iteration 23 -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) -- Iteration 24 -- + +Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d int(1) Done
\ No newline at end of file diff --git a/ext/standard/tests/array/each.phpt b/ext/standard/tests/array/each.phpt Binary files differindex 974808c08c..f1b6f76ea6 100644 --- a/ext/standard/tests/array/each.phpt +++ b/ext/standard/tests/array/each.phpt diff --git a/ext/standard/tests/array/each_basic.phpt b/ext/standard/tests/array/each_basic.phpt index 350b40f9a3..b12b4c19f7 100644 --- a/ext/standard/tests/array/each_basic.phpt +++ b/ext/standard/tests/array/each_basic.phpt @@ -46,6 +46,8 @@ array(4) { } -- Initial position: -- + +Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d array(4) { [1]=> int(1) @@ -71,4 +73,4 @@ array(4) { -- Passed the end of array: -- bool(false) -Done
\ No newline at end of file +Done diff --git a/ext/standard/tests/array/each_variation1.phpt b/ext/standard/tests/array/each_variation1.phpt index 0afef31432..becdfc4545 100644 --- a/ext/standard/tests/array/each_variation1.phpt +++ b/ext/standard/tests/array/each_variation1.phpt @@ -101,6 +101,8 @@ echo "Done"; -- Iteration 1 -- +Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d + Warning: Variable passed to each() is not an array or object in %s on line %d NULL diff --git a/ext/standard/tests/array/each_variation2.phpt b/ext/standard/tests/array/each_variation2.phpt index 3f7211c89c..73b1ba2746 100644 --- a/ext/standard/tests/array/each_variation2.phpt +++ b/ext/standard/tests/array/each_variation2.phpt @@ -122,6 +122,8 @@ echo "Done"; *** Testing each() : usage variations *** -- Iteration 1: int data -- + +Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d array(4) { [1]=> int(0) @@ -245,4 +247,4 @@ array(4) { ["key"]=> int(0) } -Done
\ No newline at end of file +Done diff --git a/ext/standard/tests/array/each_variation3.phpt b/ext/standard/tests/array/each_variation3.phpt index b31ddc61b4..375615643f 100644 --- a/ext/standard/tests/array/each_variation3.phpt +++ b/ext/standard/tests/array/each_variation3.phpt @@ -108,6 +108,8 @@ echo "Done"; *** Testing each() : usage variations *** -- Iteration 1: int data -- + +Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d array(4) { [1]=> string(4) "zero" @@ -250,4 +252,4 @@ array(4) { ["key"]=> string(0) "" } -Done
\ No newline at end of file +Done diff --git a/ext/standard/tests/array/each_variation4.phpt b/ext/standard/tests/array/each_variation4.phpt index 535ae297d1..14b5536135 100644 --- a/ext/standard/tests/array/each_variation4.phpt +++ b/ext/standard/tests/array/each_variation4.phpt @@ -35,6 +35,8 @@ echo "Done"; -- Array made up of referenced variables: -- -- Call each until at the end of the array: -- + +Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d array(4) { [1]=> string(3) "foo" diff --git a/ext/standard/tests/array/each_variation5.phpt b/ext/standard/tests/array/each_variation5.phpt index 941ad5e3ac..b6c39538a3 100644 --- a/ext/standard/tests/array/each_variation5.phpt +++ b/ext/standard/tests/array/each_variation5.phpt @@ -37,6 +37,8 @@ echo "Done"; *** Testing each() : usage variations *** -- Pass each() a two-dimensional array -- + +Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d array(4) { [1]=> string(4) "zero" @@ -93,4 +95,4 @@ array(4) { ["key"]=> int(0) } -Done
\ No newline at end of file +Done diff --git a/ext/standard/tests/array/each_variation6.phpt b/ext/standard/tests/array/each_variation6.phpt index 445d63f318..ba0f2657c8 100644 --- a/ext/standard/tests/array/each_variation6.phpt +++ b/ext/standard/tests/array/each_variation6.phpt @@ -35,6 +35,8 @@ echo "Done"; 0 => zero -- Call to each(): -- + +Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d array(4) { [1]=> string(4) "zero" @@ -48,4 +50,4 @@ array(4) { -- New position: -- 1 => one -Done
\ No newline at end of file +Done diff --git a/ext/standard/tests/array/extract_variation10.phpt b/ext/standard/tests/array/extract_variation10.phpt index d520be775e..6e4565dc8c 100644 --- a/ext/standard/tests/array/extract_variation10.phpt +++ b/ext/standard/tests/array/extract_variation10.phpt @@ -10,4 +10,4 @@ $a['foo'] = 'changed.foo'; var_dump($nonref); ?> --EXPECTF-- -%unicode|string%(12) "original.foo" +string(12) "original.foo" diff --git a/ext/standard/tests/array/extract_variation11.phpt b/ext/standard/tests/array/extract_variation11.phpt index 7f6e08c982..dfab4ddbba 100644 --- a/ext/standard/tests/array/extract_variation11.phpt +++ b/ext/standard/tests/array/extract_variation11.phpt @@ -10,4 +10,4 @@ $foo = 'changed.foo'; var_dump($a['foo']); ?> --EXPECTF-- -%unicode|string%(11) "changed.foo" +string(11) "changed.foo" diff --git a/ext/standard/tests/array/packed_001.phpt b/ext/standard/tests/array/packed_001.phpt new file mode 100644 index 0000000000..81973c7e0e --- /dev/null +++ b/ext/standard/tests/array/packed_001.phpt @@ -0,0 +1,84 @@ +--TEST-- +array_keys() and array_values() w/ packed optimization +--FILE-- +<?php + +$x = [1,2,3]; +unset($x[1]); + +$inputs = [ + [], + [1,2,3], + [0=>1, 1=>2, 2=>3], + [1=>1, 2=>2, 3=>3], + [0=>1, 2=>3], + $x, +]; + +foreach ($inputs as $input) { + print_r(array_keys($input)); + print_r(array_values($input)); +} +--EXPECT-- +Array +( +) +Array +( +) +Array +( + [0] => 0 + [1] => 1 + [2] => 2 +) +Array +( + [0] => 1 + [1] => 2 + [2] => 3 +) +Array +( + [0] => 0 + [1] => 1 + [2] => 2 +) +Array +( + [0] => 1 + [1] => 2 + [2] => 3 +) +Array +( + [0] => 1 + [1] => 2 + [2] => 3 +) +Array +( + [0] => 1 + [1] => 2 + [2] => 3 +) +Array +( + [0] => 0 + [1] => 2 +) +Array +( + [0] => 1 + [1] => 3 +) +Array +( + [0] => 0 + [1] => 2 +) +Array +( + [0] => 1 + [1] => 3 +) diff --git a/ext/standard/tests/array/sizeof_basic1.phpt b/ext/standard/tests/array/sizeof_basic1.phpt index dea4a68ea8..ac86cbf8d7 100644 --- a/ext/standard/tests/array/sizeof_basic1.phpt +++ b/ext/standard/tests/array/sizeof_basic1.phpt @@ -45,16 +45,28 @@ echo "Done"; --EXPECTF-- *** Testing sizeof() : basic functionality *** -- Testing sizeof() for integer type in default, COUNT_NORMAL and COUNT_RECURSIVE modes -- -default mode: int(1) +default mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_NORMAL mode: int(1) +COUNT_NORMAL mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_RECURSIVE mode: int(1) +COUNT_RECURSIVE mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -- Testing sizeof() for float type in default, COUNT_NORMAL and COUNT_RECURSIVE modes -- -default mode: int(1) +default mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_NORMAL mode: int(1) +COUNT_NORMAL mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_RECURSIVE mode: int(1) +COUNT_RECURSIVE mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) Done diff --git a/ext/standard/tests/array/sizeof_error.phpt b/ext/standard/tests/array/sizeof_error.phpt index 79a75f3153..c6274830cf 100644 --- a/ext/standard/tests/array/sizeof_error.phpt +++ b/ext/standard/tests/array/sizeof_error.phpt @@ -17,7 +17,7 @@ echo "-- Testing sizeof() with zero arguments --\n"; var_dump( sizeof() ); echo "-- Testing sizeof() function with more than two arguments under COUNT_NORMAL mode --\n"; $var = 100; -$extra_arg = 10;; +$extra_arg = 10; var_dump( sizeof($var, COUNT_NORMAL, $extra_arg) ); echo "-- Testing sizeof() function with more than two arguments under COUNT_RECURSIVE mode --\n"; var_dump( sizeof($var, COUNT_RECURSIVE, $extra_arg) ); diff --git a/ext/standard/tests/array/sizeof_object2.phpt b/ext/standard/tests/array/sizeof_object2.phpt index e2c0816c66..404443ae59 100644 --- a/ext/standard/tests/array/sizeof_object2.phpt +++ b/ext/standard/tests/array/sizeof_object2.phpt @@ -101,38 +101,68 @@ echo "Done"; *** Testing sizeof() : object functionality *** --- Testing sizeof() with objects which doesn't implement Countable interface --- -- Iteration 1 -- -Default Mode: int(1) +Default Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_NORMAL Mode: int(1) +COUNT_NORMAL Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_RECURSIVE Mode: int(1) +COUNT_RECURSIVE Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -- Iteration 2 -- -Default Mode: int(1) +Default Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_NORMAL Mode: int(1) +COUNT_NORMAL Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_RECURSIVE Mode: int(1) +COUNT_RECURSIVE Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -- Iteration 3 -- -Default Mode: int(1) +Default Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_NORMAL Mode: int(1) +COUNT_NORMAL Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_RECURSIVE Mode: int(1) +COUNT_RECURSIVE Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -- Iteration 4 -- -Default Mode: int(1) +Default Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_NORMAL Mode: int(1) +COUNT_NORMAL Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_RECURSIVE Mode: int(1) +COUNT_RECURSIVE Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -- Iteration 5 -- -Default Mode: int(1) +Default Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_NORMAL Mode: int(1) +COUNT_NORMAL Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_RECURSIVE Mode: int(1) +COUNT_RECURSIVE Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) Done diff --git a/ext/standard/tests/array/sizeof_variation1.phpt b/ext/standard/tests/array/sizeof_variation1.phpt index 328645f9e2..5917a798e1 100644 --- a/ext/standard/tests/array/sizeof_variation1.phpt +++ b/ext/standard/tests/array/sizeof_variation1.phpt @@ -66,150 +66,264 @@ for($i = 0; $i < count($values); $i++) echo "COUNT_NORMAL Mode: "; var_dump( sizeof($var, COUNT_NORMAL) ); echo "\n"; - + echo "COUNT_RECURSIVE Mode: "; var_dump( sizeof($var, COUNT_RECURSIVE) ); echo "\n"; - + $counter++; } - + echo "Done"; ?> --EXPECTF-- *** Testing sizeof() : usage variations *** --- Testing sizeof() for all scalar types in default,COUNT_NORMAL and COUNT_RECURSIVE mode --- -- Iteration 1 -- -Default Mode: int(1) +Default Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_NORMAL Mode: int(1) +COUNT_NORMAL Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_RECURSIVE Mode: int(1) +COUNT_RECURSIVE Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -- Iteration 2 -- -Default Mode: int(1) +Default Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_NORMAL Mode: int(1) +COUNT_NORMAL Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_RECURSIVE Mode: int(1) +COUNT_RECURSIVE Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -- Iteration 3 -- -Default Mode: int(1) +Default Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_NORMAL Mode: int(1) +COUNT_NORMAL Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_RECURSIVE Mode: int(1) +COUNT_RECURSIVE Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -- Iteration 4 -- -Default Mode: int(1) +Default Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_NORMAL Mode: int(1) +COUNT_NORMAL Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_RECURSIVE Mode: int(1) +COUNT_RECURSIVE Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -- Iteration 5 -- -Default Mode: int(1) +Default Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_NORMAL Mode: int(1) +COUNT_NORMAL Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_RECURSIVE Mode: int(1) +COUNT_RECURSIVE Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -- Iteration 6 -- -Default Mode: int(1) +Default Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_NORMAL Mode: int(1) +COUNT_NORMAL Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_RECURSIVE Mode: int(1) +COUNT_RECURSIVE Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -- Iteration 7 -- -Default Mode: int(1) +Default Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_NORMAL Mode: int(1) +COUNT_NORMAL Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_RECURSIVE Mode: int(1) +COUNT_RECURSIVE Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -- Iteration 8 -- -Default Mode: int(0) +Default Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(0) -COUNT_NORMAL Mode: int(0) +COUNT_NORMAL Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(0) -COUNT_RECURSIVE Mode: int(0) +COUNT_RECURSIVE Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(0) -- Iteration 9 -- -Default Mode: int(0) +Default Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(0) -COUNT_NORMAL Mode: int(0) +COUNT_NORMAL Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(0) -COUNT_RECURSIVE Mode: int(0) +COUNT_RECURSIVE Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(0) -- Iteration 10 -- -Default Mode: int(1) +Default Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_NORMAL Mode: int(1) +COUNT_NORMAL Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_RECURSIVE Mode: int(1) +COUNT_RECURSIVE Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -- Iteration 11 -- -Default Mode: int(1) +Default Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_NORMAL Mode: int(1) +COUNT_NORMAL Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_RECURSIVE Mode: int(1) +COUNT_RECURSIVE Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -- Iteration 12 -- -Default Mode: int(1) +Default Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_NORMAL Mode: int(1) +COUNT_NORMAL Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_RECURSIVE Mode: int(1) +COUNT_RECURSIVE Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -- Iteration 13 -- -Default Mode: int(1) +Default Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_NORMAL Mode: int(1) +COUNT_NORMAL Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_RECURSIVE Mode: int(1) +COUNT_RECURSIVE Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -- Iteration 14 -- -Default Mode: int(1) +Default Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_NORMAL Mode: int(1) +COUNT_NORMAL Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_RECURSIVE Mode: int(1) +COUNT_RECURSIVE Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -- Iteration 15 -- -Default Mode: int(1) +Default Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_NORMAL Mode: int(1) +COUNT_NORMAL Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_RECURSIVE Mode: int(1) +COUNT_RECURSIVE Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -- Iteration 16 -- -Default Mode: int(1) +Default Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_NORMAL Mode: int(1) +COUNT_NORMAL Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_RECURSIVE Mode: int(1) +COUNT_RECURSIVE Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -- Iteration 17 -- -Default Mode: int(1) +Default Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_NORMAL Mode: int(1) +COUNT_NORMAL Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_RECURSIVE Mode: int(1) +COUNT_RECURSIVE Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -- Iteration 18 -- -Default Mode: int(0) +Default Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(0) -COUNT_NORMAL Mode: int(0) +COUNT_NORMAL Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(0) -COUNT_RECURSIVE Mode: int(0) +COUNT_RECURSIVE Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(0) -- Iteration 19 -- -Default Mode: int(1) +Default Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_NORMAL Mode: int(1) +COUNT_NORMAL Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) -COUNT_RECURSIVE Mode: int(1) +COUNT_RECURSIVE Mode: +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d +int(1) Done diff --git a/ext/standard/tests/array/sizeof_variation4.phpt b/ext/standard/tests/array/sizeof_variation4.phpt index cb8fecc822..63fc05bd46 100644 --- a/ext/standard/tests/array/sizeof_variation4.phpt +++ b/ext/standard/tests/array/sizeof_variation4.phpt @@ -90,261 +90,381 @@ echo "Done"; -- Iteration 1 -- Default Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_NORMAL Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_RECURSIVE Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) -- Iteration 2 -- Default Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_NORMAL Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_RECURSIVE Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) -- Iteration 3 -- Default Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_NORMAL Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_RECURSIVE Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) -- Iteration 4 -- Default Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_NORMAL Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_RECURSIVE Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) -- Iteration 5 -- Default Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_NORMAL Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_RECURSIVE Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) -- Iteration 6 -- Default Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_NORMAL Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_RECURSIVE Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) -- Iteration 7 -- Default Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_NORMAL Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_RECURSIVE Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) -- Iteration 8 -- Default Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_NORMAL Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_RECURSIVE Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) -- Iteration 9 -- Default Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_NORMAL Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_RECURSIVE Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) -- Iteration 10 -- Default Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_NORMAL Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_RECURSIVE Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) -- Iteration 11 -- Default Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_NORMAL Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_RECURSIVE Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) -- Iteration 12 -- Default Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_NORMAL Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_RECURSIVE Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) -- Iteration 13 -- Default Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_NORMAL Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_RECURSIVE Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) -- Iteration 14 -- Default Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_NORMAL Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_RECURSIVE Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) -- Iteration 15 -- Default Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_NORMAL Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_RECURSIVE Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) -- Iteration 16 -- Default Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_NORMAL Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_RECURSIVE Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) -- Iteration 17 -- Default Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_NORMAL Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_RECURSIVE Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) -- Iteration 18 -- Default Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_NORMAL Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_RECURSIVE Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) -- Iteration 19 -- Default Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_NORMAL Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_RECURSIVE Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) -- Iteration 20 -- Default Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_NORMAL Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) COUNT_RECURSIVE Mode: Notice: Undefined variable: value in %s on line %d + +Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d int(0) Done diff --git a/ext/standard/tests/array/uasort_variation7.phpt b/ext/standard/tests/array/uasort_variation7.phpt index 44a2bb3a26..e37d9efe6b 100644 --- a/ext/standard/tests/array/uasort_variation7.phpt +++ b/ext/standard/tests/array/uasort_variation7.phpt @@ -15,16 +15,26 @@ Test uasort() function : usage variations - anonymous function as 'cmp_function' echo "*** Testing uasort() : anonymous function as 'cmp_function' ***\n"; -$cmp_function = 'if($value1 == $value2) {return 0;} else if($value1 > $value2) {return 1;} else{return -1;}'; +$cmp_function = function($value1, $value2) { + if ($value1 == $value2) { return 0; } + else if ($value1 > $value2) { return 1; } + else { return -1; } +}; $array_arg = array(0 => 100, 1 => 3, 2 => -70, 3 => 24, 4 => 90); echo "-- Anonymous 'cmp_function' with parameters passed by value --\n"; -var_dump( uasort($array_arg, create_function('$value1, $value2',$cmp_function) ) ); +var_dump( uasort($array_arg, $cmp_function) ); var_dump($array_arg); +$cmp_function = function(&$value1, &$value2) { + if ($value1 == $value2) { return 0; } + else if ($value1 > $value2) { return 1; } + else { return -1; } +}; + $array_arg = array("b" => "Banana", "m" => "Mango", "a" => "Apple", "p" => "Pineapple"); echo "-- Anonymous 'cmp_function' with parameters passed by reference --\n"; -var_dump( uasort($array_arg, create_function('&$value1, &$value2', $cmp_function) ) ); +var_dump( uasort($array_arg, $cmp_function ) ); var_dump($array_arg); echo "Done" diff --git a/ext/standard/tests/array/usort_variation7.phpt b/ext/standard/tests/array/usort_variation7.phpt index e567341b1a..171e751df2 100644 --- a/ext/standard/tests/array/usort_variation7.phpt +++ b/ext/standard/tests/array/usort_variation7.phpt @@ -13,18 +13,28 @@ Test usort() function : usage variations - Anonymous comparison function echo "*** Testing usort() : usage variation ***\n"; -$cmp_function = 'if($value1 == $value2) {return 0;} else if($value1 > $value2) {return 1;} else{return -1;}'; +$cmp_function = function($value1, $value2) { + if ($value1 == $value2) { return 0; } + else if ($value1 > $value2) { return 1; } + else { return -1; } +}; $array_arg = array(0 => 100, 1 => 3, 2 => -70, 3 => 24, 4 => 90); echo "\n-- Anonymous 'cmp_function' with parameters passed by value --\n"; -var_dump( usort($array_arg, create_function('$value1, $value2',$cmp_function) ) ); +var_dump( usort($array_arg, $cmp_function) ); var_dump($array_arg); $array_arg = array("b" => "Banana", "m" => "Mango", "a" => "Apple", "p" => "Pineapple"); +$cmp_function = function(&$value1, &$value2) { + if ($value1 == $value2) { return 0; } + else if ($value1 > $value2) { return 1; } + else { return -1; } +}; + echo "\n-- Anonymous 'cmp_function' with parameters passed by reference --\n"; -var_dump( usort($array_arg, create_function('&$value1, &$value2', $cmp_function) ) ); +var_dump( usort($array_arg, $cmp_function) ); var_dump($array_arg); ?> ===DONE=== @@ -58,4 +68,4 @@ array(4) { [3]=> string(9) "Pineapple" } -===DONE===
\ No newline at end of file +===DONE=== diff --git a/ext/standard/tests/array/var_export.phpt b/ext/standard/tests/array/var_export.phpt index 8caf40789f..0b1f76094d 100644 --- a/ext/standard/tests/array/var_export.phpt +++ b/ext/standard/tests/array/var_export.phpt @@ -7,7 +7,7 @@ var_export($a); ?> --EXPECT-- stdClass::__set_state(array( - 0 => 1, - 1 => 3, + '0' => 1, + '1' => 3, 'foo' => 'bar', )) |