]> granicus.if.org Git - php/commitdiff
Fix tests (mostly MFB)
authorArnaud Le Blanc <lbarnaud@php.net>
Fri, 24 Apr 2009 17:13:49 +0000 (17:13 +0000)
committerArnaud Le Blanc <lbarnaud@php.net>
Fri, 24 Apr 2009 17:13:49 +0000 (17:13 +0000)
14 files changed:
ext/standard/tests/array/array_filter_variation9.phpt
ext/standard/tests/array/array_key_exists.phpt
ext/standard/tests/array/array_key_exists_object1.phpt
ext/standard/tests/array/array_key_exists_object2.phpt
ext/standard/tests/array/array_key_exists_variation2.phpt
ext/standard/tests/array/array_push_error2.phpt
ext/standard/tests/array/array_unique_error.phpt
ext/standard/tests/array/array_unique_variation2.phpt
ext/standard/tests/array/array_unique_variation6.phpt
ext/standard/tests/array/array_walk_object1.phpt
ext/standard/tests/array/array_walk_objects.phpt
ext/standard/tests/array/array_walk_rec_objects.phpt
ext/standard/tests/array/array_walk_recursive_object1.phpt
ext/standard/tests/array/bug44929.phpt

index d0ac77d653eb24bc93691c0e40af6a041796364d..480f4df2ab5294f50e34f0e89f9386d5b8e143a9 100644 (file)
@@ -45,7 +45,9 @@ array(6) {
   [5]=>
   int(1000)
 }
-array(8) {
+
+Warning: chr() expects parameter 1 to be long, Unicode string given in %s
+array(7) {
   [0]=>
   int(0)
   [1]=>
@@ -58,8 +60,6 @@ array(8) {
   int(100)
   [5]=>
   int(1000)
-  [6]=>
-  unicode(5) "Hello"
   [7]=>
   NULL
 }
index d77705848176718ab41c5875a6d7d86266ff76be..c1d7fe3727cea510aebde9de840cdb541ced2efd 100644 (file)
@@ -118,7 +118,7 @@ var_dump(array_key_exists("var", $key_check_obj->arr)); //found,  key is in memb
 var_dump( array_key_exists($key_check_obj, $key_check_obj) );
 echo "Done\n";
 ?>
---EXPECTF--
+--EXPECTF--    
 *** Testing basic functionalities ***
 -- Iteration 1 --
 bool(true)
@@ -280,23 +280,13 @@ Warning: array_key_exists(): The first argument should be either a string or an
 bool(false)
 
 *** Testing operation on objects ***
-
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
-
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
-
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
-
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
-
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
 bool(true)
 
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
 Done
index 4e6c2db4affbcd559d09cfd49275cb1e1e4c6a12..4ffafc45394c24341f3bd4b13adc77346a3efb2d 100644 (file)
@@ -52,35 +52,29 @@ echo "Done";
 
 -- Do not assign a value to $class1->var3 --
 $key = var1:
-
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
+bool(true)
 $key = var3:
-
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
+bool(true)
 $class1:
-object(myClass)#%d (3) {
-  [u"var1"]=>
-  unicode(1) "a"
-  [u"var2"]=>
-  unicode(1) "b"
-  [u"var3"]=>
+object(myClass)#1 (3) {
+  [%b|u%"var1"]=>
+  %unicode|string%(1) "a"
+  [%b|u%"var2"]=>
+  %unicode|string%(1) "b"
+  [%b|u%"var3"]=>
   NULL
 }
 
 -- Assign a value to $class2->var3 --
 $key = var3:
-
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
+bool(true)
 $class2:
-object(myClass)#%d (3) {
-  [u"var1"]=>
-  unicode(1) "x"
-  [u"var2"]=>
-  unicode(1) "y"
-  [u"var3"]=>
-  unicode(1) "z"
+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"
 }
 Done
index 44aaee367005ea5d39a4a0dade9a552a193837df..39bb129e39e231fd834e6bd5644d6f41f38e22ca 100644 (file)
@@ -54,39 +54,31 @@ echo "Done";
 
 -- Do not assign a value to $class1->var3 --
 $key = var1:
-
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
+bool(true)
 $key = var2:
-
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
+bool(false)
 $key = var3:
-
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
+bool(false)
 $class1:
 object(myClass)#1 (3) {
-  [u"var1"]=>
-  unicode(1) "a"
-  [u"var2":protected]=>
-  unicode(1) "b"
-  [u"var3":u"myClass":private]=>
+  [%b|u%"var1"]=>
+  %unicode|string%(1) "a"
+  [%b|u%"var2":protected]=>
+  %unicode|string%(1) "b"
+  [%b|u%"var3":%b|u%"myClass":private]=>
   NULL
 }
 
 -- Assign a value to $class2->var3 --
 $key = var3:
-
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
+bool(false)
 $class2:
 object(myClass)#2 (3) {
-  [u"var1"]=>
-  unicode(1) "x"
-  [u"var2":protected]=>
-  unicode(1) "y"
-  [u"var3":u"myClass":private]=>
-  unicode(1) "z"
+  [%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"
 }
 Done
index 1fc9a3d110e5e517316a496e1f983e2859f8f82a..f736356e495e9909cfa8d7a5416b396e42ab660b 100644 (file)
@@ -206,9 +206,7 @@ Warning: array_key_exists() expects parameter 2 to be array, Unicode string give
 NULL
 
 -- Iteration 22 --
-
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
+bool(false)
 
 -- Iteration 23 --
 
index 528bedc34bac44acb815b07507cd7247041f4821..4e0aad084827514923a06424011482890defbbfa 100644 (file)
@@ -28,22 +28,22 @@ echo "Done";
 *** Testing array_push() : error conditions ***
 int(3)
 array(3) {
-  [-2147483647]=>
+  [-%d]=>
   unicode(3) "min"
-  [2147483647]=>
+  [%d]=>
   unicode(3) "max"
-  [-2147483648]=>
+  [-%d]=>
   unicode(3) "new"
 }
 
 Warning: array_push(): Cannot add element to the array as the next element is already occupied in %s on line %d
 bool(false)
 array(3) {
-  [-2147483647]=>
+  [-%d]=>
   unicode(3) "min"
-  [2147483647]=>
+  [%d]=>
   unicode(3) "max"
-  [-2147483648]=>
+  [-%d]=>
   unicode(3) "new"
 }
 Done
index 05c10ac7650ff77e89b1f73e4cd220d86518895a..9da3dfcad6b4d4e27ae548b94000dbf917dd148d 100644 (file)
@@ -17,7 +17,7 @@ var_dump( array_unique() );
 echo "\n-- Testing array_unique() function with more than expected no. of arguments --\n";
 $input = array(1, 2);
 $extra_arg = 10;
-var_dump( array_unique($input, $extra_arg) );
+var_dump( array_unique($input, SORT_NUMERIC, $extra_arg) );
 
 echo "Done";
 ?>
@@ -26,11 +26,11 @@ echo "Done";
 
 -- Testing array_unique() function with zero arguments --
 
-Warning: array_unique() expects exactly 1 parameter, 0 given in %s on line %d
+Warning: array_unique() expects at least 1 parameter, 0 given in %s on line %d
 NULL
 
 -- Testing array_unique() function with more than expected no. of arguments --
 
-Warning: array_unique() expects exactly 1 parameter, 2 given in %s on line %d
+Warning: array_unique() expects at most 2 parameters, 3 given in %s on line %d
 NULL
 Done
index e5fc798291ddf0530e6e3613ec7258cfee0cd996..6e375f2494f041d0491e9f70807fa188c4e2b4b8 100644 (file)
@@ -74,13 +74,13 @@ $inputs = array (
 $iterator = 1;
 foreach($inputs as $input) {
   echo "-- Iteration $iterator --\n";
-  var_dump( array_unique($input) );
+  var_dump( array_unique($input, SORT_STRING) );
   $iterator++;
 }
   
 echo "Done";
 ?>
---EXPECT--
+--EXPECTF--
 *** Testing array_unique() : Passing different arrays to $input argument ***
 -- Iteration 1 --
 array(2) {
@@ -114,38 +114,38 @@ array(1) {
 -- Iteration 6 --
 array(4) {
   [0]=>
-  unicode(3) "a\v\f"
+  %unicode|string%(3) "a\v\f"
   [1]=>
-  unicode(5) "aaaa
+  %unicode|string%(5) "aaaa
 "
   [2]=>
-  unicode(1) "b"
+  %unicode|string%(1) "b"
   [4]=>
-  unicode(27) "\[\]\!\@\#$\%\^\&\*\(\)\{\}"
+  %unicode|string%(27) "\[\]\!\@\#$\%\^\&\*\(\)\{\}"
 }
 -- Iteration 7 --
 array(4) {
   [0]=>
-  unicode(5) "a\v\f"
+  %unicode|string%(5) "a\v\f"
   [1]=>
-  unicode(6) "aaaa\r"
+  %unicode|string%(6) "aaaa\r"
   [2]=>
-  unicode(1) "b"
+  %unicode|string%(1) "b"
   [4]=>
-  unicode(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}"
+  %unicode|string%(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}"
 }
 -- Iteration 8 --
 array(3) {
-  [u"h1"]=>
-  unicode(1) "
+  [%b|u%"h1"]=>
+  %unicode|string%(1) "
 "
-  [u"h2"]=>
-  unicode(88) "hello world
+  [%b|u%"h2"]=>
+  %unicode|string%(88) "hello world
 The quick brown fox jumped over;
 the lazy dog
 This is a double quoted string"
-  [u"h3"]=>
-  unicode(88) "hello
+  [%b|u%"h3"]=>
+  %unicode|string%(88) "hello
  world 
 1111            != 2222\v\v
 heredoc
@@ -154,15 +154,15 @@ double quoted string. with\vdifferent\fwhite\vspaces"
 -- Iteration 9 --
 array(2) {
   [1]=>
-  unicode(3) "one"
+  %unicode|string%(3) "one"
   [2]=>
-  unicode(3) "two"
+  %unicode|string%(3) "two"
 }
 -- Iteration 10 --
 array(2) {
-  [u"one"]=>
+  [%b|u%"one"]=>
   int(1)
-  [u"two"]=>
+  [%b|u%"two"]=>
   int(2)
 }
 -- Iteration 11 --
@@ -176,55 +176,55 @@ array(3) {
 }
 -- Iteration 12 --
 array(2) {
-  [u"one"]=>
-  unicode(3) "ten"
-  [u"two"]=>
-  unicode(6) "twenty"
+  [%b|u%"one"]=>
+  %unicode|string%(3) "ten"
+  [%b|u%"two"]=>
+  %unicode|string%(6) "twenty"
 }
 -- Iteration 13 --
 array(3) {
-  [u"one"]=>
+  [%b|u%"one"]=>
   int(1)
   [2]=>
-  unicode(3) "two"
+  %unicode|string%(3) "two"
   [4]=>
-  unicode(4) "four"
+  %unicode|string%(4) "four"
 }
 -- Iteration 14 --
 array(2) {
-  [u""]=>
-  unicode(4) "null"
-  [u"NULL"]=>
+  [%b|u%""]=>
+  %unicode|string%(4) "null"
+  [%b|u%"NULL"]=>
   NULL
 }
 -- Iteration 15 --
 array(4) {
   [1]=>
-  unicode(4) "true"
+  %unicode|string%(4) "true"
   [0]=>
-  unicode(5) "false"
-  [u"false"]=>
+  %unicode|string%(5) "false"
+  [%b|u%"false"]=>
   bool(false)
-  [u"true"]=>
+  [%b|u%"true"]=>
   bool(true)
 }
 -- Iteration 16 --
 array(2) {
-  [u""]=>
-  unicode(6) "emptys"
-  [u"emptyd"]=>
-  unicode(0) ""
+  [%b|u%""]=>
+  %unicode|string%(6) "emptys"
+  [%b|u%"emptyd"]=>
+  %unicode|string%(0) ""
 }
 -- Iteration 17 --
 array(2) {
   [1]=>
-  unicode(0) ""
+  %unicode|string%(0) ""
   [6]=>
   bool(true)
 }
 -- Iteration 18 --
 array(3) {
-  [u""]=>
+  [%b|u%""]=>
   int(4)
   [0]=>
   int(5)
index 1bd1ad159a4395288b481016eec269090ec453e9..82442bdfad27566654dd5f2093e62f8c69bfd12d 100644 (file)
@@ -29,16 +29,16 @@ $input = array(
   5 => $value4
 );
 
-var_dump( array_unique($input) );
+var_dump( array_unique($input, SORT_STRING) );
 
 echo "Done";
 ?>
---EXPECT--
+--EXPECTF--
 *** Testing array_unique() : array with reference variables for $input argument ***
 array(2) {
   [0]=>
   int(0)
   [1]=>
-  &unicode(5) "hello"
+  &%unicode|string%(5) "hello"
 }
 Done
index f6cbce018f7f8181f16a84150d4ebba23178d1aa..342e760ce8d5e8c81652e78d3708392c1a5e51ea 100644 (file)
@@ -51,7 +51,17 @@ echo "Done"
 ?>
 --EXPECTF--
 *** Testing array_walk() : object functionality ***
+%unicode|string%(18) "%r\0%rMyClass%r\0%rpri_value"
+int(10)
+int(1)
 
-Warning: array_walk() expects parameter 1 to be array, object given in %s on line %d
-NULL
+%unicode|string%(9) "pub_value"
+int(10)
+int(1)
+
+%unicode|string%(12) "%r\0%r*%r\0%rpro_value"
+int(10)
+int(1)
+
+bool(true)
 Done
index 9b7a8167de49d232593247dbd7011b53945e7aa8..506d1cafcfa71fc1d5c4c97402b7398a15ba3561 100644 (file)
@@ -29,9 +29,16 @@ array_walk($var, "walk");
 echo "Done\n";
 ?>
 --EXPECTF--    
-Warning: array_walk() expects parameter 1 to be array, object given in %s on line %d
-
-Warning: array_walk() expects parameter 1 to be array, object given in %s on line %d
-
-Warning: array_walk() expects parameter 1 to be array, Unicode string given in %s on line %d
+%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"
+
+Warning: array_walk() expects parameter 1 to be array, %unicode_string_optional% given in %s on line %d
 Done
index 9e608c1e4ce7b3c73db7ddcf74ac7c676e208aa4..bbd30f37f0d7b569e677be024f67d5c3cd305f5d 100644 (file)
@@ -29,9 +29,16 @@ array_walk_recursive($var, "walk");
 echo "Done\n";
 ?>
 --EXPECTF--    
-Warning: array_walk_recursive() expects parameter 1 to be array, object given in %s on line %d
-
-Warning: array_walk_recursive() expects parameter 1 to be array, object given in %s on line %d
-
-Warning: array_walk_recursive() expects parameter 1 to be array, Unicode string given in %s on line %d
+%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"
+
+Warning: array_walk_recursive() expects parameter 1 to be array, %unicode_string_optional% given in %s on line %d
 Done
index 16a56d37d005fddcfaf5f907d8339e7e2976f992..7ddced7766baf0b20280c1c4816dbea97e6f02f5 100644 (file)
@@ -49,7 +49,17 @@ echo "Done"
 ?>
 --EXPECTF--
 *** Testing array_walk_recursive() : object functionality ***
+%unicode|string%(18) "%r\0%rMyClass%r\0%rpri_value"
+int(10)
+int(1)
 
-Warning: array_walk_recursive() expects parameter 1 to be array, object given in %s on line %d
-NULL
+%unicode|string%(9) "pub_value"
+int(10)
+int(1)
+
+%unicode|string%(12) "%r\0%r*%r\0%rpro_value"
+int(10)
+int(1)
+
+bool(true)
 Done
index dd2b0db077f7dc8e9af97278a6523a8c1d943a20..f82ecd05261b1ff31aa2aeaf79c97ed9827060cb 100644 (file)
@@ -2,7 +2,7 @@
 Bug #44929 (natsort doesn't handle leading zeros well)
 --FILE--
 <?php
-$a = array('001','008','005','00011','03','000014','-123','0.002','00','0');
+$a = array(b'001',b'008',b'005',b'00011',b'03',b'000014',b'-123',b'0.002',b'00',b'0');
 natsort($a);
 var_dump($a);
 ?>