diff options
Diffstat (limited to 'ext/standard/tests/strings')
127 files changed, 112 insertions, 16736 deletions
diff --git a/ext/standard/tests/strings/addslashes_variation1.phpt b/ext/standard/tests/strings/addslashes_variation1.phpt deleted file mode 100644 index e204498ba6..0000000000 --- a/ext/standard/tests/strings/addslashes_variation1.phpt +++ /dev/null @@ -1,171 +0,0 @@ ---TEST-- -Test addslashes() function : usage variations - non-string type argument ---FILE-- -<?php -/* Prototype : string addslashes ( string $str ) - * Description: Returns a string with backslashes before characters that need to be quoted in database queries etc. - * Source code: ext/standard/string.c -*/ - -/* - * Test addslashes() with non-string type argument such as int, float, etc -*/ - -echo "*** Testing addslashes() : with non-string type argument ***\n"; -// initialize all required variables - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// declaring a class -class sample { - public function __toString() { - return "obj'ct"; - } -} - -// Defining resource -$file_handle = fopen(__FILE__, 'r'); - -// array with different values -$values = array ( - - // integer values -/*1*/ 0, - 1, - 12345, - -2345, - - // float values -/*5*/ 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array values -/*10*/ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values -/*15*/ true, - false, - TRUE, - FALSE, - - // empty string -/*19*/ "", - '', - - // undefined variable -/*21*/ $undefined_var, - - // unset variable -/*22*/ $unset_var, - - // objects -/*23*/ new sample(), - - // resource -/*24*/ $file_handle, - -/*25*/ NULL, - null -); - - -// loop through each element of the array and check the working of addslashes() -// when $str argument is supplied with different values -echo "\n--- Testing addslashes() by supplying different values for 'str' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $str = $values [$index]; - - var_dump( addslashes($str) ); - - $counter ++; -} - -// closing the file -fclose($file_handle); - -?> -===DONE=== ---EXPECTF-- -*** Testing addslashes() : with non-string type argument *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - ---- Testing addslashes() by supplying different values for 'str' argument --- --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(5) "12345" --- Iteration 4 -- -string(5) "-2345" --- Iteration 5 -- -string(4) "10.5" --- Iteration 6 -- -string(5) "-10.5" --- Iteration 7 -- -string(12) "101234567000" --- Iteration 8 -- -string(13) "1.07654321E-9" --- Iteration 9 -- -string(3) "0.5" --- Iteration 10 -- - -Warning: addslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: addslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: addslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: addslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: addslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(1) "1" --- Iteration 16 -- -string(0) "" --- Iteration 17 -- -string(1) "1" --- Iteration 18 -- -string(0) "" --- Iteration 19 -- -string(0) "" --- Iteration 20 -- -string(0) "" --- Iteration 21 -- -string(0) "" --- Iteration 22 -- -string(0) "" --- Iteration 23 -- -string(7) "obj\'ct" --- Iteration 24 -- - -Warning: addslashes() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 25 -- -string(0) "" --- Iteration 26 -- -string(0) "" -===DONE=== diff --git a/ext/standard/tests/strings/bin2hex_variation1.phpt b/ext/standard/tests/strings/bin2hex_variation1.phpt deleted file mode 100644 index d7bf15f4f4..0000000000 --- a/ext/standard/tests/strings/bin2hex_variation1.phpt +++ /dev/null @@ -1,128 +0,0 @@ ---TEST-- -Test bin2hex() function : usage variations - test values for $str argument ---FILE-- -<?php - -/* Prototype : string bin2hex ( string $str ) - * Description: Convert binary data into hexadecimal representation - * Source code: ext/standard/string.c -*/ - -echo "*** Testing bin2hex() function: with unexpected inputs for 'str' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - 123456, - - // float values -/*4*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*7*/ array(), - array(0), - array(1, 2), - - // boolean values -/*10*/true, - false, - TRUE, - FALSE, - - // null values -/*14*/NULL, - null, - - // objects -/*16*/new sample(), - - // resource -/*17*/$file_handle, - - // undefined variable -/*18*/@$undefined_var, - - // unset variable -/*19*/@$unset_var -); - -// loop through with each element of the $inputs array to test bin2hex() function -$count = 1; -foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - var_dump(bin2hex($input) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing bin2hex() function: with unexpected inputs for 'str' argument *** --- Iteration 1 -- -string(2) "30" --- Iteration 2 -- -string(2) "31" --- Iteration 3 -- -string(12) "313233343536" --- Iteration 4 -- -string(8) "31302e35" --- Iteration 5 -- -string(10) "2d32302e35" --- Iteration 6 -- -string(24) "313031323334353637303030" --- Iteration 7 -- - -Warning: bin2hex() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 8 -- - -Warning: bin2hex() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 9 -- - -Warning: bin2hex() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 10 -- -string(2) "31" --- Iteration 11 -- -string(0) "" --- Iteration 12 -- -string(2) "31" --- Iteration 13 -- -string(0) "" --- Iteration 14 -- -string(0) "" --- Iteration 15 -- -string(0) "" --- Iteration 16 -- -string(26) "73616d706c65206f626a656374" --- Iteration 17 -- - -Warning: bin2hex() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 18 -- -string(0) "" --- Iteration 19 -- -string(0) "" -===DONE=== diff --git a/ext/standard/tests/strings/bug46578.phpt b/ext/standard/tests/strings/bug46578.phpt index a5eff1dbe2..e07e928597 100644 --- a/ext/standard/tests/strings/bug46578.phpt +++ b/ext/standard/tests/strings/bug46578.phpt @@ -16,7 +16,7 @@ var_dump(strip_tags('<! a>')); var_dump(strip_tags('<? ax')); ?> ---EXPECTF-- +--EXPECT-- string(6) "foobar" string(6) "foobar" string(6) "foobar" diff --git a/ext/standard/tests/strings/bug47443.phpt b/ext/standard/tests/strings/bug47443.phpt index 033aeb4d79..e673e807ee 100644 --- a/ext/standard/tests/strings/bug47443.phpt +++ b/ext/standard/tests/strings/bug47443.phpt @@ -8,7 +8,7 @@ var_dump(metaphone("scrath")); var_dump(metaphone("scratc")); ?> ---EXPECTF-- +--EXPECT-- string(4) "SKRX" string(4) "SKR0" string(5) "SKRTK" diff --git a/ext/standard/tests/strings/bug47481.phpt b/ext/standard/tests/strings/bug47481.phpt index 6cad98ac91..a8f2e028a0 100644 --- a/ext/standard/tests/strings/bug47481.phpt +++ b/ext/standard/tests/strings/bug47481.phpt @@ -21,7 +21,7 @@ var_dump($array); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- -- Before sorting: -- array(6) { [0]=> diff --git a/ext/standard/tests/strings/bug65947.phpt b/ext/standard/tests/strings/bug65947.phpt index a746f96f7a..ff7dbf4b8c 100644 --- a/ext/standard/tests/strings/bug65947.phpt +++ b/ext/standard/tests/strings/bug65947.phpt @@ -1,7 +1,5 @@ --TEST-- Bug #65947 (basename is no more working after fgetcsv in certain situation) ---SKIPIF-- -<?php if (!PHP_ZTS) { print "skip only for zts build"; } --FILE-- <?php $filename = 'test.toto'; diff --git a/ext/standard/tests/strings/bug68996.phpt b/ext/standard/tests/strings/bug68996.phpt index fea1371a32..3f1e6c4929 100644 --- a/ext/standard/tests/strings/bug68996.phpt +++ b/ext/standard/tests/strings/bug68996.phpt @@ -1,10 +1,5 @@ --TEST-- Bug #68996 (Invalid free of CG(interned_empty_string)) ---SKIPIF-- -<?php -if (getenv("USE_ZEND_ALLOC") !== "0") - print "skip Need Zend MM disabled"; -?> --INI-- html_errors=1 --FILE-- diff --git a/ext/standard/tests/strings/bug72434.phpt b/ext/standard/tests/strings/bug72434.phpt index 447ad4609c..6d64baa26f 100644 --- a/ext/standard/tests/strings/bug72434.phpt +++ b/ext/standard/tests/strings/bug72434.phpt @@ -1,9 +1,5 @@ --TEST-- Bug #72434: ZipArchive class Use After Free Vulnerability in PHP's GC algorithm and unserialize ---SKIPIF-- -<?php -if(!class_exists('zip')) die('skip ZipArchive'); -?> --FILE-- <?php // The following array will be serialized and this representation will be freed later on. diff --git a/ext/standard/tests/strings/chop_variation1.phpt b/ext/standard/tests/strings/chop_variation1.phpt deleted file mode 100644 index 51f53f0153..0000000000 --- a/ext/standard/tests/strings/chop_variation1.phpt +++ /dev/null @@ -1,214 +0,0 @@ ---TEST-- -Test chop() function : usage variations - unexpected values for str argument ---FILE-- -<?php -/* Prototype : string chop ( string $str [, string $charlist] ) - * Description: Strip whitespace (or other characters) from the end of a string - * Source code: ext/standard/string.c -*/ - -/* - * Testing chop() : with different unexpected values for $str argument passed to the function -*/ - -echo "*** Testing chop() : with unexpected values for str argument ***\n"; -// initialize all required variables - -$charlist = " @#$%1234567890"; -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// declaring class -class sample { - public function __toString() { - return " @#$%Object @#$%"; - } -} -$sample_obj = new sample; - -// creating a file resource -$file_handle = fopen(__FILE__, 'r'); - -// array with different values -$values = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // float values - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // empty string - "", - '', - - // null values - NULL, - null, - - // undefined variable - $undefined_var, - - // unset variable - $unset_var, - - // object - $sample_obj, - - // resource - $file_handle -); - - -// loop through each element of the array and check the working of chop() -// when $str argument is supplied with different values - -echo "\n--- Testing chop() by supplying different values for 'str' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $str = $values [$index]; - - var_dump( chop($str) ); - var_dump( chop($str, $charlist) ); - - $counter ++; -} - -// closing the resource -fclose( $file_handle); - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing chop() : with unexpected values for str argument *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - ---- Testing chop() by supplying different values for 'str' argument --- --- Iteration 1 -- -string(1) "0" -string(0) "" --- Iteration 2 -- -string(1) "1" -string(0) "" --- Iteration 3 -- -string(5) "12345" -string(0) "" --- Iteration 4 -- -string(5) "-2345" -string(1) "-" --- Iteration 5 -- -string(4) "10.5" -string(3) "10." --- Iteration 6 -- -string(5) "-10.5" -string(4) "-10." --- Iteration 7 -- -string(12) "101234567000" -string(0) "" --- Iteration 8 -- -string(13) "1.07654321E-9" -string(12) "1.07654321E-" --- Iteration 9 -- -string(3) "0.5" -string(2) "0." --- Iteration 10 -- - -Warning: chop() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: chop() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: chop() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: chop() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: chop() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: chop() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: chop() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: chop() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: chop() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: chop() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(1) "1" -string(0) "" --- Iteration 16 -- -string(0) "" -string(0) "" --- Iteration 17 -- -string(1) "1" -string(0) "" --- Iteration 18 -- -string(0) "" -string(0) "" --- Iteration 19 -- -string(0) "" -string(0) "" --- Iteration 20 -- -string(0) "" -string(0) "" --- Iteration 21 -- -string(0) "" -string(0) "" --- Iteration 22 -- -string(0) "" -string(0) "" --- Iteration 23 -- -string(0) "" -string(0) "" --- Iteration 24 -- -string(0) "" -string(0) "" --- Iteration 25 -- -string(16) " @#$%Object @#$%" -string(11) " @#$%Object" --- Iteration 26 -- - -Warning: chop() expects parameter 1 to be string, resource given in %s on line %d -NULL - -Warning: chop() expects parameter 1 to be string, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/chop_variation2.phpt b/ext/standard/tests/strings/chop_variation2.phpt deleted file mode 100644 index cad8ec75f5..0000000000 --- a/ext/standard/tests/strings/chop_variation2.phpt +++ /dev/null @@ -1,175 +0,0 @@ ---TEST-- -Test chop() function : usage variations - unexpected values for charlist argument ---FILE-- -<?php -/* Prototype : string chop ( string $str [, string $charlist] ) - * Description: Strip whitespace (or other characters) from the end of a string - * Source code: ext/standard/string.c -*/ - -/* - * Testing chop() : with different unexpected values for charlist argument passes to the function -*/ - -echo "*** Testing chop() : with different unexpected values for charlist argument ***\n"; -// initialize all required variables -$str = 'hello world12345 '; - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// declaring class -class sample { - public function __toString() { - return "@# $%12345"; - } -} - -// defining a resource -$file_handle = fopen(__FILE__, 'r'); - -// array with different values -$values = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // float values - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // objects - new sample(), - - // empty string - "", - '', - - // null values - NULL, - null, - - // resource - $file_handle, - - // undefined variable - $undefined_var, - - // unset variable - $unset_var - -); - - -// loop through each element of the array and check the working of chop() -// when $charlist argument is supplied with different values - -echo "\n--- Testing chop() by supplying different values for 'charlist' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $charlist = $values [$index]; - - var_dump( chop($str, $charlist) ); - - $counter ++; -} - -// closing the resource -fclose($file_handle); - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing chop() : with different unexpected values for charlist argument *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - ---- Testing chop() by supplying different values for 'charlist' argument --- --- Iteration 1 -- -string(17) "hello world12345 " --- Iteration 2 -- -string(17) "hello world12345 " --- Iteration 3 -- -string(17) "hello world12345 " --- Iteration 4 -- -string(17) "hello world12345 " --- Iteration 5 -- -string(17) "hello world12345 " --- Iteration 6 -- -string(17) "hello world12345 " --- Iteration 7 -- -string(17) "hello world12345 " --- Iteration 8 -- -string(17) "hello world12345 " --- Iteration 9 -- -string(17) "hello world12345 " --- Iteration 10 -- - -Warning: chop() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: chop() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: chop() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: chop() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: chop() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(17) "hello world12345 " --- Iteration 16 -- -string(17) "hello world12345 " --- Iteration 17 -- -string(17) "hello world12345 " --- Iteration 18 -- -string(17) "hello world12345 " --- Iteration 19 -- -string(11) "hello world" --- Iteration 20 -- -string(17) "hello world12345 " --- Iteration 21 -- -string(17) "hello world12345 " --- Iteration 22 -- -string(17) "hello world12345 " --- Iteration 23 -- -string(17) "hello world12345 " --- Iteration 24 -- - -Warning: chop() expects parameter 2 to be string, resource given in %s on line %d -NULL --- Iteration 25 -- -string(17) "hello world12345 " --- Iteration 26 -- -string(17) "hello world12345 " -Done diff --git a/ext/standard/tests/strings/chunk_split_variation1.phpt b/ext/standard/tests/strings/chunk_split_variation1.phpt deleted file mode 100644 index 0b24f9b6d9..0000000000 --- a/ext/standard/tests/strings/chunk_split_variation1.phpt +++ /dev/null @@ -1,169 +0,0 @@ ---TEST-- -Test chunk_split() function : usage variations - with unexpected values for 'str' argument ---FILE-- -<?php -/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]]) - * Description: Returns split line %d%d - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -echo "*** Testing chunk_split() : with unexpected values for 'str' argument ***\n"; - -// Initialising variables -$chunklen = 2; -$ending = ' '; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//class for object variable -class MyClass -{ - public function __toString() - { - return "object"; - } -} - -//resource variable -$fp = fopen(__FILE__, 'r'); - -//different values for 'str' -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // object data - new MyClass(), - - // undefined data - @$undefined_var, - - // unset data - @$unset_var, - - // resource data - $fp -); - -// loop through each element of the array for 'str' -for($count = 0; $count < count($values); $count++) { - echo "-- Iteration ".($count+1)." --\n"; - var_dump( chunk_split($values[$count], $chunklen, $ending) ); -}; - -echo "Done"; - -// close the resource -fclose($fp); - -?> ---EXPECTF-- -*** Testing chunk_split() : with unexpected values for 'str' argument *** --- Iteration 1 -- -string(2) "0 " --- Iteration 2 -- -string(2) "1 " --- Iteration 3 -- -string(8) "12 34 5 " --- Iteration 4 -- -string(8) "-2 34 5 " --- Iteration 5 -- -string(6) "10 .5 " --- Iteration 6 -- -string(8) "-1 0. 5 " --- Iteration 7 -- -string(18) "10 12 34 56 70 00 " --- Iteration 8 -- -string(20) "1. 07 65 43 21 E- 9 " --- Iteration 9 -- -string(5) "0. 5 " --- Iteration 10 -- - -Warning: chunk_split() expects parameter 1 to be string, array given in %s on line 87 -NULL --- Iteration 11 -- - -Warning: chunk_split() expects parameter 1 to be string, array given in %s on line 87 -NULL --- Iteration 12 -- - -Warning: chunk_split() expects parameter 1 to be string, array given in %s on line 87 -NULL --- Iteration 13 -- - -Warning: chunk_split() expects parameter 1 to be string, array given in %s on line 87 -NULL --- Iteration 14 -- - -Warning: chunk_split() expects parameter 1 to be string, array given in %s on line 87 -NULL --- Iteration 15 -- -string(1) " " --- Iteration 16 -- -string(1) " " --- Iteration 17 -- -string(2) "1 " --- Iteration 18 -- -string(1) " " --- Iteration 19 -- -string(2) "1 " --- Iteration 20 -- -string(1) " " --- Iteration 21 -- -string(1) " " --- Iteration 22 -- -string(1) " " --- Iteration 23 -- -string(9) "st ri ng " --- Iteration 24 -- -string(9) "st ri ng " --- Iteration 25 -- -string(9) "ob je ct " --- Iteration 26 -- -string(1) " " --- Iteration 27 -- -string(1) " " --- Iteration 28 -- - -Warning: chunk_split() expects parameter 1 to be string, resource given in %s on line 87 -NULL -Done diff --git a/ext/standard/tests/strings/chunk_split_variation2.phpt b/ext/standard/tests/strings/chunk_split_variation2.phpt deleted file mode 100644 index b5d58b0d00..0000000000 --- a/ext/standard/tests/strings/chunk_split_variation2.phpt +++ /dev/null @@ -1,185 +0,0 @@ ---TEST-- -Test chunk_split() function : usage variations - unexpected values for 'chunklen' argument(Bug#42796) ---SKIPIF-- -<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); ---FILE-- -<?php -/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]]) - * Description: Returns split line - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -echo "*** Testing chunk_split() : with unexpected values for 'chunklen' argument ***\n"; - -// Initialise function arguments -$str = 'This is chuklen variation'; -$ending = '*'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//get resource variable -$fp = fopen(__FILE__, 'r'); - -//Class to get object variable -class MyClass -{ - public function __toString() { - return "object"; - } -} - -//array of values to iterate over -$values = array( - - // float data - 10.5, - -10.5, - (float) PHP_INT_MAX + 1, - (float) -PHP_INT_MAX - 1, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // object data - new MyClass(), - - // undefined data - @$undefined_var, - - // unset data - @$unset_var, - - // resource variable - $fp -); - -// loop through each element of the values for 'chunklen' -for($count = 0; $count < count($values); $count++) { - echo "-- Iteration ".($count+1)." --\n"; - var_dump( chunk_split($str, $values[$count], $ending) ); -} - -//closing resource -fclose($fp); - -?> -===DONE=== ---EXPECTF-- -*** Testing chunk_split() : with unexpected values for 'chunklen' argument *** --- Iteration 1 -- -string(28) "This is ch*uklen vari*ation*" --- Iteration 2 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d -bool(false) --- Iteration 3 -- - -Warning: chunk_split() expects parameter 2 to be int, float given in %s on line %d -NULL --- Iteration 4 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d -bool(false) --- Iteration 5 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d -bool(false) --- Iteration 6 -- - -Warning: chunk_split() expects parameter 2 to be int, array given in %schunk_split_variation2.php on line %d -NULL --- Iteration 7 -- - -Warning: chunk_split() expects parameter 2 to be int, array given in %schunk_split_variation2.php on line %d -NULL --- Iteration 8 -- - -Warning: chunk_split() expects parameter 2 to be int, array given in %schunk_split_variation2.php on line %d -NULL --- Iteration 9 -- - -Warning: chunk_split() expects parameter 2 to be int, array given in %schunk_split_variation2.php on line %d -NULL --- Iteration 10 -- - -Warning: chunk_split() expects parameter 2 to be int, array given in %schunk_split_variation2.php on line %d -NULL --- Iteration 11 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d -bool(false) --- Iteration 12 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d -bool(false) --- Iteration 13 -- -string(50) "T*h*i*s* *i*s* *c*h*u*k*l*e*n* *v*a*r*i*a*t*i*o*n*" --- Iteration 14 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d -bool(false) --- Iteration 15 -- -string(50) "T*h*i*s* *i*s* *c*h*u*k*l*e*n* *v*a*r*i*a*t*i*o*n*" --- Iteration 16 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d -bool(false) --- Iteration 17 -- - -Warning: chunk_split() expects parameter 2 to be int, string given in %schunk_split_variation2.php on line %d -NULL --- Iteration 18 -- - -Warning: chunk_split() expects parameter 2 to be int, string given in %schunk_split_variation2.php on line %d -NULL --- Iteration 19 -- - -Warning: chunk_split() expects parameter 2 to be int, string given in %schunk_split_variation2.php on line %d -NULL --- Iteration 20 -- - -Warning: chunk_split() expects parameter 2 to be int, string given in %schunk_split_variation2.php on line %d -NULL --- Iteration 21 -- - -Warning: chunk_split() expects parameter 2 to be int, object given in %schunk_split_variation2.php on line %d -NULL --- Iteration 22 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d -bool(false) --- Iteration 23 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d -bool(false) --- Iteration 24 -- - -Warning: chunk_split() expects parameter 2 to be int, resource given in %schunk_split_variation2.php on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/strings/chunk_split_variation3.phpt b/ext/standard/tests/strings/chunk_split_variation3.phpt deleted file mode 100644 index 791535371f..0000000000 --- a/ext/standard/tests/strings/chunk_split_variation3.phpt +++ /dev/null @@ -1,160 +0,0 @@ ---TEST-- -Test chunk_split() function : usage variations - unexpected values for 'ending' argument ---FILE-- -<?php -/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]]) - * Description: Returns split line - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -echo "*** Testing chunk_split() : unexpected values for 'ending' ***\n"; - -// Initializing variables -$str = 'This is simple string.'; -$chunklen = 4.9; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//resource variable -$fp = fopen(__FILE__,'r'); - -//Class to get object variable -class MyClass -{ - public function __toString() - { - return "object"; - } -} - -//different values for 'ending' -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.123456e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new MyClass(), - - // undefined data - @$undefined_var, - - // unset data - @$unset_var, - - // resource data - $fp -); - -// loop through each element of values for 'ending' -for($count = 0; $count < count($values); $count++) { - echo "-- Iteration ".($count+1)." --\n"; - var_dump( chunk_split($str, $chunklen, $values[$count]) ); -} - -echo "Done"; - -//closing resource -fclose($fp); -?> ---EXPECTF-- -*** Testing chunk_split() : unexpected values for 'ending' *** --- Iteration 1 -- -string(28) "This0 is 0simp0le s0trin0g.0" --- Iteration 2 -- -string(28) "This1 is 1simp1le s1trin1g.1" --- Iteration 3 -- -string(52) "This12345 is 12345simp12345le s12345trin12345g.12345" --- Iteration 4 -- -string(52) "This-2345 is -2345simp-2345le s-2345trin-2345g.-2345" --- Iteration 5 -- -string(46) "This10.5 is 10.5simp10.5le s10.5trin10.5g.10.5" --- Iteration 6 -- -string(52) "This-10.5 is -10.5simp-10.5le s-10.5trin-10.5g.-10.5" --- Iteration 7 -- -string(94) "This101234560000 is 101234560000simp101234560000le s101234560000trin101234560000g.101234560000" --- Iteration 8 -- -string(100) "This1.07654321E-9 is 1.07654321E-9simp1.07654321E-9le s1.07654321E-9trin1.07654321E-9g.1.07654321E-9" --- Iteration 9 -- -string(40) "This0.5 is 0.5simp0.5le s0.5trin0.5g.0.5" --- Iteration 10 -- - -Warning: chunk_split() expects parameter 3 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: chunk_split() expects parameter 3 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: chunk_split() expects parameter 3 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: chunk_split() expects parameter 3 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: chunk_split() expects parameter 3 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(22) "This is simple string." --- Iteration 16 -- -string(22) "This is simple string." --- Iteration 17 -- -string(28) "This1 is 1simp1le s1trin1g.1" --- Iteration 18 -- -string(22) "This is simple string." --- Iteration 19 -- -string(28) "This1 is 1simp1le s1trin1g.1" --- Iteration 20 -- -string(22) "This is simple string." --- Iteration 21 -- -string(22) "This is simple string." --- Iteration 22 -- -string(22) "This is simple string." --- Iteration 23 -- -string(58) "Thisobject is objectsimpobjectle sobjecttrinobjectg.object" --- Iteration 24 -- -string(22) "This is simple string." --- Iteration 25 -- -string(22) "This is simple string." --- Iteration 26 -- - -Warning: chunk_split() expects parameter 3 to be string, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/convert_cyr_string_variation1.phpt b/ext/standard/tests/strings/convert_cyr_string_variation1.phpt deleted file mode 100644 index 89cb6ccc4b..0000000000 --- a/ext/standard/tests/strings/convert_cyr_string_variation1.phpt +++ /dev/null @@ -1,139 +0,0 @@ ---TEST-- -Test convert_cyr_string() function : usage variations - test values for $str argument ---FILE-- -<?php - -/* Prototype : string convert_cyr_string ( string $str , string $from , string $to ) - * Description: Convert from one Cyrillic character set to another - * Source code: ext/standard/string.c -*/ - -echo "*** Testing convert_cyr_string() function: with unexpected inputs for 'str' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $str -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $inputs array to test convert_cyr_string() function -$count = 1; -$from = "w"; -$to = "k"; -foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - var_dump( convert_cyr_string($input, $from, $to) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing convert_cyr_string() function: with unexpected inputs for 'str' argument *** --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(3) "255" --- Iteration 4 -- -string(3) "256" --- Iteration 5 -- -string(10) "2147483647" --- Iteration 6 -- -string(11) "-2147483648" --- Iteration 7 -- -string(4) "10.5" --- Iteration 8 -- -string(5) "-20.5" --- Iteration 9 -- -string(12) "101234567000" --- Iteration 10 -- - -Warning: convert_cyr_string() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: convert_cyr_string() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: convert_cyr_string() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -string(1) "1" --- Iteration 14 -- -string(0) "" --- Iteration 15 -- -string(1) "1" --- Iteration 16 -- -string(0) "" --- Iteration 17 -- -string(0) "" --- Iteration 18 -- -string(0) "" --- Iteration 19 -- -string(13) "sample object" --- Iteration 20 -- - -Warning: convert_cyr_string() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- -string(0) "" --- Iteration 22 -- -string(0) "" -===DONE=== diff --git a/ext/standard/tests/strings/convert_uudecode_variation1.phpt b/ext/standard/tests/strings/convert_uudecode_variation1.phpt deleted file mode 100644 index 4c66f076a5..0000000000 --- a/ext/standard/tests/strings/convert_uudecode_variation1.phpt +++ /dev/null @@ -1,161 +0,0 @@ ---TEST-- -Test convert_uudecode() function : usage variations - test values for $data argument ---FILE-- -<?php - -/* Prototype : string convert_uudecode ( string $data ) - * Description: Decode a uuencoded string - * Source code: ext/standard/uuencode.c -*/ - -echo "*** Testing convert_uudecode() function: with unexpected inputs for 'data' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $data -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $data array to test convert_uudecode() function -$count = 1; -foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - var_dump( convert_uudecode($input) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing convert_uudecode() function: with unexpected inputs for 'data' argument *** --- Iteration 1 -- - -Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d -bool(false) --- Iteration 7 -- - -Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d -bool(false) --- Iteration 8 -- - -Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d -bool(false) --- Iteration 9 -- - -Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d -bool(false) --- Iteration 10 -- - -Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d -bool(false) --- Iteration 11 -- - -Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d -bool(false) --- Iteration 12 -- - -Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d -bool(false) --- Iteration 13 -- - -Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d -bool(false) --- Iteration 14 -- -bool(false) --- Iteration 15 -- - -Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d -bool(false) --- Iteration 16 -- -bool(false) --- Iteration 17 -- -bool(false) --- Iteration 18 -- -bool(false) --- Iteration 19 -- - -Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d -bool(false) --- Iteration 20 -- - -Warning: convert_uudecode() expects parameter 1 to be string, resource given in %s on line %d -bool(false) --- Iteration 21 -- -bool(false) --- Iteration 22 -- -bool(false) -===DONE=== diff --git a/ext/standard/tests/strings/convert_uuencode_variation1.phpt b/ext/standard/tests/strings/convert_uuencode_variation1.phpt deleted file mode 100644 index c9ef4335be..0000000000 --- a/ext/standard/tests/strings/convert_uuencode_variation1.phpt +++ /dev/null @@ -1,137 +0,0 @@ ---TEST-- -Test convert_uuencode() function : usage variations - test values for $data argument ---FILE-- -<?php - -/* Prototype : string convert_uuencode ( string $data ) - * Description: Uuencode a string - * Source code: ext/standard/uuencode.c -*/ - -echo "*** Testing convert_uuencode() function: with unexpected inputs for 'data' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $data -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $data array to test convert_uuencode() function -$count = 1; -foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - var_dump( bin2hex(convert_uuencode($input)) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing convert_uuencode() function: with unexpected inputs for 'data' argument *** --- Iteration 1 -- -string(16) "212c6060600a600a" --- Iteration 2 -- -string(16) "212c3060600a600a" --- Iteration 3 -- -string(16) "232c4334550a600a" --- Iteration 4 -- -string(16) "232c4334560a600a" --- Iteration 5 -- -string(40) "2a2c4324542d5330582c5338542d5060600a600a" --- Iteration 6 -- -string(40) "2b2b3328512d233c542e232c562d2340600a600a" --- Iteration 7 -- -string(24) "242c33604e2d3060600a600a" --- Iteration 8 -- -string(24) "252b3328502b4334600a600a" --- Iteration 9 -- -string(40) "2c2c3360512c432c542d3338572c2360500a600a" --- Iteration 10 -- - -Warning: convert_uuencode() expects parameter 1 to be string, array given in %s on line %d -string(0) "" --- Iteration 11 -- - -Warning: convert_uuencode() expects parameter 1 to be string, array given in %s on line %d -string(0) "" --- Iteration 12 -- - -Warning: convert_uuencode() expects parameter 1 to be string, array given in %s on line %d -string(0) "" --- Iteration 13 -- -string(16) "212c3060600a600a" --- Iteration 14 -- -string(0) "" --- Iteration 15 -- -string(16) "212c3060600a600a" --- Iteration 16 -- -string(0) "" --- Iteration 17 -- -string(0) "" --- Iteration 18 -- -string(0) "" --- Iteration 19 -- -string(48) "2d3c56254d3c26514528265d423a4635433d6060600a600a" --- Iteration 20 -- - -Warning: convert_uuencode() expects parameter 1 to be string, resource given in %s on line %d -string(0) "" --- Iteration 21 -- -string(0) "" --- Iteration 22 -- -string(0) "" -===DONE=== diff --git a/ext/standard/tests/strings/count_chars_variation1.phpt b/ext/standard/tests/strings/count_chars_variation1.phpt deleted file mode 100644 index 9e78219dbe..0000000000 --- a/ext/standard/tests/strings/count_chars_variation1.phpt +++ /dev/null @@ -1,262 +0,0 @@ ---TEST-- -Test count_chars() function : usage variations - test values for $string argument ---FILE-- -<?php - -/* Prototype : mixed count_chars ( string $string [, int $mode ] ) - * Description: Return information about characters used in a string - * Source code: ext/standard/string.c -*/ - -echo "*** Testing count_chars() function: with unexpected inputs for 'string' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$inputs = array ( - - // integer values -/* 1 */ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/* 7 */ 10.5, - -20.5, - 10.1234567e10, - - // array values -/* 10 */ array(), - array(0), - array(1, 2), - - // boolean values -/* 13 */ true, - false, - TRUE, - FALSE, - - // null values -/* 17 */ NULL, - null, - - // objects -/* 19 */ new sample(), - - // resource -/* 20 */ $file_handle, - - // undefined variable -/* 21 */ @$undefined_var, - - // unset variable -/* 22 */ @$unset_var -); - -// loop through with each element of the $inputs array to test count_chars() function -$count = 1; -foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - // only list characters with a frequency > 0 - var_dump(count_chars($input, 1)); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing count_chars() function: with unexpected inputs for 'string' argument *** --- Iteration 1 -- -array(1) { - [48]=> - int(1) -} --- Iteration 2 -- -array(1) { - [49]=> - int(1) -} --- Iteration 3 -- -array(2) { - [50]=> - int(1) - [53]=> - int(2) -} --- Iteration 4 -- -array(3) { - [50]=> - int(1) - [53]=> - int(1) - [54]=> - int(1) -} --- Iteration 5 -- -array(7) { - [49]=> - int(1) - [50]=> - int(1) - [51]=> - int(1) - [52]=> - int(3) - [54]=> - int(1) - [55]=> - int(2) - [56]=> - int(1) -} --- Iteration 6 -- -array(8) { - [45]=> - int(1) - [49]=> - int(1) - [50]=> - int(1) - [51]=> - int(1) - [52]=> - int(3) - [54]=> - int(1) - [55]=> - int(1) - [56]=> - int(2) -} --- Iteration 7 -- -array(4) { - [46]=> - int(1) - [48]=> - int(1) - [49]=> - int(1) - [53]=> - int(1) -} --- Iteration 8 -- -array(5) { - [45]=> - int(1) - [46]=> - int(1) - [48]=> - int(1) - [50]=> - int(1) - [53]=> - int(1) -} --- Iteration 9 -- -array(8) { - [48]=> - int(4) - [49]=> - int(2) - [50]=> - int(1) - [51]=> - int(1) - [52]=> - int(1) - [53]=> - int(1) - [54]=> - int(1) - [55]=> - int(1) -} --- Iteration 10 -- - -Warning: count_chars() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: count_chars() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: count_chars() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -array(1) { - [49]=> - int(1) -} --- Iteration 14 -- -array(0) { -} --- Iteration 15 -- -array(1) { - [49]=> - int(1) -} --- Iteration 16 -- -array(0) { -} --- Iteration 17 -- -array(0) { -} --- Iteration 18 -- -array(0) { -} --- Iteration 19 -- -array(12) { - [32]=> - int(1) - [97]=> - int(1) - [98]=> - int(1) - [99]=> - int(1) - [101]=> - int(2) - [106]=> - int(1) - [108]=> - int(1) - [109]=> - int(1) - [111]=> - int(1) - [112]=> - int(1) - [115]=> - int(1) - [116]=> - int(1) -} --- Iteration 20 -- - -Warning: count_chars() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- -array(0) { -} --- Iteration 22 -- -array(0) { -} -===DONE=== diff --git a/ext/standard/tests/strings/count_chars_variation2.phpt b/ext/standard/tests/strings/count_chars_variation2.phpt deleted file mode 100644 index 986312a930..0000000000 --- a/ext/standard/tests/strings/count_chars_variation2.phpt +++ /dev/null @@ -1,164 +0,0 @@ ---TEST-- -Test count_chars() function : usage variations - test values for $mode argument ---SKIPIF-- -<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); ---FILE-- -<?php - -/* Prototype : mixed count_chars ( string $string [, int $mode ] ) - * Description: Return information about characters used in a string - * Source code: ext/standard/string.c -*/ - -echo "*** Testing count_chars() function: with unexpected inputs for 'mode' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { -} - -// array with different values for $input -$inputs = array ( - - // integer values -/* 1 */ 0, - 1, - 255, - 2147483647, - -2147483648, - - // float values -/* 6 */ 0.0, - 1.3, - 10.5, - -20.5, - 10.1234567e10, - - // array values -/* 11 */ array(), - array(1, 2, 3, 4, 5, 6, 7, 8, 9), - - // boolean values -/* 14 */ true, - false, - TRUE, - FALSE, - - // null values -/* 18 */ NULL, - null, - - // string values -/* 20 */ "ABCD", - 'abcd', - "1ABC", - "5ABC", - - // objects -/* 24 */ new sample(), - - // undefined variable -/* 25 */ @$undefined_var, - - // unset variable -/* 26 */ @$unset_var -); - -// loop through with each element of the $inputs array to test count_chars() function -// with unexepcted values for the 'mode' argument -$count = 1; -$string = "Return information about characters used in a string"; -foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - // only list characters with a frequency > 0 - var_dump(is_array(count_chars($string, $input))); - $count ++; -} - - -?> -===DONE=== ---EXPECTF-- -*** Testing count_chars() function: with unexpected inputs for 'mode' argument *** --- Iteration 1 -- -bool(true) --- Iteration 2 -- -bool(true) --- Iteration 3 -- - -Warning: count_chars(): Unknown mode in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: count_chars(): Unknown mode in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: count_chars(): Unknown mode in %s on line %d -bool(false) --- Iteration 6 -- -bool(true) --- Iteration 7 -- -bool(true) --- Iteration 8 -- - -Warning: count_chars(): Unknown mode in %s on line %d -bool(false) --- Iteration 9 -- - -Warning: count_chars(): Unknown mode in %s on line %d -bool(false) --- Iteration 10 -- - -Warning: count_chars(): Unknown mode in %s on line %d -bool(false) --- Iteration 11 -- - -Warning: count_chars() expects parameter 2 to be int, array given in %s on line %d -bool(false) --- Iteration 12 -- - -Warning: count_chars() expects parameter 2 to be int, array given in %s on line %d -bool(false) --- Iteration 13 -- -bool(true) --- Iteration 14 -- -bool(true) --- Iteration 15 -- -bool(true) --- Iteration 16 -- -bool(true) --- Iteration 17 -- -bool(true) --- Iteration 18 -- -bool(true) --- Iteration 19 -- - -Warning: count_chars() expects parameter 2 to be int, string given in %s on line %d -bool(false) --- Iteration 20 -- - -Warning: count_chars() expects parameter 2 to be int, string given in %s on line %d -bool(false) --- Iteration 21 -- - -Notice: A non well formed numeric value encountered in %s on line %d -bool(true) --- Iteration 22 -- - -Notice: A non well formed numeric value encountered in %s on line %d - -Warning: count_chars(): Unknown mode in %s on line %d -bool(false) --- Iteration 23 -- - -Warning: count_chars() expects parameter 2 to be int, object given in %s on line %d -bool(false) --- Iteration 24 -- -bool(true) --- Iteration 25 -- -bool(true) -===DONE=== diff --git a/ext/standard/tests/strings/crc32_variation1.phpt b/ext/standard/tests/strings/crc32_variation1.phpt deleted file mode 100644 index 21d3fbe0dc..0000000000 --- a/ext/standard/tests/strings/crc32_variation1.phpt +++ /dev/null @@ -1,196 +0,0 @@ ---TEST-- -Test crc32() function : usage variations - unexpected values ---SKIPIF-- -<?php -if (PHP_INT_SIZE != 4) - die("skip this test is for 32bit platform only"); -?> ---FILE-- -<?php -/* Prototype : string crc32(string $str) - * Description: Calculate the crc32 polynomial of a string - * Source code: ext/standard/crc32.c - * Alias to functions: none -*/ - -/* - * Testing crc32() : with unexpected values for str argument -*/ - -echo "*** Testing crc32() : with unexpected values for str argument ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// declaring class -class sample { - public function __toString() { - return "object"; - } -} - -// creating a file resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new sample(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, - - // resource - $file_handle -); - -// loop through each element of the array for str - -$count = 1; -foreach($values as $value) { - echo "\n-- Iteration $count --\n"; - var_dump( crc32($value) ); - $count++; -}; - -// closing the resource -fclose($file_handle); - -echo "Done"; -?> ---EXPECTF-- -*** Testing crc32() : with unexpected values for str argument *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - --- Iteration 1 -- -int(-186917087) - --- Iteration 2 -- -int(-2082672713) - --- Iteration 3 -- -int(-873121252) - --- Iteration 4 -- -int(1860518047) - --- Iteration 5 -- -int(269248583) - --- Iteration 6 -- -int(-834950157) - --- Iteration 7 -- -int(-965354630) - --- Iteration 8 -- -int(1376932222) - --- Iteration 9 -- -int(-2036403827) - --- Iteration 10 -- - -Warning: crc32() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: crc32() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 12 -- - -Warning: crc32() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 13 -- - -Warning: crc32() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 14 -- - -Warning: crc32() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 15 -- -int(0) - --- Iteration 16 -- -int(0) - --- Iteration 17 -- -int(-2082672713) - --- Iteration 18 -- -int(0) - --- Iteration 19 -- -int(-2082672713) - --- Iteration 20 -- -int(0) - --- Iteration 21 -- -int(0) - --- Iteration 22 -- -int(0) - --- Iteration 23 -- -int(-1465013268) - --- Iteration 24 -- -int(0) - --- Iteration 25 -- -int(0) - --- Iteration 26 -- - -Warning: crc32() expects parameter 1 to be string, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/explode_variation1.phpt b/ext/standard/tests/strings/explode_variation1.phpt deleted file mode 100644 index 7ced1dc822..0000000000 --- a/ext/standard/tests/strings/explode_variation1.phpt +++ /dev/null @@ -1,193 +0,0 @@ ---TEST-- -Test explode() function : usage variations - test values for $delimiter argument ---FILE-- -<?php - -/* Prototype : array explode ( string $delimiter , string $string [, int $limit ] ) - * Description: Split a string by string. - * Source code: ext/standard/string.c -*/ - -echo "*** Testing explode() function: with unexpected inputs for 'delimiter' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $delimiter -$delimiters = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $delimiters array to test explode() function -$count = 1; -$string = "piece1 piece2 piece3 piece4 piece5 piece6"; -$limit = 5; -foreach($delimiters as $delimiter) { - echo "-- Iteration $count --\n"; - var_dump( explode($delimiter, $string, $limit) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing explode() function: with unexpected inputs for 'delimiter' argument *** --- Iteration 1 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 2 -- -array(2) { - [0]=> - string(5) "piece" - [1]=> - string(35) " piece2 piece3 piece4 piece5 piece6" -} --- Iteration 3 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 4 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 5 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 6 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 7 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 8 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 9 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 10 -- - -Warning: explode() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: explode() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: explode() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -array(2) { - [0]=> - string(5) "piece" - [1]=> - string(35) " piece2 piece3 piece4 piece5 piece6" -} --- Iteration 14 -- - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) --- Iteration 15 -- -array(2) { - [0]=> - string(5) "piece" - [1]=> - string(35) " piece2 piece3 piece4 piece5 piece6" -} --- Iteration 16 -- - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) --- Iteration 17 -- - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) --- Iteration 18 -- - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) --- Iteration 19 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 20 -- - -Warning: explode() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) --- Iteration 22 -- - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) -===DONE=== diff --git a/ext/standard/tests/strings/explode_variation2.phpt b/ext/standard/tests/strings/explode_variation2.phpt deleted file mode 100644 index 9377f30842..0000000000 --- a/ext/standard/tests/strings/explode_variation2.phpt +++ /dev/null @@ -1,195 +0,0 @@ ---TEST-- -Test explode() function : usage variations - test values for $string argument ---FILE-- -<?php - -/* Prototype : array explode ( string $delimiter , string $string [, int $limit ] ) - * Description: Split a string by string. - * Source code: ext/standard/string.c -*/ - -echo "*** Testing explode() function: with unexpected inputs for 'string' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $string -$strings = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $strings array to test explode() function -$count = 1; -$delimiter = " "; -$limit = 5; -foreach($strings as $string) { - echo "-- Iteration $count --\n"; - var_dump( explode($delimiter, $string, $limit) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing explode() function: with unexpected inputs for 'string' argument *** --- Iteration 1 -- -array(1) { - [0]=> - string(1) "0" -} --- Iteration 2 -- -array(1) { - [0]=> - string(1) "1" -} --- Iteration 3 -- -array(1) { - [0]=> - string(3) "255" -} --- Iteration 4 -- -array(1) { - [0]=> - string(3) "256" -} --- Iteration 5 -- -array(1) { - [0]=> - string(10) "2147483647" -} --- Iteration 6 -- -array(1) { - [0]=> - string(11) "-2147483648" -} --- Iteration 7 -- -array(1) { - [0]=> - string(4) "10.5" -} --- Iteration 8 -- -array(1) { - [0]=> - string(5) "-20.5" -} --- Iteration 9 -- -array(1) { - [0]=> - string(12) "101234567000" -} --- Iteration 10 -- - -Warning: explode() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: explode() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: explode() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -array(1) { - [0]=> - string(1) "1" -} --- Iteration 14 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 15 -- -array(1) { - [0]=> - string(1) "1" -} --- Iteration 16 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 17 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 18 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 19 -- -array(2) { - [0]=> - string(6) "sample" - [1]=> - string(6) "object" -} --- Iteration 20 -- - -Warning: explode() expects parameter 2 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 22 -- -array(1) { - [0]=> - string(0) "" -} -===DONE=== diff --git a/ext/standard/tests/strings/explode_variation3.phpt b/ext/standard/tests/strings/explode_variation3.phpt deleted file mode 100644 index 34c1cdffc3..0000000000 --- a/ext/standard/tests/strings/explode_variation3.phpt +++ /dev/null @@ -1,238 +0,0 @@ ---TEST-- -Test explode() function : usage variations - test values for $limit argument ---FILE-- -<?php - -/* Prototype : array explode ( string $delimiter , string $string [, int $limit ] ) - * Description: Split a string by string. - * Source code: ext/standard/string.c -*/ - -echo "*** Testing explode() function: with unexpected inputs for 'limit' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $delimiter -$limits = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e5, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $limits array to test explode() function -$count = 1; -$delimiter = " "; -$string = "piece1 piece2 piece3 piece4 piece5 piece6"; -foreach($limits as $limit) { - echo "-- Iteration $count --\n"; - var_dump( explode($delimiter, $string, $limit) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===Done=== ---EXPECTF-- -*** Testing explode() function: with unexpected inputs for 'limit' argument *** --- Iteration 1 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 2 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 3 -- -array(6) { - [0]=> - string(6) "piece1" - [1]=> - string(6) "piece2" - [2]=> - string(6) "piece3" - [3]=> - string(6) "piece4" - [4]=> - string(6) "piece5" - [5]=> - string(6) "piece6" -} --- Iteration 4 -- -array(6) { - [0]=> - string(6) "piece1" - [1]=> - string(6) "piece2" - [2]=> - string(6) "piece3" - [3]=> - string(6) "piece4" - [4]=> - string(6) "piece5" - [5]=> - string(6) "piece6" -} --- Iteration 5 -- -array(6) { - [0]=> - string(6) "piece1" - [1]=> - string(6) "piece2" - [2]=> - string(6) "piece3" - [3]=> - string(6) "piece4" - [4]=> - string(6) "piece5" - [5]=> - string(6) "piece6" -} --- Iteration 6 -- -array(0) { -} --- Iteration 7 -- -array(6) { - [0]=> - string(6) "piece1" - [1]=> - string(6) "piece2" - [2]=> - string(6) "piece3" - [3]=> - string(6) "piece4" - [4]=> - string(6) "piece5" - [5]=> - string(6) "piece6" -} --- Iteration 8 -- -array(0) { -} --- Iteration 9 -- -array(6) { - [0]=> - string(6) "piece1" - [1]=> - string(6) "piece2" - [2]=> - string(6) "piece3" - [3]=> - string(6) "piece4" - [4]=> - string(6) "piece5" - [5]=> - string(6) "piece6" -} --- Iteration 10 -- - -Warning: explode() expects parameter 3 to be int, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: explode() expects parameter 3 to be int, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: explode() expects parameter 3 to be int, array given in %s on line %d -NULL --- Iteration 13 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 14 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 15 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 16 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 17 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 18 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 19 -- - -Warning: explode() expects parameter 3 to be int, object given in %s on line %d -NULL --- Iteration 20 -- - -Warning: explode() expects parameter 3 to be int, resource given in %s on line %d -NULL --- Iteration 21 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 22 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} -===Done=== diff --git a/ext/standard/tests/strings/fprintf_variation_001.phpt b/ext/standard/tests/strings/fprintf_variation_001.phpt index 3a935107a7..df81c249b6 100644 --- a/ext/standard/tests/strings/fprintf_variation_001.phpt +++ b/ext/standard/tests/strings/fprintf_variation_001.phpt @@ -1,12 +1,5 @@ --TEST-- Test fprintf() function (variation - 1) ---SKIPIF-- -<?php -$data_file = dirname(__FILE__) . '/dump.txt'; -if (!($fp = fopen($data_file, 'w'))) { - die('skip File dump.txt could not be created'); -} -?> --FILE-- <?php @@ -14,7 +7,7 @@ $float_variation = array( "%f","%-f", "%+f", "%7.2f", "%-7.2f", "%07.2f", "%-07. $float_numbers = array( 0, 1, -1, 0.32, -0.32, 3.4. -3.4, 2.54, -2.54 ); /* creating dumping file */ -$data_file = dirname(__FILE__) . '/dump.txt'; +$data_file = dirname(__FILE__) . '/fprintf_variation_001.txt'; if (!($fp = fopen($data_file, 'wt'))) return; diff --git a/ext/standard/tests/strings/fprintf_variation_002.phpt b/ext/standard/tests/strings/fprintf_variation_002.phpt index 49e62e2b74..1cc1a4ddd7 100644 --- a/ext/standard/tests/strings/fprintf_variation_002.phpt +++ b/ext/standard/tests/strings/fprintf_variation_002.phpt @@ -1,12 +1,5 @@ --TEST-- Test fprintf() function (variation - 2) ---SKIPIF-- -<?php -$data_file = dirname(__FILE__) . '/dump.txt'; -if (!($fp = fopen($data_file, 'w'))) { - die('skip File dump.txt could not be created'); -} -?> --FILE-- <?php @@ -14,7 +7,7 @@ $int_variation = array( "%d", "%-d", "%+d", "%7.2d", "%-7.2d", "%07.2d", "%-07.2 $int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" ); /* creating dumping file */ -$data_file = dirname(__FILE__) . '/dump.txt'; +$data_file = dirname(__FILE__) . '/fprintf_variation_002.txt'; if (!($fp = fopen($data_file, 'wt'))) return; diff --git a/ext/standard/tests/strings/fprintf_variation_003.phpt b/ext/standard/tests/strings/fprintf_variation_003.phpt index b4860879b0..1e8eb4706f 100644 --- a/ext/standard/tests/strings/fprintf_variation_003.phpt +++ b/ext/standard/tests/strings/fprintf_variation_003.phpt @@ -2,10 +2,6 @@ Test fprintf() function (variation - 3) --SKIPIF-- <?php -$data_file = dirname(__FILE__) . '/dump.txt'; -if (!($fp = fopen($data_file, 'w'))) { - die('skip File dump.txt could not be created'); -} if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?> --FILE-- @@ -14,7 +10,7 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); $int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" ); /* creating dumping file */ -$data_file = dirname(__FILE__) . '/dump.txt'; +$data_file = dirname(__FILE__) . '/fprintf_variation_003.txt'; if (!($fp = fopen($data_file, 'wt'))) return; diff --git a/ext/standard/tests/strings/fprintf_variation_003_64bit.phpt b/ext/standard/tests/strings/fprintf_variation_003_64bit.phpt index ba8e525c3f..26db7ab18b 100644 --- a/ext/standard/tests/strings/fprintf_variation_003_64bit.phpt +++ b/ext/standard/tests/strings/fprintf_variation_003_64bit.phpt @@ -2,10 +2,6 @@ Test fprintf() function (variation - 3) --SKIPIF-- <?php -$data_file = dirname(__FILE__) . '/dump.txt'; -if (!($fp = fopen($data_file, 'w'))) { - die('skip File dump.txt could not be created'); -} if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- @@ -14,7 +10,7 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); $int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" ); /* creating dumping file */ -$data_file = dirname(__FILE__) . '/dump.txt'; +$data_file = dirname(__FILE__) . '/fprintf_variation_003_64bit.txt'; if (!($fp = fopen($data_file, 'wt'))) return; diff --git a/ext/standard/tests/strings/fprintf_variation_004.phpt b/ext/standard/tests/strings/fprintf_variation_004.phpt Binary files differindex 5502b6d7c0..aa47a298d8 100644 --- a/ext/standard/tests/strings/fprintf_variation_004.phpt +++ b/ext/standard/tests/strings/fprintf_variation_004.phpt diff --git a/ext/standard/tests/strings/fprintf_variation_005.phpt b/ext/standard/tests/strings/fprintf_variation_005.phpt index 0967b77cd8..0be2cb6847 100644 --- a/ext/standard/tests/strings/fprintf_variation_005.phpt +++ b/ext/standard/tests/strings/fprintf_variation_005.phpt @@ -1,19 +1,12 @@ --TEST-- Test fprintf() function (variation - 5) ---SKIPIF-- -<?php -$data_file = dirname(__FILE__) . '/dump.txt'; -if (!($fp = fopen($data_file, 'w'))) { - die('skip File dump.txt could not be created'); -} -?> --FILE-- <?php $int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" ); /* creating dumping file */ -$data_file = dirname(__FILE__) . '/dump.txt'; +$data_file = dirname(__FILE__) . '/fprintf_variation_005.txt'; if (!($fp = fopen($data_file, 'wt'))) return; diff --git a/ext/standard/tests/strings/fprintf_variation_006.phpt b/ext/standard/tests/strings/fprintf_variation_006.phpt index 8a66fb9fb4..b48720c2d5 100644 --- a/ext/standard/tests/strings/fprintf_variation_006.phpt +++ b/ext/standard/tests/strings/fprintf_variation_006.phpt @@ -2,10 +2,6 @@ Test fprintf() function (variation - 6) --SKIPIF-- <?php -$data_file = dirname(__FILE__) . '/dump.txt'; -if (!($fp = fopen($data_file, 'w'))) { - die('skip File dump.txt could not be created'); -} if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?> --FILE-- @@ -14,7 +10,7 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); $int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" ); /* creating dumping file */ -$data_file = dirname(__FILE__) . '/dump.txt'; +$data_file = dirname(__FILE__) . '/fprintf_variation_006.txt'; if (!($fp = fopen($data_file, 'wt'))) return; diff --git a/ext/standard/tests/strings/fprintf_variation_006_64bit.phpt b/ext/standard/tests/strings/fprintf_variation_006_64bit.phpt index fe4cc91dd7..92ab010d03 100644 --- a/ext/standard/tests/strings/fprintf_variation_006_64bit.phpt +++ b/ext/standard/tests/strings/fprintf_variation_006_64bit.phpt @@ -2,10 +2,6 @@ Test fprintf() function (variation - 6) --SKIPIF-- <?php -$data_file = dirname(__FILE__) . '/dump.txt'; -if (!($fp = fopen($data_file, 'w'))) { - die('skip File dump.txt could not be created'); -} if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- @@ -14,7 +10,7 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); $int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" ); /* creating dumping file */ -$data_file = dirname(__FILE__) . '/dump.txt'; +$data_file = dirname(__FILE__) . '/fprintf_variation_006_64bit.txt'; if (!($fp = fopen($data_file, 'wt'))) return; diff --git a/ext/standard/tests/strings/fprintf_variation_007.phpt b/ext/standard/tests/strings/fprintf_variation_007.phpt index 16d39bbde3..f2653a1ee1 100644 --- a/ext/standard/tests/strings/fprintf_variation_007.phpt +++ b/ext/standard/tests/strings/fprintf_variation_007.phpt @@ -2,10 +2,6 @@ Test fprintf() function (variation - 7) --SKIPIF-- <?php -$data_file = dirname(__FILE__) . '/dump.txt'; -if (!($fp = fopen($data_file, 'w'))) { - die('skip File dump.txt could not be created'); -} if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?> --FILE-- @@ -14,7 +10,7 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); $int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" ); /* creating dumping file */ -$data_file = dirname(__FILE__) . '/dump.txt'; +$data_file = dirname(__FILE__) . '/fprintf_variation_007.txt'; if (!($fp = fopen($data_file, 'wt'))) return; diff --git a/ext/standard/tests/strings/fprintf_variation_007_64bit.phpt b/ext/standard/tests/strings/fprintf_variation_007_64bit.phpt index 55cd946a3b..9e30f91639 100644 --- a/ext/standard/tests/strings/fprintf_variation_007_64bit.phpt +++ b/ext/standard/tests/strings/fprintf_variation_007_64bit.phpt @@ -2,10 +2,6 @@ Test fprintf() function (variation - 7) --SKIPIF-- <?php -$data_file = dirname(__FILE__) . '/dump.txt'; -if (!($fp = fopen($data_file, 'w'))) { - die('skip File dump.txt could not be created'); -} if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- @@ -14,7 +10,7 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); $int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" ); /* creating dumping file */ -$data_file = dirname(__FILE__) . '/dump.txt'; +$data_file = dirname(__FILE__) . '/fprintf_variation_007_64bit.txt'; if (!($fp = fopen($data_file, 'wt'))) return; diff --git a/ext/standard/tests/strings/fprintf_variation_008.phpt b/ext/standard/tests/strings/fprintf_variation_008.phpt index d2187c7ccd..e8c0a9e412 100644 --- a/ext/standard/tests/strings/fprintf_variation_008.phpt +++ b/ext/standard/tests/strings/fprintf_variation_008.phpt @@ -2,10 +2,6 @@ Test fprintf() function (variation - 8) --SKIPIF-- <?php -$data_file = dirname(__FILE__) . '/dump.txt'; -if (!($fp = fopen($data_file, 'w'))) { - die('skip File dump.txt could not be created'); -} if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?> --FILE-- @@ -15,7 +11,7 @@ $int_variation = array( "%d", "%-d", "%+d", "%7.2d", "%-7.2d", "%07.2d", "%-07.2 $int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" ); /* creating dumping file */ -$data_file = dirname(__FILE__) . '/dump.txt'; +$data_file = dirname(__FILE__) . '/fprintf_variation_008.txt'; if (!($fp = fopen($data_file, 'wt'))) return; diff --git a/ext/standard/tests/strings/fprintf_variation_008_64bit.phpt b/ext/standard/tests/strings/fprintf_variation_008_64bit.phpt index 9d326a91c1..661f2711f3 100644 --- a/ext/standard/tests/strings/fprintf_variation_008_64bit.phpt +++ b/ext/standard/tests/strings/fprintf_variation_008_64bit.phpt @@ -2,10 +2,6 @@ Test fprintf() function (variation - 8) --SKIPIF-- <?php -$data_file = dirname(__FILE__) . '/dump.txt'; -if (!($fp = fopen($data_file, 'w'))) { - die('skip File dump.txt could not be created'); -} if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- @@ -15,7 +11,7 @@ $int_variation = array( "%d", "%-d", "%+d", "%7.2d", "%-7.2d", "%07.2d", "%-07.2 $int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" ); /* creating dumping file */ -$data_file = dirname(__FILE__) . '/dump.txt'; +$data_file = dirname(__FILE__) . '/fprintf_variation_008_64bit.txt'; if (!($fp = fopen($data_file, 'wt'))) return; diff --git a/ext/standard/tests/strings/fprintf_variation_009.phpt b/ext/standard/tests/strings/fprintf_variation_009.phpt index e36c0e8c0f..c16623ba8f 100644 --- a/ext/standard/tests/strings/fprintf_variation_009.phpt +++ b/ext/standard/tests/strings/fprintf_variation_009.phpt @@ -1,12 +1,5 @@ --TEST-- Test fprintf() function (variation - 9) ---SKIPIF-- -<?php -$data_file = dirname(__FILE__) . '/dump.txt'; -if (!($fp = fopen($data_file, 'w'))) { - die('skip File dump.txt could not be created'); -} -?> --FILE-- <?php @@ -14,7 +7,7 @@ $string_variation = array( "%5s", "%-5s", "%05s", "%'#5s" ); $strings = array( NULL, "abc", 'aaa' ); /* creating dumping file */ -$data_file = dirname(__FILE__) . '/dump.txt'; +$data_file = dirname(__FILE__) . '/fprintf_variation_009.txt'; if (!($fp = fopen($data_file, 'wt'))) return; diff --git a/ext/standard/tests/strings/get_html_translation_table_variation1.phpt b/ext/standard/tests/strings/get_html_translation_table_variation1.phpt deleted file mode 100644 index 0794853e8e..0000000000 --- a/ext/standard/tests/strings/get_html_translation_table_variation1.phpt +++ /dev/null @@ -1,316 +0,0 @@ ---TEST-- -Test get_html_translation_table() function : usage variations - unexpected table values ---FILE-- -<?php -/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style [, string charset_hint]]] ) - * Description: Returns the internal translation table used by htmlspecialchars and htmlentities - * Source code: ext/standard/html.c -*/ - -/* - * test get_html_translation_table() with unexpected value for argument $table -*/ - -echo "*** Testing get_html_translation_table() : usage variations ***\n"; -// initialize all required variables -$quote_style = ENT_COMPAT; - -// get an unset variable -$unset_var = 10; -unset($unset_var); - -// a resource variable -$fp = fopen(__FILE__, "r"); - -// array with different values -$values = array ( - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // string values - "string", - 'string', - - // objects - new stdclass(), - - // empty string - "", - '', - - // null values - NULL, - null, - - // resource var - $fp, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - - -// loop through each element of the array and check the working of get_html_translation_table() -// when $table argument is supplied with different values -echo "\n--- Testing get_html_translation_table() by supplying different values for 'table' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $table = $values [$index]; - - $v = get_html_translation_table($table, ENT_COMPAT, "UTF-8"); - if (is_array($v) && count($v) > 100) - var_dump(count($v)); - elseif (is_array($v)) { - asort($v); - var_dump($v); - } else { - var_dump($v); - } - - $v = get_html_translation_table($table, $quote_style, "UTF-8"); - if (is_array($v) && count($v) > 100) - var_dump(count($v)); - elseif (is_array($v)) { - asort($v); - var_dump($v); - } else { - var_dump($v); - } - - $counter ++; -} - -// close resource -fclose($fp); - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing get_html_translation_table() : usage variations *** - ---- Testing get_html_translation_table() by supplying different values for 'table' argument --- --- Iteration 1 -- - -Warning: get_html_translation_table() expects parameter 1 to be int, array given in %s on line %d -NULL - -Warning: get_html_translation_table() expects parameter 1 to be int, array given in %s on line %d -NULL --- Iteration 2 -- - -Warning: get_html_translation_table() expects parameter 1 to be int, array given in %s on line %d -NULL - -Warning: get_html_translation_table() expects parameter 1 to be int, array given in %s on line %d -NULL --- Iteration 3 -- - -Warning: get_html_translation_table() expects parameter 1 to be int, array given in %s on line %d -NULL - -Warning: get_html_translation_table() expects parameter 1 to be int, array given in %s on line %d -NULL --- Iteration 4 -- - -Warning: get_html_translation_table() expects parameter 1 to be int, array given in %s on line %d -NULL - -Warning: get_html_translation_table() expects parameter 1 to be int, array given in %s on line %d -NULL --- Iteration 5 -- - -Warning: get_html_translation_table() expects parameter 1 to be int, array given in %s on line %d -NULL - -Warning: get_html_translation_table() expects parameter 1 to be int, array given in %s on line %d -NULL --- Iteration 6 -- -int(252) -int(252) --- Iteration 7 -- -array(4) { - ["&"]=> - string(5) "&" - [">"]=> - string(4) ">" - ["<"]=> - string(4) "<" - ["""]=> - string(6) """ -} -array(4) { - ["&"]=> - string(5) "&" - [">"]=> - string(4) ">" - ["<"]=> - string(4) "<" - ["""]=> - string(6) """ -} --- Iteration 8 -- -int(252) -int(252) --- Iteration 9 -- -array(4) { - ["&"]=> - string(5) "&" - [">"]=> - string(4) ">" - ["<"]=> - string(4) "<" - ["""]=> - string(6) """ -} -array(4) { - ["&"]=> - string(5) "&" - [">"]=> - string(4) ">" - ["<"]=> - string(4) "<" - ["""]=> - string(6) """ -} --- Iteration 10 -- - -Warning: get_html_translation_table() expects parameter 1 to be int, string given in %s on line %d -NULL - -Warning: get_html_translation_table() expects parameter 1 to be int, string given in %s on line %d -NULL --- Iteration 11 -- - -Warning: get_html_translation_table() expects parameter 1 to be int, string given in %s on line %d -NULL - -Warning: get_html_translation_table() expects parameter 1 to be int, string given in %s on line %d -NULL --- Iteration 12 -- - -Warning: get_html_translation_table() expects parameter 1 to be int, object given in %s on line %d -NULL - -Warning: get_html_translation_table() expects parameter 1 to be int, object given in %s on line %d -NULL --- Iteration 13 -- - -Warning: get_html_translation_table() expects parameter 1 to be int, string given in %s on line %d -NULL - -Warning: get_html_translation_table() expects parameter 1 to be int, string given in %s on line %d -NULL --- Iteration 14 -- - -Warning: get_html_translation_table() expects parameter 1 to be int, string given in %s on line %d -NULL - -Warning: get_html_translation_table() expects parameter 1 to be int, string given in %s on line %d -NULL --- Iteration 15 -- -array(4) { - ["&"]=> - string(5) "&" - [">"]=> - string(4) ">" - ["<"]=> - string(4) "<" - ["""]=> - string(6) """ -} -array(4) { - ["&"]=> - string(5) "&" - [">"]=> - string(4) ">" - ["<"]=> - string(4) "<" - ["""]=> - string(6) """ -} --- Iteration 16 -- -array(4) { - ["&"]=> - string(5) "&" - [">"]=> - string(4) ">" - ["<"]=> - string(4) "<" - ["""]=> - string(6) """ -} -array(4) { - ["&"]=> - string(5) "&" - [">"]=> - string(4) ">" - ["<"]=> - string(4) "<" - ["""]=> - string(6) """ -} --- Iteration 17 -- - -Warning: get_html_translation_table() expects parameter 1 to be int, resource given in %s on line %d -NULL - -Warning: get_html_translation_table() expects parameter 1 to be int, resource given in %s on line %d -NULL --- Iteration 18 -- -array(4) { - ["&"]=> - string(5) "&" - [">"]=> - string(4) ">" - ["<"]=> - string(4) "<" - ["""]=> - string(6) """ -} -array(4) { - ["&"]=> - string(5) "&" - [">"]=> - string(4) ">" - ["<"]=> - string(4) "<" - ["""]=> - string(6) """ -} --- Iteration 19 -- -array(4) { - ["&"]=> - string(5) "&" - [">"]=> - string(4) ">" - ["<"]=> - string(4) "<" - ["""]=> - string(6) """ -} -array(4) { - ["&"]=> - string(5) "&" - [">"]=> - string(4) ">" - ["<"]=> - string(4) "<" - ["""]=> - string(6) """ -} -Done diff --git a/ext/standard/tests/strings/get_html_translation_table_variation2.phpt b/ext/standard/tests/strings/get_html_translation_table_variation2.phpt deleted file mode 100644 index 8d9fe0af56..0000000000 --- a/ext/standard/tests/strings/get_html_translation_table_variation2.phpt +++ /dev/null @@ -1,209 +0,0 @@ ---TEST-- -Test get_html_translation_table() function : usage variations - unexpected quote_style values ---FILE-- -<?php -/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style [, string charset_hint]]] ) - * Description: Returns the internal translation table used by htmlspecialchars and htmlentities - * Source code: ext/standard/html.c -*/ - -/* - * test get_html_translation_table() with unexpteced value for argument $quote_style -*/ - -//set locale to en_US.UTF-8 -setlocale(LC_ALL, "en_US.UTF-8"); - -echo "*** Testing get_html_translation_table() : usage variations ***\n"; -// initialize all required variables -$table = HTML_SPECIALCHARS; - -// get an unset variable -$unset_var = 10; -unset($unset_var); - -// a resource var -$fp = fopen(__FILE__, "r"); - -// array with different values -$values = array ( - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // string values - "string", - 'string', - - // objects - new stdclass(), - - // empty string - "", - '', - - // null values - NULL, - null, - - // resource var - $fp, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - - -// loop through each element of the array and check the working of get_html_translation_table() -// when $quote_style argument is supplied with different values -echo "\n--- Testing get_html_translation_table() by supplying different values for 'quote_style' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $quote_style = $values [$index]; - - var_dump( get_html_translation_table($table, $quote_style) ); - - $counter ++; -} - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing get_html_translation_table() : usage variations *** - ---- Testing get_html_translation_table() by supplying different values for 'quote_style' argument --- --- Iteration 1 -- - -Warning: get_html_translation_table() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 2 -- - -Warning: get_html_translation_table() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 3 -- - -Warning: get_html_translation_table() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 4 -- - -Warning: get_html_translation_table() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 5 -- - -Warning: get_html_translation_table() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 6 -- -array(4) { - ["&"]=> - string(5) "&" - ["'"]=> - string(6) "'" - ["<"]=> - string(4) "<" - [">"]=> - string(4) ">" -} --- Iteration 7 -- -array(3) { - ["&"]=> - string(5) "&" - ["<"]=> - string(4) "<" - [">"]=> - string(4) ">" -} --- Iteration 8 -- -array(4) { - ["&"]=> - string(5) "&" - ["'"]=> - string(6) "'" - ["<"]=> - string(4) "<" - [">"]=> - string(4) ">" -} --- Iteration 9 -- -array(3) { - ["&"]=> - string(5) "&" - ["<"]=> - string(4) "<" - [">"]=> - string(4) ">" -} --- Iteration 10 -- - -Warning: get_html_translation_table() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 11 -- - -Warning: get_html_translation_table() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 12 -- - -Warning: get_html_translation_table() expects parameter 2 to be int, object given in %s on line %d -NULL --- Iteration 13 -- - -Warning: get_html_translation_table() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 14 -- - -Warning: get_html_translation_table() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 15 -- -array(3) { - ["&"]=> - string(5) "&" - ["<"]=> - string(4) "<" - [">"]=> - string(4) ">" -} --- Iteration 16 -- -array(3) { - ["&"]=> - string(5) "&" - ["<"]=> - string(4) "<" - [">"]=> - string(4) ">" -} --- Iteration 17 -- - -Warning: get_html_translation_table() expects parameter 2 to be int, resource given in %s on line %d -NULL --- Iteration 18 -- -array(3) { - ["&"]=> - string(5) "&" - ["<"]=> - string(4) "<" - [">"]=> - string(4) ">" -} --- Iteration 19 -- -array(3) { - ["&"]=> - string(5) "&" - ["<"]=> - string(4) "<" - [">"]=> - string(4) ">" -} -Done diff --git a/ext/standard/tests/strings/hebrev_variation1.phpt b/ext/standard/tests/strings/hebrev_variation1.phpt deleted file mode 100644 index 33fd974eb7..0000000000 --- a/ext/standard/tests/strings/hebrev_variation1.phpt +++ /dev/null @@ -1,182 +0,0 @@ ---TEST-- -Test hebrev() function : usage variations - test values for $hebrew_text argument ---FILE-- -<?php - -/* Prototype : string hebrev ( string $hebrew_text [, int $max_chars_per_line ] ) - * Description: Convert logical Hebrew text to visual text - * Source code: ext/standard/string.c -*/ - -echo "*** Testing hebrev() function: with unexpected inputs for 'hebrew_text' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $hebrew_text -$texts = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e5, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var, - - // text with parentheses - 'text with parentheses (', - 'text with parentheses )', - - // text with brackets - 'text with bracket [', - 'text with bracket ]', - - // text with curly brackets - 'text with curly bracket {', - 'text with curly bracket }', - - // text with backslash escape - 'text with backslash escape \\', - - // text with a slash char - 'text with a slash char /', - - // text with a greater than char - 'text with a greater than char >', - - // text with a less than char - 'text with a less than char <' -); - -// loop through with each element of the $texts array to test hebrev() function -$count = 1; - -foreach($texts as $hebrew_text) { - echo "-- Iteration $count --\n"; - var_dump( hebrev($hebrew_text) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing hebrev() function: with unexpected inputs for 'hebrew_text' argument *** --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(3) "255" --- Iteration 4 -- -string(3) "256" --- Iteration 5 -- -string(10) "2147483647" --- Iteration 6 -- -string(11) "-2147483648" --- Iteration 7 -- -string(4) "10.5" --- Iteration 8 -- -string(5) "-20.5" --- Iteration 9 -- -string(10) "1012345.67" --- Iteration 10 -- - -Warning: hebrev() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: hebrev() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: hebrev() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -string(1) "1" --- Iteration 14 -- -bool(false) --- Iteration 15 -- -string(1) "1" --- Iteration 16 -- -bool(false) --- Iteration 17 -- -bool(false) --- Iteration 18 -- -bool(false) --- Iteration 19 -- -string(13) "sample object" --- Iteration 20 -- - -Warning: hebrev() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- -bool(false) --- Iteration 22 -- -bool(false) --- Iteration 23 -- -string(23) ") text with parentheses" --- Iteration 24 -- -string(23) "( text with parentheses" --- Iteration 25 -- -string(19) "] text with bracket" --- Iteration 26 -- -string(19) "[ text with bracket" --- Iteration 27 -- -string(25) "} text with curly bracket" --- Iteration 28 -- -string(25) "{ text with curly bracket" --- Iteration 29 -- -string(28) "/ text with backslash escape" --- Iteration 30 -- -string(24) "text with a slash char /" --- Iteration 31 -- -string(31) "< text with a greater than char" --- Iteration 32 -- -string(28) "> text with a less than char" -===DONE=== diff --git a/ext/standard/tests/strings/hebrev_variation2.phpt b/ext/standard/tests/strings/hebrev_variation2.phpt deleted file mode 100644 index f312472c82..0000000000 --- a/ext/standard/tests/strings/hebrev_variation2.phpt +++ /dev/null @@ -1,283 +0,0 @@ ---TEST-- -Test hebrev() function : usage variations - test values for $max_chars_per_line argument ---FILE-- -<?php - -/* Prototype : string hebrev ( string $hebrew_text [, int $max_chars_per_line ] ) - * Description: Convert logical Hebrew text to visual text - * Source code: ext/standard/string.c -*/ - -echo "*** Testing hebrev() function: with unexpected inputs for 'max_chars_per_line' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $max_chars_per_line -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e5, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // string values -/*19*/ "abc", - 'abc', - "3abc", - "0abc", - "0x3", - - // objects -/*24*/ new sample(), - - // resource -/*25*/ $file_handle, - - // undefined variable -/*26*/ @$undefined_var, - - // unset variable -/*27*/ @$unset_var -); - -// loop through with each element of the $texts array to test hebrev() function -$count = 1; - -$hebrew_text = "The hebrev function converts logical Hebrew text to visual text.\nThe function tries to avoid breaking words.\n"; - -foreach($inputs as $max_chars_per_line) { - echo "-- Iteration $count --\n"; - var_dump( hebrev($hebrew_text, $max_chars_per_line) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing hebrev() function: with unexpected inputs for 'max_chars_per_line' argument *** --- Iteration 1 -- -string(109) ".The hebrev function converts logical Hebrew text to visual text -.The function tries to avoid breaking words -" --- Iteration 2 -- -string(109) "xttel uaisv -tot ext -ewbrHel cagilos rtveonc -ontincfuv reebh -he.Ts -rdwog inakreb -idvoa -tos ietrn ioctunf -he.T -" --- Iteration 3 -- -string(109) ".The hebrev function converts logical Hebrew text to visual text -.The function tries to avoid breaking words -" --- Iteration 4 -- -string(109) ".The hebrev function converts logical Hebrew text to visual text -.The function tries to avoid breaking words -" --- Iteration 5 -- -string(109) ".The hebrev function converts logical Hebrew text to visual text -.The function tries to avoid breaking words -" --- Iteration 6 -- -string(109) "txet -lausiv -ot -txet -werbeH -lacigol -strevnoc -noitcnuf -verbeh -ehT. -sdrow -gnikaerb -diova -ot -seirt -noitcnuf -ehT. -" --- Iteration 7 -- -string(109) "text -to visual -text -Hebrew -logical -converts -function -hebrev -.The -words -breaking -to avoid -tries -function -.The -" --- Iteration 8 -- -string(109) "txet -lausiv -ot -txet -werbeH -lacigol -strevnoc -noitcnuf -verbeh -ehT. -sdrow -gnikaerb -diova -ot -seirt -noitcnuf -ehT. -" --- Iteration 9 -- -string(109) ".The hebrev function converts logical Hebrew text to visual text -.The function tries to avoid breaking words -" --- Iteration 10 -- - -Warning: hebrev() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: hebrev() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: hebrev() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 13 -- -string(109) "xttel uaisv -tot ext -ewbrHel cagilos rtveonc -ontincfuv reebh -he.Ts -rdwog inakreb -idvoa -tos ietrn ioctunf -he.T -" --- Iteration 14 -- -string(109) ".The hebrev function converts logical Hebrew text to visual text -.The function tries to avoid breaking words -" --- Iteration 15 -- -string(109) "xttel uaisv -tot ext -ewbrHel cagilos rtveonc -ontincfuv reebh -he.Ts -rdwog inakreb -idvoa -tos ietrn ioctunf -he.T -" --- Iteration 16 -- -string(109) ".The hebrev function converts logical Hebrew text to visual text -.The function tries to avoid breaking words -" --- Iteration 17 -- -string(109) ".The hebrev function converts logical Hebrew text to visual text -.The function tries to avoid breaking words -" --- Iteration 18 -- -string(109) ".The hebrev function converts logical Hebrew text to visual text -.The function tries to avoid breaking words -" --- Iteration 19 -- - -Warning: hebrev() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 20 -- - -Warning: hebrev() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 21 -- - -Notice: A non well formed numeric value encountered in %s on line %d -string(109) "textual vis -to -textrew Heb -icallog -ertsconvion unctf -brevhe -.Therds -wo -kingbreaoid av -to -riest -tionfuncThe . -" --- Iteration 22 -- - -Notice: A non well formed numeric value encountered in %s on line %d -string(109) ".The hebrev function converts logical Hebrew text to visual text -.The function tries to avoid breaking words -" --- Iteration 23 -- - -Notice: A non well formed numeric value encountered in %s on line %d -string(109) ".The hebrev function converts logical Hebrew text to visual text -.The function tries to avoid breaking words -" --- Iteration 24 -- - -Warning: hebrev() expects parameter 2 to be int, object given in %s on line %d -NULL --- Iteration 25 -- - -Warning: hebrev() expects parameter 2 to be int, resource given in %s on line %d -NULL --- Iteration 26 -- -string(109) ".The hebrev function converts logical Hebrew text to visual text -.The function tries to avoid breaking words -" --- Iteration 27 -- -string(109) ".The hebrev function converts logical Hebrew text to visual text -.The function tries to avoid breaking words -" -===DONE=== diff --git a/ext/standard/tests/strings/hebrevc_variation1.phpt b/ext/standard/tests/strings/hebrevc_variation1.phpt deleted file mode 100644 index c16780e769..0000000000 --- a/ext/standard/tests/strings/hebrevc_variation1.phpt +++ /dev/null @@ -1,138 +0,0 @@ ---TEST-- -Test hebrevc() function : usage variations - test values for $hebrew_text argument ---FILE-- -<?php - -/* Prototype : string hebrevc ( string $hebrew_text [, int $max_chars_per_line ] ) - * Description: Convert logical Hebrew text to visual text - * Source code: ext/standard/string.c -*/ - -echo "*** Testing hebrevc() function: with unexpected inputs for 'hebrew_text' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $hebrew_text -$texts = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e5, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $texts array to test hebrevc() function -$count = 1; - -foreach($texts as $hebrew_text) { - echo "-- Iteration $count --\n"; - var_dump( hebrevc($hebrew_text) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing hebrevc() function: with unexpected inputs for 'hebrew_text' argument *** --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(3) "255" --- Iteration 4 -- -string(3) "256" --- Iteration 5 -- -string(10) "2147483647" --- Iteration 6 -- -string(11) "-2147483648" --- Iteration 7 -- -string(4) "10.5" --- Iteration 8 -- -string(5) "-20.5" --- Iteration 9 -- -string(10) "1012345.67" --- Iteration 10 -- - -Warning: hebrevc() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: hebrevc() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: hebrevc() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -string(1) "1" --- Iteration 14 -- -bool(false) --- Iteration 15 -- -string(1) "1" --- Iteration 16 -- -bool(false) --- Iteration 17 -- -bool(false) --- Iteration 18 -- -bool(false) --- Iteration 19 -- -string(13) "sample object" --- Iteration 20 -- - -Warning: hebrevc() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- -bool(false) --- Iteration 22 -- -bool(false) -===DONE=== diff --git a/ext/standard/tests/strings/hebrevc_variation2.phpt b/ext/standard/tests/strings/hebrevc_variation2.phpt deleted file mode 100644 index 334d128989..0000000000 --- a/ext/standard/tests/strings/hebrevc_variation2.phpt +++ /dev/null @@ -1,414 +0,0 @@ ---TEST-- -Test hebrevc() function : usage variations - test values for $max_chars_per_line argument ---FILE-- -<?php - -/* Prototype : string hebrevc ( string $hebrew_text [, int $max_chars_per_line ] ) - * Description: Convert logical Hebrew text to visual text - * Source code: ext/standard/string.c -*/ - -echo "*** Testing hebrevc() function: with unexpected inputs for 'max_chars_per_line' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $max_chars_per_line -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e5, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // string values -/*19*/ "abc", - 'abc', - "3abc", - "0abc", - "0x3", - - // objects -/*24*/ new sample(), - - // resource -/*25*/ $file_handle, - - // undefined variable -/*26*/ @$undefined_var, - - // unset variable -/*27*/ @$unset_var -); - -// loop through with each element of the $texts array to test hebrevc() function -$count = 1; - -$hebrew_text = "The hebrevcc function converts logical Hebrew text to visual text.\nThis function is similar to hebrevc() with the difference that it converts newlines (\n) to '<br>\n'.\nThe function tries to avoid breaking words.\n"; - -foreach($inputs as $max_chars_per_line) { - echo "-- Iteration $count --\n"; - var_dump( hebrevc($hebrew_text, $max_chars_per_line) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing hebrevc() function: with unexpected inputs for 'max_chars_per_line' argument *** --- Iteration 1 -- -string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br /> -) This function is similar to hebrevc() with the difference that it converts newlines<br /> -<to '<br (<br /> -.'<br /> -.The function tries to avoid breaking words<br /> -" --- Iteration 2 -- -string(331) "xttel uaisv<br /> -tot ext<br /> -ewbrHel cagilos rtveonc<br /> -ontincfuc vcreebh<br /> -he.Ts<br /> -neliewn<br /> -tsernvcot i<br /> -atthe ncrefeifd<br /> -het<br /> -thwi) c(evbrheo t<br /> -arilims<br /> -isn ioctunf<br /> -isTh) (<br /> -r <b'<br /> -to<<br /> -.'s<br /> -rdwog inakreb<br /> -idvoa<br /> -tos ietrn ioctunf<br /> -he.T<br /> -" --- Iteration 3 -- -string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br /> -) This function is similar to hebrevc() with the difference that it converts newlines<br /> -<to '<br (<br /> -.'<br /> -.The function tries to avoid breaking words<br /> -" --- Iteration 4 -- -string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br /> -) This function is similar to hebrevc() with the difference that it converts newlines<br /> -<to '<br (<br /> -.'<br /> -.The function tries to avoid breaking words<br /> -" --- Iteration 5 -- -string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br /> -) This function is similar to hebrevc() with the difference that it converts newlines<br /> -<to '<br (<br /> -.'<br /> -.The function tries to avoid breaking words<br /> -" --- Iteration 6 -- -string(421) "txet<br /> -lausiv<br /> -ot<br /> -txet<br /> -werbeH<br /> -lacigol<br /> -strevnoc<br /> -noitcnuf<br /> -ccverbeh<br /> -ehT.<br /> -senilwen<br /> -strevnoc<br /> -ti<br /> -taht<br /> -ecnereffid<br /> -eht<br /> -htiw<br /> -)(cverbeh<br /> -ot<br /> -ralimis<br /> -si<br /> -noitcnuf<br /> -sihT<br /> -)<br /> -(<br /> -rb<'<br /> -ot<<br /> -'.<br /> -sdrow<br /> -gnikaerb<br /> -diova<br /> -ot<br /> -seirt<br /> -noitcnuf<br /> -ehT.<br /> -" --- Iteration 7 -- -string(373) "text<br /> -to visual<br /> -text<br /> -Hebrew<br /> -logical<br /> -converts<br /> -function<br /> -hebrevcc<br /> -.The<br /> -newlines<br /> -converts<br /> -that it<br /> -difference<br /> -with the<br /> -hebrevc()<br /> -similar to<br /> -is<br /> -function<br /> -) This<br /> -<to '<br (<br /> -.'<br /> -words<br /> -breaking<br /> -to avoid<br /> -tries<br /> -function<br /> -.The<br /> -" --- Iteration 8 -- -string(421) "txet<br /> -lausiv<br /> -ot<br /> -txet<br /> -werbeH<br /> -lacigol<br /> -strevnoc<br /> -noitcnuf<br /> -ccverbeh<br /> -ehT.<br /> -senilwen<br /> -strevnoc<br /> -ti<br /> -taht<br /> -ecnereffid<br /> -eht<br /> -htiw<br /> -)(cverbeh<br /> -ot<br /> -ralimis<br /> -si<br /> -noitcnuf<br /> -sihT<br /> -)<br /> -(<br /> -rb<'<br /> -ot<<br /> -'.<br /> -sdrow<br /> -gnikaerb<br /> -diova<br /> -ot<br /> -seirt<br /> -noitcnuf<br /> -ehT.<br /> -" --- Iteration 9 -- -string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br /> -) This function is similar to hebrevc() with the difference that it converts newlines<br /> -<to '<br (<br /> -.'<br /> -.The function tries to avoid breaking words<br /> -" --- Iteration 10 -- - -Warning: hebrevc() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: hebrevc() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: hebrevc() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 13 -- -string(331) "xttel uaisv<br /> -tot ext<br /> -ewbrHel cagilos rtveonc<br /> -ontincfuc vcreebh<br /> -he.Ts<br /> -neliewn<br /> -tsernvcot i<br /> -atthe ncrefeifd<br /> -het<br /> -thwi) c(evbrheo t<br /> -arilims<br /> -isn ioctunf<br /> -isTh) (<br /> -r <b'<br /> -to<<br /> -.'s<br /> -rdwog inakreb<br /> -idvoa<br /> -tos ietrn ioctunf<br /> -he.T<br /> -" --- Iteration 14 -- -string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br /> -) This function is similar to hebrevc() with the difference that it converts newlines<br /> -<to '<br (<br /> -.'<br /> -.The function tries to avoid breaking words<br /> -" --- Iteration 15 -- -string(331) "xttel uaisv<br /> -tot ext<br /> -ewbrHel cagilos rtveonc<br /> -ontincfuc vcreebh<br /> -he.Ts<br /> -neliewn<br /> -tsernvcot i<br /> -atthe ncrefeifd<br /> -het<br /> -thwi) c(evbrheo t<br /> -arilims<br /> -isn ioctunf<br /> -isTh) (<br /> -r <b'<br /> -to<<br /> -.'s<br /> -rdwog inakreb<br /> -idvoa<br /> -tos ietrn ioctunf<br /> -he.T<br /> -" --- Iteration 16 -- -string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br /> -) This function is similar to hebrevc() with the difference that it converts newlines<br /> -<to '<br (<br /> -.'<br /> -.The function tries to avoid breaking words<br /> -" --- Iteration 17 -- -string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br /> -) This function is similar to hebrevc() with the difference that it converts newlines<br /> -<to '<br (<br /> -.'<br /> -.The function tries to avoid breaking words<br /> -" --- Iteration 18 -- -string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br /> -) This function is similar to hebrevc() with the difference that it converts newlines<br /> -<to '<br (<br /> -.'<br /> -.The function tries to avoid breaking words<br /> -" --- Iteration 19 -- - -Warning: hebrevc() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 20 -- - -Warning: hebrevc() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 21 -- - -Notice: A non well formed numeric value encountered in %s on line %d -string(349) "textual vis<br /> -to<br /> -textrew Heb<br /> -icallog<br /> -ertsconvion unctf<br /> -evcchebrThe .<br /> -inesnewlrts onvec<br /> -it<br /> -thatnce feredif<br /> -the<br /> -withc() brevhe<br /> -to<br /> -ilarsim<br /> -is<br /> -tionfunchis ) T<br /> -(<br /> -'<br<to .'<br /> -<br /> -ordsw<br /> -kingbreaoid av<br /> -to<br /> -riest<br /> -tionfuncThe .<br /> -" --- Iteration 22 -- - -Notice: A non well formed numeric value encountered in %s on line %d -string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br /> -) This function is similar to hebrevc() with the difference that it converts newlines<br /> -<to '<br (<br /> -.'<br /> -.The function tries to avoid breaking words<br /> -" --- Iteration 23 -- - -Notice: A non well formed numeric value encountered in %s on line %d -string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br /> -) This function is similar to hebrevc() with the difference that it converts newlines<br /> -<to '<br (<br /> -.'<br /> -.The function tries to avoid breaking words<br /> -" --- Iteration 24 -- - -Warning: hebrevc() expects parameter 2 to be int, object given in %s on line %d -NULL --- Iteration 25 -- - -Warning: hebrevc() expects parameter 2 to be int, resource given in %s on line %d -NULL --- Iteration 26 -- -string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br /> -) This function is similar to hebrevc() with the difference that it converts newlines<br /> -<to '<br (<br /> -.'<br /> -.The function tries to avoid breaking words<br /> -" --- Iteration 27 -- -string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br /> -) This function is similar to hebrevc() with the difference that it converts newlines<br /> -<to '<br (<br /> -.'<br /> -.The function tries to avoid breaking words<br /> -" -===DONE=== diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation1.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation1.phpt deleted file mode 100644 index 35719186e4..0000000000 --- a/ext/standard/tests/strings/htmlspecialchars_decode_variation1.phpt +++ /dev/null @@ -1,161 +0,0 @@ ---TEST-- -Test htmlspecialchars_decode() function : usage variations - unexpected values for 'string' argument ---FILE-- -<?php -/* Prototype : string htmlspecialchars_decode(string $string [, int $quote_style]) - * Description: Convert special HTML entities back to characters - * Source code: ext/standard/html.c -*/ - -/* - * testing htmlspecialchars_decode() with unexpected input values for $string argument -*/ - -echo "*** Testing htmlspecialchars_decode() : usage variations ***\n"; - -//get a class -class classA -{ - function __toString() { - return "ClassAObject"; - } -} - -//get a resource variable -$file_handle=fopen(__FILE__, "r"); - -//get an unset variable -$unset_var = 10; -unset($unset_var); - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new classA(), - - // undefined data - @$undefined_var, - - // unset data - @$unset_var, - - //resource - $file_handle -); - -// loop through each element of the array for string -$iterator = 1; -foreach($values as $value) { - echo "-- Iterator $iterator --\n"; - var_dump( htmlspecialchars_decode($value) ); - $iterator++; -}; - -// close the file resource used -fclose($file_handle); - -?> -===DONE=== ---EXPECTF-- -*** Testing htmlspecialchars_decode() : usage variations *** --- Iterator 1 -- -string(1) "0" --- Iterator 2 -- -string(1) "1" --- Iterator 3 -- -string(5) "12345" --- Iterator 4 -- -string(5) "-2345" --- Iterator 5 -- -string(4) "10.5" --- Iterator 6 -- -string(5) "-10.5" --- Iterator 7 -- -string(12) "101234567000" --- Iterator 8 -- -string(13) "1.07654321E-9" --- Iterator 9 -- -string(3) "0.5" --- Iterator 10 -- - -Warning: htmlspecialchars_decode() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iterator 11 -- - -Warning: htmlspecialchars_decode() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iterator 12 -- - -Warning: htmlspecialchars_decode() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iterator 13 -- - -Warning: htmlspecialchars_decode() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iterator 14 -- - -Warning: htmlspecialchars_decode() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iterator 15 -- -string(0) "" --- Iterator 16 -- -string(0) "" --- Iterator 17 -- -string(1) "1" --- Iterator 18 -- -string(0) "" --- Iterator 19 -- -string(1) "1" --- Iterator 20 -- -string(0) "" --- Iterator 21 -- -string(0) "" --- Iterator 22 -- -string(0) "" --- Iterator 23 -- -string(12) "ClassAObject" --- Iterator 24 -- -string(0) "" --- Iterator 25 -- -string(0) "" --- Iterator 26 -- - -Warning: htmlspecialchars_decode() expects parameter 1 to be string, resource given in %s on line %d -NULL -===DONE=== - diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt deleted file mode 100644 index 4a8f165e9c..0000000000 --- a/ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt +++ /dev/null @@ -1,193 +0,0 @@ ---TEST-- -Test htmlspecialchars_decode() function : usage variations - unexpected values for 'quote_style' argument ---FILE-- -<?php -/* Prototype : string htmlspecialchars_decode(string $string [, int $quote_style]) - * Description: Convert special HTML entities back to characters - * Source code: ext/standard/html.c -*/ - -/* - * testing htmlspecialchars_decode() by giving unexpected input values for $quote_style argument -*/ - -echo "*** Testing htmlspecialchars_decode() : usage variations ***\n"; - -// Initialise function arguments -// value initialized = Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string " -$string = "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>"; - -//get a class -class classA { - function __toString() { - return "Class A Object"; - } -} - -//get a resource variable -$file_handle = fopen(__FILE__, "r"); - -//get an unset variable -$unset_var = 10; -unset($unset_var); - -//array of values to iterate over -$values = array( - - // float data - 10.5, - -10.5, - 10.5e20, - 10.6E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // object data - new classA(), - - // undefined data - @$undefined_var, - - // unset data - @$unset_var, - - //resource - $file_handle -); - -// loop through each element of the array for quote_style -$iterator = 1; -foreach($values as $value) { - echo "\n-- Iteration $iterator --\n"; - var_dump( htmlspecialchars_decode($string, $value) ); - $iterator++; -} - -// close the file resource used -fclose($file_handle); - -echo "Done"; -?> ---EXPECTF-- -*** Testing htmlspecialchars_decode() : usage variations *** - --- Iteration 1 -- -string(104) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>" - --- Iteration 2 -- -string(104) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>" - --- Iteration 3 -- - -Warning: htmlspecialchars_decode() expects parameter 2 to be int, float given in %s on line %d -NULL - --- Iteration 4 -- -string(114) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>" - --- Iteration 5 -- -string(114) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>" - --- Iteration 6 -- - -Warning: htmlspecialchars_decode() expects parameter 2 to be int, array given in %shtmlspecialchars_decode_variation2.php on line %d -NULL - --- Iteration 7 -- - -Warning: htmlspecialchars_decode() expects parameter 2 to be int, array given in %shtmlspecialchars_decode_variation2.php on line %d -NULL - --- Iteration 8 -- - -Warning: htmlspecialchars_decode() expects parameter 2 to be int, array given in %shtmlspecialchars_decode_variation2.php on line %d -NULL - --- Iteration 9 -- - -Warning: htmlspecialchars_decode() expects parameter 2 to be int, array given in %shtmlspecialchars_decode_variation2.php on line %d -NULL - --- Iteration 10 -- - -Warning: htmlspecialchars_decode() expects parameter 2 to be int, array given in %shtmlspecialchars_decode_variation2.php on line %d -NULL - --- Iteration 11 -- -string(114) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>" - --- Iteration 12 -- -string(114) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>" - --- Iteration 13 -- -string(104) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>" - --- Iteration 14 -- -string(114) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>" - --- Iteration 15 -- -string(104) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>" - --- Iteration 16 -- -string(114) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>" - --- Iteration 17 -- - -Warning: htmlspecialchars_decode() expects parameter 2 to be int, string given in %shtmlspecialchars_decode_variation2.php on line %d -NULL - --- Iteration 18 -- - -Warning: htmlspecialchars_decode() expects parameter 2 to be int, string given in %shtmlspecialchars_decode_variation2.php on line %d -NULL - --- Iteration 19 -- - -Warning: htmlspecialchars_decode() expects parameter 2 to be int, string given in %shtmlspecialchars_decode_variation2.php on line %d -NULL - --- Iteration 20 -- - -Warning: htmlspecialchars_decode() expects parameter 2 to be int, string given in %shtmlspecialchars_decode_variation2.php on line %d -NULL - --- Iteration 21 -- - -Warning: htmlspecialchars_decode() expects parameter 2 to be int, object given in %shtmlspecialchars_decode_variation2.php on line %d -NULL - --- Iteration 22 -- -string(114) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>" - --- Iteration 23 -- -string(114) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>" - --- Iteration 24 -- - -Warning: htmlspecialchars_decode() expects parameter 2 to be int, resource given in %shtmlspecialchars_decode_variation2.php on line %d -NULL -Done diff --git a/ext/standard/tests/strings/http_build_query.phpt b/ext/standard/tests/strings/http_build_query.phpt index 4ed7fda43d..57fc2f2811 100644 --- a/ext/standard/tests/strings/http_build_query.phpt +++ b/ext/standard/tests/strings/http_build_query.phpt @@ -3,13 +3,13 @@ http_build_query() function --FILE-- <?php -$array = array("foo"=>"bar","baz"=>1,"test"=>"a ' \" ", "abc"); +$array = array("foo"=>"bar","baz"=>1,"test"=>"a ' \" ", "abc", 'float' => 10.42, 'true' => true, 'false' => false); var_dump(http_build_query($array)); var_dump(http_build_query($array, 'foo')); var_dump(http_build_query($array, 'foo', ';')); ?> --EXPECT-- -string(35) "foo=bar&baz=1&test=a+%27+%22+&0=abc" -string(38) "foo=bar&baz=1&test=a+%27+%22+&foo0=abc" -string(38) "foo=bar;baz=1;test=a+%27+%22+;foo0=abc" +string(62) "foo=bar&baz=1&test=a+%27+%22+&0=abc&float=10.42&true=1&false=0" +string(65) "foo=bar&baz=1&test=a+%27+%22+&foo0=abc&float=10.42&true=1&false=0" +string(65) "foo=bar;baz=1;test=a+%27+%22+;foo0=abc;float=10.42;true=1;false=0" diff --git a/ext/standard/tests/strings/http_build_query_error.phpt b/ext/standard/tests/strings/http_build_query_error.phpt index f451310642..2975d2d723 100644 --- a/ext/standard/tests/strings/http_build_query_error.phpt +++ b/ext/standard/tests/strings/http_build_query_error.phpt @@ -10,4 +10,4 @@ $result = http_build_query(null); ?> --EXPECTF-- -Warning: http_build_query(): Parameter 1 expected to be Array or Object. %s value given in %s on line %d +Warning: http_build_query() expects parameter 1 to be array, null given in %s on line %d diff --git a/ext/standard/tests/strings/lcfirst.phpt b/ext/standard/tests/strings/lcfirst.phpt Binary files differindex d09e51eef5..8178fa2eb5 100644 --- a/ext/standard/tests/strings/lcfirst.phpt +++ b/ext/standard/tests/strings/lcfirst.phpt diff --git a/ext/standard/tests/strings/ltrim_variation1.phpt b/ext/standard/tests/strings/ltrim_variation1.phpt deleted file mode 100644 index f476b9b793..0000000000 --- a/ext/standard/tests/strings/ltrim_variation1.phpt +++ /dev/null @@ -1,138 +0,0 @@ ---TEST-- -Test ltrim() function : usage variations - test values for $str argument ---FILE-- -<?php - -/* Prototype : string ltrim ( string $str [, string $charlist ] ) - * Description: Strip whitespace (or other characters) from the beginning of a string. - * Source code: ext/standard/string.c -*/ - -echo "*** Testing ltrim() function: with unexpected inputs for 'str' argument ***\n"; - -//get an unset variable -$unset_var = ' string_val '; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return " sample object "; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $inputs array to test ltrim() function -$count = 1; -foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - // strip white space and any "minus" signs - var_dump( ltrim($input, " \t-") ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing ltrim() function: with unexpected inputs for 'str' argument *** --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(3) "255" --- Iteration 4 -- -string(3) "256" --- Iteration 5 -- -string(10) "2147483647" --- Iteration 6 -- -string(10) "2147483648" --- Iteration 7 -- -string(4) "10.5" --- Iteration 8 -- -string(4) "20.5" --- Iteration 9 -- -string(12) "101234567000" --- Iteration 10 -- - -Warning: ltrim() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: ltrim() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: ltrim() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -string(1) "1" --- Iteration 14 -- -string(0) "" --- Iteration 15 -- -string(1) "1" --- Iteration 16 -- -string(0) "" --- Iteration 17 -- -string(0) "" --- Iteration 18 -- -string(0) "" --- Iteration 19 -- -string(15) "sample object " --- Iteration 20 -- - -Warning: ltrim() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- -string(0) "" --- Iteration 22 -- -string(0) "" -===DONE=== diff --git a/ext/standard/tests/strings/ltrim_variation2.phpt b/ext/standard/tests/strings/ltrim_variation2.phpt deleted file mode 100644 index 5dc260e8a1..0000000000 --- a/ext/standard/tests/strings/ltrim_variation2.phpt +++ /dev/null @@ -1,138 +0,0 @@ ---TEST-- -Test ltrim() function : usage variations - test values for $charlist argument ---FILE-- -<?php - -/* Prototype : string ltrim ( string $str [, string $charlist ] ) - * Description: Strip whitespace (or other characters) from the beginning of a string. - * Source code: ext/standard/string.c -*/ - -echo "*** Testing ltrim() function: with unexpected inputs for 'charlist' argument ***\n"; - -//get an unset variable -$unset_var = ' string_val '; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return " sample object "; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $inputs array to test ltrim() function -$count = 1; -foreach($inputs as $charlist) { - echo "-- Iteration $count --\n"; - // strip white space and any "minus" signs - var_dump( ltrim("!---Hello World---!", $charlist) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing ltrim() function: with unexpected inputs for 'charlist' argument *** --- Iteration 1 -- -string(19) "!---Hello World---!" --- Iteration 2 -- -string(19) "!---Hello World---!" --- Iteration 3 -- -string(19) "!---Hello World---!" --- Iteration 4 -- -string(19) "!---Hello World---!" --- Iteration 5 -- -string(19) "!---Hello World---!" --- Iteration 6 -- -string(19) "!---Hello World---!" --- Iteration 7 -- -string(19) "!---Hello World---!" --- Iteration 8 -- -string(19) "!---Hello World---!" --- Iteration 9 -- -string(19) "!---Hello World---!" --- Iteration 10 -- - -Warning: ltrim() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: ltrim() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: ltrim() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -string(19) "!---Hello World---!" --- Iteration 14 -- -string(19) "!---Hello World---!" --- Iteration 15 -- -string(19) "!---Hello World---!" --- Iteration 16 -- -string(19) "!---Hello World---!" --- Iteration 17 -- -string(19) "!---Hello World---!" --- Iteration 18 -- -string(19) "!---Hello World---!" --- Iteration 19 -- -string(19) "!---Hello World---!" --- Iteration 20 -- - -Warning: ltrim() expects parameter 2 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- -string(19) "!---Hello World---!" --- Iteration 22 -- -string(19) "!---Hello World---!" -===DONE=== diff --git a/ext/standard/tests/strings/md5_file.phpt b/ext/standard/tests/strings/md5_file.phpt Binary files differindex 3e996eccd3..45009669f4 100644 --- a/ext/standard/tests/strings/md5_file.phpt +++ b/ext/standard/tests/strings/md5_file.phpt diff --git a/ext/standard/tests/strings/money_format_variation1.phpt b/ext/standard/tests/strings/money_format_variation1.phpt deleted file mode 100644 index 4a381c183a..0000000000 --- a/ext/standard/tests/strings/money_format_variation1.phpt +++ /dev/null @@ -1,172 +0,0 @@ ---TEST-- -Test money_format() function : usage variations - test values for $format argument ---SKIPIF-- -<?php - if (!function_exists('money_format')) { - die("SKIP money_format - not supported\n"); - } -?> ---FILE-- -<?php -/* Prototype : string money_format ( string $format , float $number ) - * Description: Formats a number as a currency string - * Source code: ext/standard/string.c -*/ - -// =========================================================================================== -// = We do not test for exact return-values, as those might be different between OS-versions = -// =========================================================================================== - -echo "*** Testing money_format() function: with unexpected inputs for 'format' argument ***\n"; - -//get an unset variable -$unset_var = ' string_val '; -unset($unset_var); - -//defining a couple of sample classes -class class_no_tostring { -} - -class class_with_tostring { - public function __toString() { - return " sample object "; - } -} - - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$formats = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // string values -/*19*/ "abcd", - 'abcd', - "0x12f", - "%=*!14#8.2nabcd", - - // objects -/*23*/ new class_no_tostring(), - new class_with_tostring(), - - // resource -/*25*/ $file_handle, - - // undefined variable -/*26*/ @$undefined_var, - - // unset variable -/*27*/ @$unset_var -); - -// loop through with each element of the $formats array to test money_format() function -$count = 1; -$value = 1234.56; - -foreach($formats as $format) { - echo "-- Iteration $count --\n"; - echo gettype(money_format($format, $value))."\n"; - $count ++; -} - -// close the file handle -fclose($file_handle); - -?> -===Done=== ---EXPECTF-- -*** Testing money_format() function: with unexpected inputs for 'format' argument *** --- Iteration 1 -- -string --- Iteration 2 -- -string --- Iteration 3 -- -string --- Iteration 4 -- -string --- Iteration 5 -- -string --- Iteration 6 -- -string --- Iteration 7 -- -string --- Iteration 8 -- -string --- Iteration 9 -- -string --- Iteration 10 -- - -Warning: money_format() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: money_format() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: money_format() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -string --- Iteration 14 -- -string --- Iteration 15 -- -string --- Iteration 16 -- -string --- Iteration 17 -- -string --- Iteration 18 -- -string --- Iteration 19 -- -string --- Iteration 20 -- -string --- Iteration 21 -- -string --- Iteration 22 -- -string --- Iteration 23 -- - -Warning: money_format() expects parameter 1 to be string, object given in %s on line %d -NULL --- Iteration 24 -- -string --- Iteration 25 -- - -Warning: money_format() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 26 -- -string --- Iteration 27 -- -string -===Done=== diff --git a/ext/standard/tests/strings/money_format_variation2.phpt b/ext/standard/tests/strings/money_format_variation2.phpt deleted file mode 100644 index c8de58bded..0000000000 --- a/ext/standard/tests/strings/money_format_variation2.phpt +++ /dev/null @@ -1,182 +0,0 @@ ---TEST-- -Test money_format() function : usage variations - test values for $number argument ---SKIPIF-- -<?php - if (!function_exists('money_format')) { - die("SKIP money_format - not supported\n"); - } -?> ---FILE-- -<?php -/* Prototype : string money_format ( string $format , float $number ) - * Description: Formats a number as a currency string - * Source code: ext/standard/string.c -*/ - -// =========================================================================================== -// = We do not test for exact return-values, as those might be different between OS-versions = -// =========================================================================================== - -echo "*** Testing money_format() function: with unexpected inputs for 'number' argument ***\n"; - -//get an unset variable -$unset_var = ' string_val '; -unset($unset_var); - -//defining a couple of sample classes -class class_no_tostring { -} - -class class_with_tostring { - public function __toString() { - return " sample object "; - } -} - - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $number -$numbers = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // string values -/*19*/ "abcd", - 'abcd', - "0x12f", - "%=*!14#8.2nabcd", - - // objects -/*23*/ new class_no_tostring(), - new class_with_tostring(), - - // resource -/*25*/ $file_handle, - - // undefined variable -/*26*/ @$undefined_var, - - // unset variable -/*27*/ @$unset_var -); - -// loop through with each element of the $numbers array to test money_format() function -$count = 1; -$format = '%14#8.2i'; - -foreach($numbers as $number) { - echo "-- Iteration $count --\n"; - echo gettype(money_format($format, $number))."\n"; - $count ++; -} - -// close the file handle -fclose($file_handle); - -?> -===Done=== ---EXPECTF-- -*** Testing money_format() function: with unexpected inputs for 'number' argument *** --- Iteration 1 -- -string --- Iteration 2 -- -string --- Iteration 3 -- -string --- Iteration 4 -- -string --- Iteration 5 -- -string --- Iteration 6 -- -string --- Iteration 7 -- -string --- Iteration 8 -- -string --- Iteration 9 -- -string --- Iteration 10 -- - -Warning: money_format() expects parameter 2 to be float, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: money_format() expects parameter 2 to be float, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: money_format() expects parameter 2 to be float, array given in %s on line %d -NULL --- Iteration 13 -- -string --- Iteration 14 -- -string --- Iteration 15 -- -string --- Iteration 16 -- -string --- Iteration 17 -- -string --- Iteration 18 -- -string --- Iteration 19 -- - -Warning: money_format() expects parameter 2 to be float, string given in %s on line %d -NULL --- Iteration 20 -- - -Warning: money_format() expects parameter 2 to be float, string given in %s on line %d -NULL --- Iteration 21 -- - -Notice: A non well formed numeric value encountered in %s on line %d -string --- Iteration 22 -- - -Warning: money_format() expects parameter 2 to be float, string given in %s on line %d -NULL --- Iteration 23 -- - -Warning: money_format() expects parameter 2 to be float, object given in %s on line %d -NULL --- Iteration 24 -- - -Warning: money_format() expects parameter 2 to be float, object given in %s on line %d -NULL --- Iteration 25 -- - -Warning: money_format() expects parameter 2 to be float, resource given in %s on line %d -NULL --- Iteration 26 -- -string --- Iteration 27 -- -string -===Done=== diff --git a/ext/standard/tests/strings/nl2br_variation5.phpt b/ext/standard/tests/strings/nl2br_variation5.phpt deleted file mode 100644 index 06a70cbc41..0000000000 --- a/ext/standard/tests/strings/nl2br_variation5.phpt +++ /dev/null @@ -1,152 +0,0 @@ ---TEST-- -Test nl2br() function : usage variations - unexpected values for 'str' argument ---FILE-- -<?php -/* Prototype : string nl2br(string $str) - * Description: Inserts HTML line breaks before all newlines in a string. - * Source code: ext/standard/string.c -*/ - -/* -* Test nl2br() function by passing different types of values other than -* expected type for 'str' argument -*/ - -echo "*** Testing nl2br() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//getting resource -$file_handle = fopen(__FILE__, "r"); - -//defining class -class Sample { - public function __toString() { - return "My String"; - } -} - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - //resource - $file_handle, - - // object data - new Sample(), - - // undefined data - @$undefined_var, - - // unset data - @$unset_var, -); - -// loop through $values array to test nl2br() function with each element -$count = 1; -foreach($values as $value) { - echo "-- Iteration $count --\n"; - var_dump( nl2br($value) ); - $count ++ ; -}; - -//closing the file handle -fclose( $file_handle ); - -echo "Done"; -?> ---EXPECTF-- -*** Testing nl2br() : usage variations *** --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(5) "12345" --- Iteration 4 -- -string(5) "-2345" --- Iteration 5 -- -string(4) "10.5" --- Iteration 6 -- -string(5) "-10.5" --- Iteration 7 -- -string(12) "105000000000" --- Iteration 8 -- -string(7) "1.06E-9" --- Iteration 9 -- -string(3) "0.5" --- Iteration 10 -- - -Warning: nl2br() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: nl2br() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: nl2br() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: nl2br() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: nl2br() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(0) "" --- Iteration 16 -- -string(0) "" --- Iteration 17 -- -string(1) "1" --- Iteration 18 -- -string(0) "" --- Iteration 19 -- -string(1) "1" --- Iteration 20 -- -string(0) "" --- Iteration 21 -- - -Warning: nl2br() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 22 -- -string(9) "My String" --- Iteration 23 -- -string(0) "" --- Iteration 24 -- -string(0) "" -Done diff --git a/ext/standard/tests/strings/ord_variation1.phpt b/ext/standard/tests/strings/ord_variation1.phpt deleted file mode 100644 index ffca230dba..0000000000 --- a/ext/standard/tests/strings/ord_variation1.phpt +++ /dev/null @@ -1,136 +0,0 @@ ---TEST-- -Test ord() function : usage variations - test values for $string argument ---FILE-- -<?php - -/* Prototype : int ord ( string $string ) - * Description: Return ASCII value of character - * Source code: ext/standard/string.c -*/ - -echo "*** Testing ord() function: with unexpected inputs for 'string' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$inputs = array ( - -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $string array to test ord() function -$count = 1; -foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - var_dump( ord($input) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing ord() function: with unexpected inputs for 'string' argument *** --- Iteration 1 -- -int(48) --- Iteration 2 -- -int(49) --- Iteration 3 -- -int(50) --- Iteration 4 -- -int(50) --- Iteration 5 -- -int(50) --- Iteration 6 -- -int(45) --- Iteration 7 -- -int(49) --- Iteration 8 -- -int(45) --- Iteration 9 -- -int(49) --- Iteration 10 -- - -Warning: ord() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: ord() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: ord() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -int(49) --- Iteration 14 -- -int(0) --- Iteration 15 -- -int(49) --- Iteration 16 -- -int(0) --- Iteration 17 -- -int(0) --- Iteration 18 -- -int(0) --- Iteration 19 -- -int(115) --- Iteration 20 -- - -Warning: ord() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- -int(0) --- Iteration 22 -- -int(0) -===DONE=== diff --git a/ext/standard/tests/strings/quoted_printable_decode_variation1.phpt b/ext/standard/tests/strings/quoted_printable_decode_variation1.phpt deleted file mode 100644 index 8d147c0e67..0000000000 --- a/ext/standard/tests/strings/quoted_printable_decode_variation1.phpt +++ /dev/null @@ -1,191 +0,0 @@ ---TEST-- -Test quoted_printable_decode() function : usage variations - unexpected values for 'str' argument ---FILE-- -<?php -/* Prototype : string quoted_printable_decode ( string $str ) - * Description: Convert a quoted-printable string to an 8 bit string - * Source code: ext/standard/string.c -*/ - -/* -* Testing quoted_printable_decode() : with different unexpected values for format argument other than the strings -*/ - -echo "*** Testing quoted_printable_decode() : with unexpected values for 'str' argument ***\n"; - -// initialing required variables -$arg1 = "second arg"; -$arg2 = "third arg"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// declaring class -class sample -{ - public function __toString() { - return "Object"; - } -} - -// creating a file resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$values = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data -/*10*/ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data -/*15*/ NULL, - null, - - // boolean data -/*17*/ true, - false, - TRUE, - FALSE, - - // empty data -/*21*/ "", - '', - - // object data -/*23*/ new sample(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - // resource data -/*26*/ $file_handle -); - -// loop through each element of the array for 'str' - -$count = 1; -foreach($values as $value) { - echo "\n-- Iteration $count --\n"; - var_dump(bin2hex(quoted_printable_decode($value))); - $count++; -}; - -// close the resource -fclose($file_handle); - -?> -===DONE=== ---EXPECTF-- -*** Testing quoted_printable_decode() : with unexpected values for 'str' argument *** - --- Iteration 1 -- -string(2) "30" - --- Iteration 2 -- -string(2) "31" - --- Iteration 3 -- -string(10) "3132333435" - --- Iteration 4 -- -string(10) "2d32333435" - --- Iteration 5 -- -string(8) "31302e35" - --- Iteration 6 -- -string(10) "2d31302e35" - --- Iteration 7 -- -string(24) "313031323334353637303030" - --- Iteration 8 -- -string(26) "312e3037363534333231452d39" - --- Iteration 9 -- -string(6) "302e35" - --- Iteration 10 -- - -Warning: quoted_printable_decode() expects parameter 1 to be string, array given in %s on line %d -string(0) "" - --- Iteration 11 -- - -Warning: quoted_printable_decode() expects parameter 1 to be string, array given in %s on line %d -string(0) "" - --- Iteration 12 -- - -Warning: quoted_printable_decode() expects parameter 1 to be string, array given in %s on line %d -string(0) "" - --- Iteration 13 -- - -Warning: quoted_printable_decode() expects parameter 1 to be string, array given in %s on line %d -string(0) "" - --- Iteration 14 -- - -Warning: quoted_printable_decode() expects parameter 1 to be string, array given in %s on line %d -string(0) "" - --- Iteration 15 -- -string(0) "" - --- Iteration 16 -- -string(0) "" - --- Iteration 17 -- -string(2) "31" - --- Iteration 18 -- -string(0) "" - --- Iteration 19 -- -string(2) "31" - --- Iteration 20 -- -string(0) "" - --- Iteration 21 -- -string(0) "" - --- Iteration 22 -- -string(0) "" - --- Iteration 23 -- -string(12) "4f626a656374" - --- Iteration 24 -- -string(0) "" - --- Iteration 25 -- -string(0) "" - --- Iteration 26 -- - -Warning: quoted_printable_decode() expects parameter 1 to be string, resource given in %s on line %d -string(0) "" -===DONE=== diff --git a/ext/standard/tests/strings/quotemeta_basic_1.phpt b/ext/standard/tests/strings/quotemeta_basic_1.phpt new file mode 100644 index 0000000000..4b479a9a60 --- /dev/null +++ b/ext/standard/tests/strings/quotemeta_basic_1.phpt @@ -0,0 +1,12 @@ +--TEST-- +Test function quotemeta() - using an empty string is given as str. +--CREDITS-- +Rodrigo Prado de Jesus <royopa [at] gmail [dot] com> +User Group: PHPSP #PHPTestFestBrasil +--FILE-- +<?php +$str = ""; +var_dump(quotemeta($str)); +?> +--EXPECT-- +bool(false) diff --git a/ext/standard/tests/strings/rtrim_variation1.phpt b/ext/standard/tests/strings/rtrim_variation1.phpt deleted file mode 100644 index f07b7db3df..0000000000 --- a/ext/standard/tests/strings/rtrim_variation1.phpt +++ /dev/null @@ -1,138 +0,0 @@ ---TEST-- -Test rtrim() function : usage variations - test values for $str argument ---FILE-- -<?php - -/* Prototype : string rtrim ( string $str [, string $charlist ] ) - * Description: Strip whitespace (or other characters) from the end of a string. - * Source code: ext/standard/string.c -*/ - -echo "*** Testing rtrim() function: with unexpected inputs for 'str' argument ***\n"; - -//get an unset variable -$unset_var = ' !--string_val--! '; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return " !---sample object---! "; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $inputs array to test rtrim() function -$count = 1; -foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - // strip white space and any "minus" signs - var_dump( rtrim($input, " !-") ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing rtrim() function: with unexpected inputs for 'str' argument *** --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(3) "255" --- Iteration 4 -- -string(3) "256" --- Iteration 5 -- -string(10) "2147483647" --- Iteration 6 -- -string(11) "-2147483648" --- Iteration 7 -- -string(4) "10.5" --- Iteration 8 -- -string(5) "-20.5" --- Iteration 9 -- -string(12) "101234567000" --- Iteration 10 -- - -Warning: rtrim() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: rtrim() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: rtrim() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -string(1) "1" --- Iteration 14 -- -string(0) "" --- Iteration 15 -- -string(1) "1" --- Iteration 16 -- -string(0) "" --- Iteration 17 -- -string(0) "" --- Iteration 18 -- -string(0) "" --- Iteration 19 -- -string(19) " !---sample object" --- Iteration 20 -- - -Warning: rtrim() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- -string(0) "" --- Iteration 22 -- -string(0) "" -===DONE=== diff --git a/ext/standard/tests/strings/rtrim_variation2.phpt b/ext/standard/tests/strings/rtrim_variation2.phpt deleted file mode 100644 index 70efd09f2b..0000000000 --- a/ext/standard/tests/strings/rtrim_variation2.phpt +++ /dev/null @@ -1,138 +0,0 @@ ---TEST-- -Test rtrim() function : usage variations - test values for $charlist argument ---FILE-- -<?php - -/* Prototype : string rtrim ( string $str [, string $charlist ] ) - * Description: Strip whitespace (or other characters) from the end of a string. - * Source code: ext/standard/string.c -*/ - -echo "*** Testing rtrim() function: with unexpected inputs for 'charlist' argument ***\n"; - -//get an unset variable -$unset_var = ' string_val '; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return " sample object "; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $inputs array to test rtrim() function -$count = 1; -foreach($inputs as $charlist) { - echo "-- Iteration $count --\n"; - // strip white space and any "minus" signs - var_dump( rtrim("!---Hello World---!", $charlist) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing rtrim() function: with unexpected inputs for 'charlist' argument *** --- Iteration 1 -- -string(19) "!---Hello World---!" --- Iteration 2 -- -string(19) "!---Hello World---!" --- Iteration 3 -- -string(19) "!---Hello World---!" --- Iteration 4 -- -string(19) "!---Hello World---!" --- Iteration 5 -- -string(19) "!---Hello World---!" --- Iteration 6 -- -string(19) "!---Hello World---!" --- Iteration 7 -- -string(19) "!---Hello World---!" --- Iteration 8 -- -string(19) "!---Hello World---!" --- Iteration 9 -- -string(19) "!---Hello World---!" --- Iteration 10 -- - -Warning: rtrim() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: rtrim() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: rtrim() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -string(19) "!---Hello World---!" --- Iteration 14 -- -string(19) "!---Hello World---!" --- Iteration 15 -- -string(19) "!---Hello World---!" --- Iteration 16 -- -string(19) "!---Hello World---!" --- Iteration 17 -- -string(19) "!---Hello World---!" --- Iteration 18 -- -string(19) "!---Hello World---!" --- Iteration 19 -- -string(19) "!---Hello World---!" --- Iteration 20 -- - -Warning: rtrim() expects parameter 2 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- -string(19) "!---Hello World---!" --- Iteration 22 -- -string(19) "!---Hello World---!" -===DONE=== diff --git a/ext/standard/tests/strings/sha1_file.phpt b/ext/standard/tests/strings/sha1_file.phpt index 83a191b172..102dab75ff 100644 --- a/ext/standard/tests/strings/sha1_file.phpt +++ b/ext/standard/tests/strings/sha1_file.phpt @@ -10,15 +10,15 @@ Test sha1_file() function with ASCII output and raw binary output. Based on ext/ echo "*** Testing sha1_file() : basic functionality ***\n"; /* Creating an empty file */ -if (($handle = fopen( "EmptyFile.txt", "w+")) == FALSE) +if (($handle = fopen( "EmptyFileSHA1.txt", "w+")) == FALSE) return false; /* Creating a data file */ -if (($handle2 = fopen( "DataFile.txt", "w+")) == FALSE) +if (($handle2 = fopen( "DataFileSHA1.txt", "w+")) == FALSE) return false; /* Writing into file */ -$filename = "DataFile.txt"; +$filename = "DataFileSHA1.txt"; $content = "Add this to the file\n"; if (is_writable($filename)) { if (fwrite($handle2, $content) === FALSE) { @@ -50,23 +50,23 @@ echo "\n-- Zero arguments --\n"; var_dump ( sha1_file() ); echo "\n-- More than valid number of arguments ( valid is 2) --\n"; -var_dump ( sha1_file("EmptyFile.txt", true, NULL) ); +var_dump ( sha1_file("EmptyFileSHA1.txt", true, NULL) ); echo "\n-- Hexadecimal Output for Empty file as Argument --\n"; -var_dump( sha1_file("EmptyFile.txt") ); +var_dump( sha1_file("EmptyFileSHA1.txt") ); echo "\n-- Raw Binary Output for Empty file as Argument --\n"; -var_dump( bin2hex(sha1_file("EmptyFile.txt", true))); +var_dump( bin2hex(sha1_file("EmptyFileSHA1.txt", true))); echo "\n-- Hexadecimal Output for a valid file with some contents --\n"; -var_dump( sha1_file("DataFile.txt") ); +var_dump( sha1_file("DataFileSHA1.txt") ); echo "\n-- Raw Binary Output for a valid file with some contents --\n"; -var_dump ( bin2hex(sha1_file("DataFile.txt", true))); +var_dump ( bin2hex(sha1_file("DataFileSHA1.txt", true))); // remove temp files -unlink("DataFile.txt"); -unlink("EmptyFile.txt"); +unlink("DataFileSHA1.txt"); +unlink("EmptyFileSHA1.txt"); ?> ===DONE=== diff --git a/ext/standard/tests/strings/sha1_variation1.phpt b/ext/standard/tests/strings/sha1_variation1.phpt deleted file mode 100644 index 35fb16a87b..0000000000 --- a/ext/standard/tests/strings/sha1_variation1.phpt +++ /dev/null @@ -1,157 +0,0 @@ ---TEST-- -Test sha1() function : usage variations - unexpected values for 'str' argument ---FILE-- -<?php - -/* Prototype: string sha1 ( string $str [, bool $raw_output ] ) - * Description: Calculate the sha1 hash of a string - */ - -echo "*** Testing sha1() : unexpected values for 'str' ***\n"; - -$raw = false; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//defining class for object variable -class MyClass -{ - public function __toString() - { - return "object"; - } -} - -//resource variable -$fp = fopen(__FILE__, 'r'); - -//different values for 'str' argument -$values = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 10.1234567e10, - 10.1234567E-10, - .5, - - // array data -/*10*/ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data -/*15*/ NULL, - null, - - // boolean data -/*17*/ true, - false, - TRUE, - FALSE, - - // empty data -/*21*/ "", - '', - - // object data -/*23*/ new MyClass(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - //resource data -/*26*/ $fp -); - -// loop through each element of $values for 'str' argument -for($count = 0; $count < count($values); $count++) { - echo "-- Iteration ".($count+1)." --\n"; - var_dump( sha1($values[$count], $raw) ); -} - -//closing resource -fclose($fp); - -?> -===DONE=== ---EXPECTF-- -*** Testing sha1() : unexpected values for 'str' *** --- Iteration 1 -- -string(40) "b6589fc6ab0dc82cf12099d1c2d40ab994e8410c" --- Iteration 2 -- -string(40) "356a192b7913b04c54574d18c28d46e6395428ab" --- Iteration 3 -- -string(40) "8cb2237d0679ca88db6464eac60da96345513964" --- Iteration 4 -- -string(40) "bc97c643aba3b6c6abe253222f439d4002a87528" --- Iteration 5 -- -string(40) "1287384bc5ef3ab84a36a5ef1d888df2763567f4" --- Iteration 6 -- -string(40) "c9d6e1b691f17c8ae6d458984a5f56f80e62a60b" --- Iteration 7 -- -string(40) "39493e1e645578a655f532e1f9bcff67991f2c2f" --- Iteration 8 -- -string(40) "681b45cae882ad795afd54ccc2a04ad58e056b83" --- Iteration 9 -- -string(40) "1b390cd54a0c0d4f27fa7adf23e3c45536e9f37c" --- Iteration 10 -- - -Warning: sha1() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: sha1() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: sha1() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: sha1() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: sha1() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" --- Iteration 16 -- -string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" --- Iteration 17 -- -string(40) "356a192b7913b04c54574d18c28d46e6395428ab" --- Iteration 18 -- -string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" --- Iteration 19 -- -string(40) "356a192b7913b04c54574d18c28d46e6395428ab" --- Iteration 20 -- -string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" --- Iteration 21 -- -string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" --- Iteration 22 -- -string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" --- Iteration 23 -- -string(40) "1615307cc4523f183e777df67f168c86908e8007" --- Iteration 24 -- -string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" --- Iteration 25 -- -string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" --- Iteration 26 -- - -Warning: sha1() expects parameter 1 to be string, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/strings/sha1_variation2.phpt b/ext/standard/tests/strings/sha1_variation2.phpt deleted file mode 100644 index 13c255451a..0000000000 --- a/ext/standard/tests/strings/sha1_variation2.phpt +++ /dev/null @@ -1,160 +0,0 @@ ---TEST-- -Test sha1() function : usage variations - unexpected values for 'raw' argument ---FILE-- -<?php - -/* Prototype: string sha1 ( string $str [, bool $raw_output ] ) - * Description: Calculate the sha1 hash of a string - */ - -echo "*** Testing sha1() : unexpected values for 'raw' ***\n"; - -$string = "Hello World"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//defining class for object variable -class MyClass -{ - public function __toString() - { - return "object"; - } -} - -//resource variable -$fp = fopen(__FILE__, 'r'); - -//different values for 'str' argument -$values = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 10.1234567e10, - 10.1234567E-10, - .5, - - // array data -/*10*/ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data -/*15*/ NULL, - null, - - // string data -/*17*/ "ABC", - 'abc', - "0abc", - "123abc", - - // empty data -/*21*/ "", - '', - - // object data -/*23*/ new MyClass(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - //resource data -/*26*/ $fp -); - -// loop through each element of $values for 'raw' argument -for($count = 0; $count < count($values); $count++) { - echo "-- Iteration ".($count+1)." --\n"; - // use bin2hex to catch those cases were raw is true - var_dump( bin2hex(sha1($string, $values[$count])) ); -} - -//closing resource -fclose($fp); - -?> -===DONE=== ---EXPECTF-- -*** Testing sha1() : unexpected values for 'raw' *** --- Iteration 1 -- -string(80) "30613464353561386437373865353032326661623730313937376335643834306262633438366430" --- Iteration 2 -- -string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0" --- Iteration 3 -- -string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0" --- Iteration 4 -- -string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0" --- Iteration 5 -- -string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0" --- Iteration 6 -- -string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0" --- Iteration 7 -- -string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0" --- Iteration 8 -- -string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0" --- Iteration 9 -- -string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0" --- Iteration 10 -- - -Warning: sha1() expects parameter 2 to be bool, array given in %s on line %d -string(0) "" --- Iteration 11 -- - -Warning: sha1() expects parameter 2 to be bool, array given in %s on line %d -string(0) "" --- Iteration 12 -- - -Warning: sha1() expects parameter 2 to be bool, array given in %s on line %d -string(0) "" --- Iteration 13 -- - -Warning: sha1() expects parameter 2 to be bool, array given in %s on line %d -string(0) "" --- Iteration 14 -- - -Warning: sha1() expects parameter 2 to be bool, array given in %s on line %d -string(0) "" --- Iteration 15 -- -string(80) "30613464353561386437373865353032326661623730313937376335643834306262633438366430" --- Iteration 16 -- -string(80) "30613464353561386437373865353032326661623730313937376335643834306262633438366430" --- Iteration 17 -- -string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0" --- Iteration 18 -- -string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0" --- Iteration 19 -- -string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0" --- Iteration 20 -- -string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0" --- Iteration 21 -- -string(80) "30613464353561386437373865353032326661623730313937376335643834306262633438366430" --- Iteration 22 -- -string(80) "30613464353561386437373865353032326661623730313937376335643834306262633438366430" --- Iteration 23 -- - -Warning: sha1() expects parameter 2 to be bool, object given in %s on line %d -string(0) "" --- Iteration 24 -- -string(80) "30613464353561386437373865353032326661623730313937376335643834306262633438366430" --- Iteration 25 -- -string(80) "30613464353561386437373865353032326661623730313937376335643834306262633438366430" --- Iteration 26 -- - -Warning: sha1() expects parameter 2 to be bool, resource given in %s on line %d -string(0) "" -===DONE=== diff --git a/ext/standard/tests/strings/str_getcsv_002.phpt b/ext/standard/tests/strings/str_getcsv_002.phpt new file mode 100644 index 0000000000..a4ff87c206 --- /dev/null +++ b/ext/standard/tests/strings/str_getcsv_002.phpt @@ -0,0 +1,19 @@ +--TEST-- +str_getcsv() with empty $escape +--FILE-- +<?php +$contents = <<<EOS +"cell1","cell2\\","cell3","cell4" +EOS; +print_r(str_getcsv($contents, ',', '"', '')); +?> +===DONE=== +--EXPECT-- +Array +( + [0] => cell1 + [1] => cell2\ + [2] => cell3 + [3] => cell4 +) +===DONE=== diff --git a/ext/standard/tests/strings/str_pad_variation1.phpt b/ext/standard/tests/strings/str_pad_variation1.phpt deleted file mode 100644 index 32506ab1a9..0000000000 --- a/ext/standard/tests/strings/str_pad_variation1.phpt +++ /dev/null @@ -1,140 +0,0 @@ ---TEST-- -Test str_pad() function : usage variations - unexpected inputs for '$input' argument ---FILE-- -<?php -/* Prototype : string str_pad ( string $input , int $pad_length [, string $pad_string [, int $pad_type ]] ) - * Description: Pad a string to a certain length with another string - * Source code: ext/standard/string.c -*/ - -/* Test str_pad() function: with unexpected inputs for '$input' - * and expected type for '$pad_length' -*/ - -echo "*** Testing str_pad() function: with unexpected inputs for 'input' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - -2, - 2147483647, - -2147483648, - - // float values -/*6*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*9*/ array(), - array(0), - array(1, 2), - - // boolean values -/*12*/ true, - false, - TRUE, - FALSE, - - // null values -/*16*/ NULL, - null, - - // objects -/*18*/ new sample(), - - // resource -/*19*/ $file_handle, - - // undefined variable -/*20*/ @$undefined_var, - - // unset variable -/*21*/ @$unset_var -); - -//defining '$pad_length' argument -$pad_length = "20"; - -// loop through with each element of the $inputs array to test str_pad() function -$count = 1; -foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - var_dump( str_pad($input, $pad_length) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing str_pad() function: with unexpected inputs for 'input' argument *** --- Iteration 1 -- -string(20) "0 " --- Iteration 2 -- -string(20) "1 " --- Iteration 3 -- -string(20) "-2 " --- Iteration 4 -- -string(20) "2147483647 " --- Iteration 5 -- -string(20) "-2147483648 " --- Iteration 6 -- -string(20) "10.5 " --- Iteration 7 -- -string(20) "-20.5 " --- Iteration 8 -- -string(20) "101234567000 " --- Iteration 9 -- - -Warning: str_pad() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 10 -- - -Warning: str_pad() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: str_pad() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- -string(20) "1 " --- Iteration 13 -- -string(20) " " --- Iteration 14 -- -string(20) "1 " --- Iteration 15 -- -string(20) " " --- Iteration 16 -- -string(20) " " --- Iteration 17 -- -string(20) " " --- Iteration 18 -- -string(20) "sample object " --- Iteration 19 -- - -Warning: str_pad() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 20 -- -string(20) " " --- Iteration 21 -- -string(20) " " -===DONE=== diff --git a/ext/standard/tests/strings/str_pad_variation2.phpt b/ext/standard/tests/strings/str_pad_variation2.phpt deleted file mode 100644 index 114d5f5ba1..0000000000 --- a/ext/standard/tests/strings/str_pad_variation2.phpt +++ /dev/null @@ -1,139 +0,0 @@ ---TEST-- -Test str_pad() function : usage variations - unexpected inputs for '$pad_length' argument ---FILE-- -<?php -/* Prototype : string str_pad ( string $input , int $pad_length [, string $pad_string [, int $pad_type ]] ) - * Description: Pad a string to a certain length with another string - * Source code: ext/standard/string.c -*/ - -/* Test str_pad() function: with unexpected inputs for '$pad_length' - * and expected type for '$input' -*/ - -echo "*** Testing str_pad() function: with unexpected inputs for 'pad_length' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$pad_lengths = array ( - - // integer values -/*1*/ 0, - 1, - -2, - 255, - - // float values -/*5*/ 10.5, - -20.5, - 10.12345e2, - - // array values -/*8*/ array(), - array(0), - array(1, 2), - - // boolean values -/*11*/ true, - false, - TRUE, - FALSE, - - // null values -/*15*/ NULL, - null, - - // objects -/*17*/ new sample(), - - // resource -/*18*/ $file_handle, - - // undefined variable -/*19*/ @$undefined_var, - - // unset variable -/*20*/ @$unset_var -); - -//defining '$input' argument -$input = "Test string"; - -// loop through with each element of the $pad_lengths array to test str_pad() function -$count = 1; -foreach($pad_lengths as $pad_length) { - echo "-- Iteration $count --\n"; - var_dump( str_pad($input, $pad_length) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing str_pad() function: with unexpected inputs for 'pad_length' argument *** --- Iteration 1 -- -string(11) "Test string" --- Iteration 2 -- -string(11) "Test string" --- Iteration 3 -- -string(11) "Test string" --- Iteration 4 -- -string(255) "Test string " --- Iteration 5 -- -string(11) "Test string" --- Iteration 6 -- -string(11) "Test string" --- Iteration 7 -- -string(1012) "Test string " --- Iteration 8 -- - -Warning: str_pad() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 9 -- - -Warning: str_pad() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 10 -- - -Warning: str_pad() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 11 -- -string(11) "Test string" --- Iteration 12 -- -string(11) "Test string" --- Iteration 13 -- -string(11) "Test string" --- Iteration 14 -- -string(11) "Test string" --- Iteration 15 -- -string(11) "Test string" --- Iteration 16 -- -string(11) "Test string" --- Iteration 17 -- - -Warning: str_pad() expects parameter 2 to be int, object given in %s on line %d -NULL --- Iteration 18 -- - -Warning: str_pad() expects parameter 2 to be int, resource given in %s on line %d -NULL --- Iteration 19 -- -string(11) "Test string" --- Iteration 20 -- -string(11) "Test string" -===DONE=== diff --git a/ext/standard/tests/strings/str_pad_variation3.phpt b/ext/standard/tests/strings/str_pad_variation3.phpt deleted file mode 100644 index 1e58477f21..0000000000 --- a/ext/standard/tests/strings/str_pad_variation3.phpt +++ /dev/null @@ -1,153 +0,0 @@ ---TEST-- -Test str_pad() function : usage variations - unexpected inputs for '$pad_string' argument ---FILE-- -<?php -/* Prototype : string str_pad ( string $input , int $pad_length [, string $pad_string [, int $pad_type ]] ) - * Description: Pad a string to a certain length with another string - * Source code: ext/standard/string.c -*/ - -/* Test str_pad() function: with unexpected inputs for '$pad_string' - * and expected type for '$input' and '$pad_length' -*/ - -echo "*** Testing str_pad() function: with unexpected inputs for 'pad_string' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$pad_strings = array ( - - // integer values -/*1*/ 0, - 1, - -2, - 2147483647, - -2147483648, - - // float values -/*6*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*9*/ array(), - array(0), - array(1, 2), - - // boolean values -/*12*/ true, - false, - TRUE, - FALSE, - - // null values -/*16*/ NULL, - null, - - // objects -/*18*/ new sample(), - - // resource -/*19*/ $file_handle, - - // undefined variable -/*20*/ @$undefined_var, - - // unset variable -/*21*/ @$unset_var -); - -//defining '$input' argument -$input = "Test string"; -$pad_length = 20; - -// loop through with each element of the $pad_strings array to test str_pad() function -$count = 1; -foreach($pad_strings as $pad_string) { - echo "-- Iteration $count --\n"; - var_dump( str_pad($input, $pad_length, $pad_string) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing str_pad() function: with unexpected inputs for 'pad_string' argument *** --- Iteration 1 -- -string(20) "Test string000000000" --- Iteration 2 -- -string(20) "Test string111111111" --- Iteration 3 -- -string(20) "Test string-2-2-2-2-" --- Iteration 4 -- -string(20) "Test string214748364" --- Iteration 5 -- -string(20) "Test string-21474836" --- Iteration 6 -- -string(20) "Test string10.510.51" --- Iteration 7 -- -string(20) "Test string-20.5-20." --- Iteration 8 -- -string(20) "Test string101234567" --- Iteration 9 -- - -Warning: str_pad() expects parameter 3 to be string, array given in %s on line %d -NULL --- Iteration 10 -- - -Warning: str_pad() expects parameter 3 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: str_pad() expects parameter 3 to be string, array given in %s on line %d -NULL --- Iteration 12 -- -string(20) "Test string111111111" --- Iteration 13 -- - -Warning: str_pad(): Padding string cannot be empty in %s on line %d -NULL --- Iteration 14 -- -string(20) "Test string111111111" --- Iteration 15 -- - -Warning: str_pad(): Padding string cannot be empty in %s on line %d -NULL --- Iteration 16 -- - -Warning: str_pad(): Padding string cannot be empty in %s on line %d -NULL --- Iteration 17 -- - -Warning: str_pad(): Padding string cannot be empty in %s on line %d -NULL --- Iteration 18 -- -string(20) "Test stringsample ob" --- Iteration 19 -- - -Warning: str_pad() expects parameter 3 to be string, resource given in %s on line %d -NULL --- Iteration 20 -- - -Warning: str_pad(): Padding string cannot be empty in %s on line %d -NULL --- Iteration 21 -- - -Warning: str_pad(): Padding string cannot be empty in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/strings/str_pad_variation4.phpt b/ext/standard/tests/strings/str_pad_variation4.phpt deleted file mode 100644 index 22ca2d5270..0000000000 --- a/ext/standard/tests/strings/str_pad_variation4.phpt +++ /dev/null @@ -1,172 +0,0 @@ ---TEST-- -Test str_pad() function : usage variations - unexpected inputs for '$pad_type' argument ---SKIPIF-- -<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); ---FILE-- -<?php -/* Prototype : string str_pad ( string $input , int $pad_length [, string $pad_string [, int $pad_type ]] ) - * Description: Pad a string to a certain length with another string - * Source code: ext/standard/string.c -*/ - -/* Test str_pad() function: with unexpected inputs for '$pad_type' - * and expected type for '$input', '$pad_length' and '$pad_string' -*/ - -echo "*** Testing str_pad() function: with unexpected inputs for 'pad_type' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -// array with different values for $input -$pad_types = array ( - - // integer values -/*1*/ 0, // == STR_PAD_LEFT - 1, // == STR_PAD_RIGHT - 2, // == STR_PAD_BOTH - -2, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // string data -/*10*/ "abc", - "STR_PAD_LEFT", - "2", - "0x2", - "02", - - // array values -/*15*/ array(), - array(0), - array(1, 2), - - // boolean values -/*18*/ true, - false, - TRUE, - FALSE, - - // null values -/*22*/ NULL, - null, - - // objects -/*24*/ new sample(), - - // undefined variable -/*25*/ @$undefined_var, - - // unset variable -/*26*/ @$unset_var -); - -//defining '$input' argument -$input = "Test string"; -$pad_length = 20; -$pad_string = "*"; - -// loop through with each element of the $pad_types array to test str_pad() function -$count = 1; -foreach($pad_types as $pad_type) { - echo "-- Iteration $count --\n"; - var_dump( str_pad($input, $pad_length, $pad_string, $pad_type) ); - $count ++; -} - -?> -===DONE=== ---EXPECTF-- -*** Testing str_pad() function: with unexpected inputs for 'pad_type' argument *** --- Iteration 1 -- -string(20) "*********Test string" --- Iteration 2 -- -string(20) "Test string*********" --- Iteration 3 -- -string(20) "****Test string*****" --- Iteration 4 -- - -Warning: str_pad(): Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH in %s on line %d -NULL --- Iteration 5 -- - -Warning: str_pad(): Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH in %s on line %d -NULL --- Iteration 6 -- - -Warning: str_pad(): Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH in %s on line %d -NULL --- Iteration 7 -- - -Warning: str_pad(): Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH in %s on line %d -NULL --- Iteration 8 -- - -Warning: str_pad(): Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH in %s on line %d -NULL --- Iteration 9 -- - -Warning: str_pad(): Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH in %s on line %d -NULL --- Iteration 10 -- - -Warning: str_pad() expects parameter 4 to be int, string given in %s on line %d -NULL --- Iteration 11 -- - -Warning: str_pad() expects parameter 4 to be int, string given in %s on line %d -NULL --- Iteration 12 -- -string(20) "****Test string*****" --- Iteration 13 -- - -Notice: A non well formed numeric value encountered in %s on line %d -string(20) "*********Test string" --- Iteration 14 -- -string(20) "****Test string*****" --- Iteration 15 -- - -Warning: str_pad() expects parameter 4 to be int, array given in %s on line %d -NULL --- Iteration 16 -- - -Warning: str_pad() expects parameter 4 to be int, array given in %s on line %d -NULL --- Iteration 17 -- - -Warning: str_pad() expects parameter 4 to be int, array given in %s on line %d -NULL --- Iteration 18 -- -string(20) "Test string*********" --- Iteration 19 -- -string(20) "*********Test string" --- Iteration 20 -- -string(20) "Test string*********" --- Iteration 21 -- -string(20) "*********Test string" --- Iteration 22 -- -string(20) "*********Test string" --- Iteration 23 -- -string(20) "*********Test string" --- Iteration 24 -- - -Warning: str_pad() expects parameter 4 to be int, object given in %s on line %d -NULL --- Iteration 25 -- -string(20) "*********Test string" --- Iteration 26 -- -string(20) "*********Test string" -===DONE=== diff --git a/ext/standard/tests/strings/str_shuffle.phpt b/ext/standard/tests/strings/str_shuffle.phpt index 878cb283dd..f5122bc202 100644 --- a/ext/standard/tests/strings/str_shuffle.phpt +++ b/ext/standard/tests/strings/str_shuffle.phpt @@ -2,7 +2,6 @@ Testing str_shuffle. --FILE-- <?php -/* Do not change this test it is a README.TESTING example. */ $s = '123'; var_dump(str_shuffle($s)); var_dump($s); diff --git a/ext/standard/tests/strings/str_shuffle_variation1.phpt b/ext/standard/tests/strings/str_shuffle_variation1.phpt deleted file mode 100644 index d5681392b5..0000000000 --- a/ext/standard/tests/strings/str_shuffle_variation1.phpt +++ /dev/null @@ -1,135 +0,0 @@ ---TEST-- -Test str_shuffle() function : usage variations - test values for $haystack argument ---FILE-- -<?php - -/* Prototype : string str_shuffle ( string $str ) - * Description: Randomly shuffles a string - * Source code: ext/standard/string.c -*/ - -echo "*** Testing str_shuffle() function: with unexpected inputs for 'string' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - -2, - 2147483647, - -2147483648, - - // float values -/*6*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*9*/ array(), - array(0), - array(1, 2), - - // boolean values -/*12*/ true, - false, - TRUE, - FALSE, - - // null values -/*16*/ NULL, - null, - - // objects -/*18*/ new sample(), - - // resource -/*19*/ $file_handle, - - // undefined variable -/*20*/ @$undefined_var, - - // unset variable -/*21*/ @$unset_var -); - - -// loop through with each element of the $inputs array to test str_shuffle() function -$count = 1; -foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - var_dump( str_shuffle($input) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing str_shuffle() function: with unexpected inputs for 'string' argument *** --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(2) "%s" --- Iteration 4 -- -string(10) "%s" --- Iteration 5 -- -string(11) "%s" --- Iteration 6 -- -string(4) "%s" --- Iteration 7 -- -string(5) "%s" --- Iteration 8 -- -string(12) "%s" --- Iteration 9 -- - -Warning: str_shuffle() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 10 -- - -Warning: str_shuffle() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: str_shuffle() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- -string(1) "1" --- Iteration 13 -- -string(0) "" --- Iteration 14 -- -string(1) "1" --- Iteration 15 -- -string(0) "" --- Iteration 16 -- -string(0) "" --- Iteration 17 -- -string(0) "" --- Iteration 18 -- -string(13) "%s" --- Iteration 19 -- - -Warning: str_shuffle() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 20 -- -string(0) "" --- Iteration 21 -- -string(0) "" -===DONE=== diff --git a/ext/standard/tests/strings/str_split_variation1.phpt b/ext/standard/tests/strings/str_split_variation1.phpt deleted file mode 100644 index 94eca406fd..0000000000 --- a/ext/standard/tests/strings/str_split_variation1.phpt +++ /dev/null @@ -1,241 +0,0 @@ ---TEST-- -Test str_split() function : usage variations - unexpected values for 'str' argument ---FILE-- -<?php -/* Prototype : array str_split(string $str [, int $split_length]) - * Description: Convert a string to an array. If split_length is - specified, break the string down into chunks each - split_length characters long. - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -echo "*** Testing str_split() : unexpected values for 'str' ***\n"; - -// Initialise function arguments -$split_length = 3; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//defining class for object variable -class MyClass -{ - public function __toString() - { - return "object"; - } -} - -//resource variable -$fp = fopen(__FILE__, 'r'); - -//different values for 'str' argument -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new MyClass(), - - // undefined data - @$undefined_var, - - // unset data - @$unset_var, - - //resource data - $fp -); - -// loop through each element of $values for 'str' argument -for($count = 0; $count < count($values); $count++) { - echo "-- Iteration ".($count+1)." --\n"; - var_dump( str_split($values[$count], $split_length) ); -} - -//closing resource -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing str_split() : unexpected values for 'str' *** --- Iteration 1 -- -array(1) { - [0]=> - string(1) "0" -} --- Iteration 2 -- -array(1) { - [0]=> - string(1) "1" -} --- Iteration 3 -- -array(2) { - [0]=> - string(3) "123" - [1]=> - string(2) "45" -} --- Iteration 4 -- -array(2) { - [0]=> - string(3) "-23" - [1]=> - string(2) "45" -} --- Iteration 5 -- -array(2) { - [0]=> - string(3) "10." - [1]=> - string(1) "5" -} --- Iteration 6 -- -array(2) { - [0]=> - string(3) "-10" - [1]=> - string(2) ".5" -} --- Iteration 7 -- -array(4) { - [0]=> - string(3) "105" - [1]=> - string(3) "000" - [2]=> - string(3) "000" - [3]=> - string(3) "000" -} --- Iteration 8 -- -array(3) { - [0]=> - string(3) "1.0" - [1]=> - string(3) "6E-" - [2]=> - string(1) "9" -} --- Iteration 9 -- -array(1) { - [0]=> - string(3) "0.5" -} --- Iteration 10 -- - -Warning: str_split() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: str_split() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: str_split() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: str_split() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: str_split() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 16 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 17 -- -array(1) { - [0]=> - string(1) "1" -} --- Iteration 18 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 19 -- -array(1) { - [0]=> - string(1) "1" -} --- Iteration 20 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 21 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 22 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 23 -- -array(2) { - [0]=> - string(3) "obj" - [1]=> - string(3) "ect" -} --- Iteration 24 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 25 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 26 -- - -Warning: str_split() expects parameter 1 to be string, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/str_split_variation2.phpt b/ext/standard/tests/strings/str_split_variation2.phpt deleted file mode 100644 index 0bb8304b56..0000000000 --- a/ext/standard/tests/strings/str_split_variation2.phpt +++ /dev/null @@ -1,290 +0,0 @@ ---TEST-- -Test str_split() function : usage variations - unexpected values for 'split_length' argument ---SKIPIF-- -<?php -if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); -?> ---FILE-- -<?php -/* Prototype : array str_split(string $str [, int $split_length]) - * Description: Convert a string to an array. If split_length is - specified, break the string down into chunks each - split_length characters long. - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -echo "*** Testing str_split() : unexpected values for 'split_length' ***\n"; - -// Initialise function arguments -$str = 'variation2:split_length'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//defining class for object variable -class MyClass -{ - public function __toString() - { - return "object"; - } -} - -//resource variable -$fp = fopen(__FILE__, 'r'); - -//different values for 'split_length' -$values = array( - - // float data - 10.5, - -10.5, - 10.6E10, - 10.6E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // object data - new MyClass(), - - // undefined data - @$undefined_var, - - // unset data - @$unset_var, - - //resource data - $fp -); - -// loop through each element of $values for 'split_length' -for($count = 0; $count < count($values); $count++) { - echo "--Iteration ".($count+1)." --\n"; - var_dump( str_split($str, $values[$count]) ); -} - -//closing resource -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing str_split() : unexpected values for 'split_length' *** ---Iteration 1 -- -array(3) { - [0]=> - string(10) "variation2" - [1]=> - string(10) ":split_len" - [2]=> - string(3) "gth" -} ---Iteration 2 -- - -Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d -bool(false) ---Iteration 3 -- - -Warning: str_split() expects parameter 2 to be int, float given in %s on line %d -NULL ---Iteration 4 -- - -Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d -bool(false) ---Iteration 5 -- - -Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d -bool(false) ---Iteration 6 -- - -Warning: str_split() expects parameter 2 to be int, array given in %sstr_split_variation2.php on line %d -NULL ---Iteration 7 -- - -Warning: str_split() expects parameter 2 to be int, array given in %sstr_split_variation2.php on line %d -NULL ---Iteration 8 -- - -Warning: str_split() expects parameter 2 to be int, array given in %sstr_split_variation2.php on line %d -NULL ---Iteration 9 -- - -Warning: str_split() expects parameter 2 to be int, array given in %sstr_split_variation2.php on line %d -NULL ---Iteration 10 -- - -Warning: str_split() expects parameter 2 to be int, array given in %sstr_split_variation2.php on line %d -NULL ---Iteration 11 -- - -Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d -bool(false) ---Iteration 12 -- - -Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d -bool(false) ---Iteration 13 -- -array(23) { - [0]=> - string(1) "v" - [1]=> - string(1) "a" - [2]=> - string(1) "r" - [3]=> - string(1) "i" - [4]=> - string(1) "a" - [5]=> - string(1) "t" - [6]=> - string(1) "i" - [7]=> - string(1) "o" - [8]=> - string(1) "n" - [9]=> - string(1) "2" - [10]=> - string(1) ":" - [11]=> - string(1) "s" - [12]=> - string(1) "p" - [13]=> - string(1) "l" - [14]=> - string(1) "i" - [15]=> - string(1) "t" - [16]=> - string(1) "_" - [17]=> - string(1) "l" - [18]=> - string(1) "e" - [19]=> - string(1) "n" - [20]=> - string(1) "g" - [21]=> - string(1) "t" - [22]=> - string(1) "h" -} ---Iteration 14 -- - -Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d -bool(false) ---Iteration 15 -- -array(23) { - [0]=> - string(1) "v" - [1]=> - string(1) "a" - [2]=> - string(1) "r" - [3]=> - string(1) "i" - [4]=> - string(1) "a" - [5]=> - string(1) "t" - [6]=> - string(1) "i" - [7]=> - string(1) "o" - [8]=> - string(1) "n" - [9]=> - string(1) "2" - [10]=> - string(1) ":" - [11]=> - string(1) "s" - [12]=> - string(1) "p" - [13]=> - string(1) "l" - [14]=> - string(1) "i" - [15]=> - string(1) "t" - [16]=> - string(1) "_" - [17]=> - string(1) "l" - [18]=> - string(1) "e" - [19]=> - string(1) "n" - [20]=> - string(1) "g" - [21]=> - string(1) "t" - [22]=> - string(1) "h" -} ---Iteration 16 -- - -Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d -bool(false) ---Iteration 17 -- - -Warning: str_split() expects parameter 2 to be int, string given in %sstr_split_variation2.php on line %d -NULL ---Iteration 18 -- - -Warning: str_split() expects parameter 2 to be int, string given in %sstr_split_variation2.php on line %d -NULL ---Iteration 19 -- - -Warning: str_split() expects parameter 2 to be int, string given in %sstr_split_variation2.php on line %d -NULL ---Iteration 20 -- - -Warning: str_split() expects parameter 2 to be int, string given in %sstr_split_variation2.php on line %d -NULL ---Iteration 21 -- - -Warning: str_split() expects parameter 2 to be int, object given in %sstr_split_variation2.php on line %d -NULL ---Iteration 22 -- - -Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d -bool(false) ---Iteration 23 -- - -Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d -bool(false) ---Iteration 24 -- - -Warning: str_split() expects parameter 2 to be int, resource given in %sstr_split_variation2.php on line %d -NULL -Done diff --git a/ext/standard/tests/strings/str_split_variation2_64bit.phpt b/ext/standard/tests/strings/str_split_variation2_64bit.phpt deleted file mode 100644 index 92a07498a4..0000000000 --- a/ext/standard/tests/strings/str_split_variation2_64bit.phpt +++ /dev/null @@ -1,291 +0,0 @@ ---TEST-- -Test str_split() function : usage variations - unexpected values for 'split_length' argument ---SKIPIF-- -<?php -if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); -?> ---FILE-- -<?php -/* Prototype : array str_split(string $str [, int $split_length]) - * Description: Convert a string to an array. If split_length is - specified, break the string down into chunks each - split_length characters long. - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -echo "*** Testing str_split() : unexpected values for 'split_length' ***\n"; - -// Initialise function arguments -$str = 'variation2:split_length'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//defining class for object variable -class MyClass -{ - public function __toString() - { - return "object"; - } -} - -//resource variable -$fp = fopen(__FILE__, 'r'); - -//different values for 'split_length' -$values = array( - - // float data - 10.5, - -10.5, - 10.6E10, - 10.6E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // object data - new MyClass(), - - // undefined data - @$undefined_var, - - // unset data - @$unset_var, - - //resource data - $fp -); - -// loop through each element of $values for 'split_length' -for($count = 0; $count < count($values); $count++) { - echo "--Iteration ".($count+1)." --\n"; - var_dump( str_split($str, $values[$count]) ); -} - -//closing resource -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing str_split() : unexpected values for 'split_length' *** ---Iteration 1 -- -array(3) { - [0]=> - string(10) "variation2" - [1]=> - string(10) ":split_len" - [2]=> - string(3) "gth" -} ---Iteration 2 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) ---Iteration 3 -- -array(1) { - [0]=> - string(23) "variation2:split_length" -} ---Iteration 4 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) ---Iteration 5 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) ---Iteration 6 -- - -Warning: str_split() expects parameter 2 to be int, array given in %s on line %d -NULL ---Iteration 7 -- - -Warning: str_split() expects parameter 2 to be int, array given in %s on line %d -NULL ---Iteration 8 -- - -Warning: str_split() expects parameter 2 to be int, array given in %s on line %d -NULL ---Iteration 9 -- - -Warning: str_split() expects parameter 2 to be int, array given in %s on line %d -NULL ---Iteration 10 -- - -Warning: str_split() expects parameter 2 to be int, array given in %s on line %d -NULL ---Iteration 11 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) ---Iteration 12 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) ---Iteration 13 -- -array(23) { - [0]=> - string(1) "v" - [1]=> - string(1) "a" - [2]=> - string(1) "r" - [3]=> - string(1) "i" - [4]=> - string(1) "a" - [5]=> - string(1) "t" - [6]=> - string(1) "i" - [7]=> - string(1) "o" - [8]=> - string(1) "n" - [9]=> - string(1) "2" - [10]=> - string(1) ":" - [11]=> - string(1) "s" - [12]=> - string(1) "p" - [13]=> - string(1) "l" - [14]=> - string(1) "i" - [15]=> - string(1) "t" - [16]=> - string(1) "_" - [17]=> - string(1) "l" - [18]=> - string(1) "e" - [19]=> - string(1) "n" - [20]=> - string(1) "g" - [21]=> - string(1) "t" - [22]=> - string(1) "h" -} ---Iteration 14 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) ---Iteration 15 -- -array(23) { - [0]=> - string(1) "v" - [1]=> - string(1) "a" - [2]=> - string(1) "r" - [3]=> - string(1) "i" - [4]=> - string(1) "a" - [5]=> - string(1) "t" - [6]=> - string(1) "i" - [7]=> - string(1) "o" - [8]=> - string(1) "n" - [9]=> - string(1) "2" - [10]=> - string(1) ":" - [11]=> - string(1) "s" - [12]=> - string(1) "p" - [13]=> - string(1) "l" - [14]=> - string(1) "i" - [15]=> - string(1) "t" - [16]=> - string(1) "_" - [17]=> - string(1) "l" - [18]=> - string(1) "e" - [19]=> - string(1) "n" - [20]=> - string(1) "g" - [21]=> - string(1) "t" - [22]=> - string(1) "h" -} ---Iteration 16 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) ---Iteration 17 -- - -Warning: str_split() expects parameter 2 to be int, string given in %s on line %d -NULL ---Iteration 18 -- - -Warning: str_split() expects parameter 2 to be int, string given in %s on line %d -NULL ---Iteration 19 -- - -Warning: str_split() expects parameter 2 to be int, string given in %s on line %d -NULL ---Iteration 20 -- - -Warning: str_split() expects parameter 2 to be int, string given in %s on line %d -NULL ---Iteration 21 -- - -Warning: str_split() expects parameter 2 to be int, object given in %s on line %d -NULL ---Iteration 22 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) ---Iteration 23 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) ---Iteration 24 -- - -Warning: str_split() expects parameter 2 to be int, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/strcasecmp.phpt b/ext/standard/tests/strings/strcasecmp.phpt Binary files differindex 9b1898fb35..3086c2be92 100644 --- a/ext/standard/tests/strings/strcasecmp.phpt +++ b/ext/standard/tests/strings/strcasecmp.phpt diff --git a/ext/standard/tests/strings/strcmp.phpt b/ext/standard/tests/strings/strcmp.phpt Binary files differindex ef659014a5..397e072c52 100644 --- a/ext/standard/tests/strings/strcmp.phpt +++ b/ext/standard/tests/strings/strcmp.phpt diff --git a/ext/standard/tests/strings/strcspn_variation1.phpt b/ext/standard/tests/strings/strcspn_variation1.phpt deleted file mode 100644 index 89a4e5cc72..0000000000 --- a/ext/standard/tests/strings/strcspn_variation1.phpt +++ /dev/null @@ -1,273 +0,0 @@ ---TEST-- -Test strcspn() function : usage variations - unexpected values for str argument ---FILE-- -<?php -/* Prototype : proto int strcspn(string str, string mask [, int start [, int len]]) - * Description: Finds length of initial segment consisting entirely of characters not found in mask. - If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars) - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -error_reporting(E_ALL & ~E_NOTICE); - -/* -* Testing strspn() : with different unexpected values for str argument -*/ - -echo "*** Testing strcspn() : with unexpected values for str argument ***\n"; - -// Initialise function arguments not being substititued (if any) -$mask = 'abons1234567890'; -$start = 1; -$len = 10; - - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// declaring class -class sample { - public function __toString() { - return "object"; - } -} - -// creating a file resource -$file_handle = fopen(__FILE__, 'r'); - - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new sample, - - // undefined data - $undefined_var, - - // unset data - $unset_var, - - // resource - $file_handle -); - -// loop through each element of the array for str - -foreach($values as $value) { - echo "\n-- Iteration with str value as \"$value\"\n"; - var_dump( strcspn($value,$mask) ); // with default args - var_dump( strcspn($value,$mask,$start) ); // with default len value - var_dump( strcspn($value,$mask,$start,$len) ); // with all args -}; - -// closing the resource -fclose($file_handle); - -echo "Done" -?> ---EXPECTF-- -*** Testing strcspn() : with unexpected values for str argument *** - --- Iteration with str value as "0" -int(0) -int(0) -int(0) - --- Iteration with str value as "1" -int(0) -int(0) -int(0) - --- Iteration with str value as "12345" -int(0) -int(0) -int(0) - --- Iteration with str value as "-2345" -int(1) -int(0) -int(0) - --- Iteration with str value as "10.5" -int(0) -int(0) -int(0) - --- Iteration with str value as "-10.5" -int(1) -int(0) -int(0) - --- Iteration with str value as "101234567000" -int(0) -int(0) -int(0) - --- Iteration with str value as "1.07654321E-9" -int(0) -int(1) -int(1) - --- Iteration with str value as "0.5" -int(0) -int(1) -int(1) - --- Iteration with str value as "Array" - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration with str value as "Array" - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration with str value as "Array" - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration with str value as "Array" - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration with str value as "Array" - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "1" -int(0) -int(0) -int(0) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "1" -int(0) -int(0) -int(0) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "object" -int(0) -int(0) -int(0) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "Resource id #%d" - -Warning: strcspn() expects parameter 1 to be string, resource given in %s on line %d -NULL - -Warning: strcspn() expects parameter 1 to be string, resource given in %s on line %d -NULL - -Warning: strcspn() expects parameter 1 to be string, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/strcspn_variation2.phpt b/ext/standard/tests/strings/strcspn_variation2.phpt deleted file mode 100644 index d7d25f2ec0..0000000000 --- a/ext/standard/tests/strings/strcspn_variation2.phpt +++ /dev/null @@ -1,272 +0,0 @@ ---TEST-- -Test strcspn() function : usage variations - unexpected values for mask argument ---FILE-- -<?php -/* Prototype : proto int strcspn(string str, string mask [, int start [, int len]]) - * Description: Finds length of initial segment consisting entirely of characters not found in mask. - If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars) - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -error_reporting(E_ALL & ~E_NOTICE); - -/* -* Testing strcspn() : with different unexpected values for mask argument -*/ - -echo "*** Testing strcspn() : with different unexpected values of mask argument ***\n"; - -$str = 'string_val'; -$start = 1; -$len = 10; - - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// declaring class -class sample { - public function __toString() { - return "object"; - } -} - -// creating a file resource -$file_handle = fopen(__FILE__, 'r'); - - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new sample(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, - - // resource - $file_handle -); - -// loop through each element of the array for mask - -foreach($values as $value) { - echo "\n-- Iteration with mask value as \"$value\" --\n"; - var_dump( strcspn($str,$value) ); // with defalut args - var_dump( strcspn($str,$value,$start) ); // with default len value - var_dump( strcspn($str,$value,$start,$len) ); // with all args -}; - -// close the resource -fclose($file_handle); - -echo "Done" -?> ---EXPECTF-- -*** Testing strcspn() : with different unexpected values of mask argument *** - --- Iteration with mask value as "0" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "1" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "12345" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "-2345" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "10.5" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "-10.5" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "101234567000" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "1.07654321E-9" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "0.5" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "Array" -- - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - --- Iteration with mask value as "Array" -- - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - --- Iteration with mask value as "Array" -- - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - --- Iteration with mask value as "Array" -- - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - --- Iteration with mask value as "Array" -- - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - --- Iteration with mask value as "" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "1" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "1" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "object" -- -int(1) -int(0) -int(0) - --- Iteration with mask value as "" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "Resource id #%d" -- - -Warning: strcspn() expects parameter 2 to be string, resource given in %s on line %d -NULL - -Warning: strcspn() expects parameter 2 to be string, resource given in %s on line %d -NULL - -Warning: strcspn() expects parameter 2 to be string, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/strcspn_variation3.phpt b/ext/standard/tests/strings/strcspn_variation3.phpt deleted file mode 100644 index 745fe88b4c..0000000000 --- a/ext/standard/tests/strings/strcspn_variation3.phpt +++ /dev/null @@ -1,243 +0,0 @@ ---TEST-- -Test strcspn() function : usage variations - unexpected values of start argument ---FILE-- -<?php -/* Prototype : proto int strcspn(string str, string mask [,int start [,int len]]) - * Description: Finds length of initial segment consisting entirely of characters not found in mask. - If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars) - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -error_reporting(E_ALL & ~E_NOTICE); - -/* -* Testing strcspn() : with unexpected values of start argument -*/ - -echo "*** Testing strcspn() : with unexpected values of start argument ***\n"; - -// initialing required variables -$str = 'string_val'; -$mask = 'soibtFTf1234567890'; -$len = 10; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// declaring class -class sample { - public function __toString() { - return "object"; - } -} - -// creating a file resource -$file_handle = fopen(__FILE__, 'r'); - - -//array of values to iterate over -$values = array( - - // float data - 10.5, - -10.5, - 10.1234567e8, - 10.7654321E-8, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // object data - new sample(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, - - // resource - $file_handle -); - -// loop through each element of the array for start - -foreach($values as $value) { - echo "\n-- Iteration with start value as \"$value\" --\n"; - var_dump( strcspn($str,$mask,$value) ); // with default len value - var_dump( strcspn($str,$mask,$value,$len) ); // with all args -}; - -// closing the resource -fclose($file_handle); - -echo "Done" -?> ---EXPECTF-- -*** Testing strcspn() : with unexpected values of start argument *** - --- Iteration with start value as "10.5" -- -int(0) -int(0) - --- Iteration with start value as "-10.5" -- -int(0) -int(0) - --- Iteration with start value as "1012345670" -- -bool(false) -bool(false) - --- Iteration with start value as "1.07654321E-7" -- -int(0) -int(0) - --- Iteration with start value as "0.5" -- -int(0) -int(0) - --- Iteration with start value as "Array" -- - -Warning: strcspn() expects parameter 3 to be int, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be int, array given in %s on line %d -NULL - --- Iteration with start value as "Array" -- - -Warning: strcspn() expects parameter 3 to be int, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be int, array given in %s on line %d -NULL - --- Iteration with start value as "Array" -- - -Warning: strcspn() expects parameter 3 to be int, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be int, array given in %s on line %d -NULL - --- Iteration with start value as "Array" -- - -Warning: strcspn() expects parameter 3 to be int, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be int, array given in %s on line %d -NULL - --- Iteration with start value as "Array" -- - -Warning: strcspn() expects parameter 3 to be int, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be int, array given in %s on line %d -NULL - --- Iteration with start value as "" -- -int(0) -int(0) - --- Iteration with start value as "" -- -int(0) -int(0) - --- Iteration with start value as "1" -- -int(0) -int(0) - --- Iteration with start value as "" -- -int(0) -int(0) - --- Iteration with start value as "1" -- -int(0) -int(0) - --- Iteration with start value as "" -- -int(0) -int(0) - --- Iteration with start value as "" -- - -Warning: strcspn() expects parameter 3 to be int, string given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be int, string given in %s on line %d -NULL - --- Iteration with start value as "" -- - -Warning: strcspn() expects parameter 3 to be int, string given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be int, string given in %s on line %d -NULL - --- Iteration with start value as "string" -- - -Warning: strcspn() expects parameter 3 to be int, string given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be int, string given in %s on line %d -NULL - --- Iteration with start value as "string" -- - -Warning: strcspn() expects parameter 3 to be int, string given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be int, string given in %s on line %d -NULL - --- Iteration with start value as "object" -- - -Warning: strcspn() expects parameter 3 to be int, object given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be int, object given in %s on line %d -NULL - --- Iteration with start value as "" -- -int(0) -int(0) - --- Iteration with start value as "" -- -int(0) -int(0) - --- Iteration with start value as "Resource id #%d" -- - -Warning: strcspn() expects parameter 3 to be int, resource given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be int, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/strcspn_variation4.phpt b/ext/standard/tests/strings/strcspn_variation4.phpt deleted file mode 100644 index 0af1228293..0000000000 --- a/ext/standard/tests/strings/strcspn_variation4.phpt +++ /dev/null @@ -1,198 +0,0 @@ ---TEST-- -Test strcspn() function : usage variations - unexpected values of len argument ---SKIPIF-- -<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); ---FILE-- -<?php -/* Prototype : proto int strcspn(string str, string mask [, int start [, int len]]) - * Description: Finds length of initial segment consisting entirely of characters not found in mask. - If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars) - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -error_reporting(E_ALL & ~E_NOTICE); - -/* -* Testing strcspn() : with unexpected values of len argument -*/ - -echo "*** Testing strcspn() : with unexpected values of len argument ***\n"; - -// initialing required variables -$str = 'string_val'; -$mask = 'soibtFTf1234567890'; -$start = 0; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// declaring class -class sample { - public function __toString() { - return "object"; - } -} - -// creating a file resource -$file_handle = fopen(__FILE__, 'r'); - - -//array of values to iterate over -$values = array( - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // object data - new sample(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, - - // resource - $file_handle -); - -// loop through each element of the array for start - -foreach($values as $value) { - echo "\n-- Iteration with len value as \"$value\" --\n"; - var_dump( strcspn($str,$mask,$start,$value) ); // with all args -}; - -// closing the resource -fclose($file_handle); - -echo "Done" -?> ---EXPECTF-- -*** Testing strcspn() : with unexpected values of len argument *** - --- Iteration with len value as "10.5" -- -int(0) - --- Iteration with len value as "-10.5" -- -int(0) - --- Iteration with len value as "101234567000" -- -int(0) - --- Iteration with len value as "1.07654321E-9" -- -int(0) - --- Iteration with len value as "0.5" -- -int(0) - --- Iteration with len value as "Array" -- - -Warning: strcspn() expects parameter 4 to be int, array given in %s on line %d -NULL - --- Iteration with len value as "Array" -- - -Warning: strcspn() expects parameter 4 to be int, array given in %s on line %d -NULL - --- Iteration with len value as "Array" -- - -Warning: strcspn() expects parameter 4 to be int, array given in %s on line %d -NULL - --- Iteration with len value as "Array" -- - -Warning: strcspn() expects parameter 4 to be int, array given in %s on line %d -NULL - --- Iteration with len value as "Array" -- - -Warning: strcspn() expects parameter 4 to be int, array given in %s on line %d -NULL - --- Iteration with len value as "" -- -int(0) - --- Iteration with len value as "" -- -int(0) - --- Iteration with len value as "1" -- -int(0) - --- Iteration with len value as "" -- -int(0) - --- Iteration with len value as "1" -- -int(0) - --- Iteration with len value as "" -- -int(0) - --- Iteration with len value as "" -- - -Warning: strcspn() expects parameter 4 to be int, string given in %s on line %d -NULL - --- Iteration with len value as "" -- - -Warning: strcspn() expects parameter 4 to be int, string given in %s on line %d -NULL - --- Iteration with len value as "string" -- - -Warning: strcspn() expects parameter 4 to be int, string given in %s on line %d -NULL - --- Iteration with len value as "string" -- - -Warning: strcspn() expects parameter 4 to be int, string given in %s on line %d -NULL - --- Iteration with len value as "object" -- - -Warning: strcspn() expects parameter 4 to be int, object given in %s on line %d -NULL - --- Iteration with len value as "" -- -int(0) - --- Iteration with len value as "" -- -int(0) - --- Iteration with len value as "Resource id #%d" -- - -Warning: strcspn() expects parameter 4 to be int, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/strings001.phpt b/ext/standard/tests/strings/strings001.phpt index 70b709295d..4784248212 100644 --- a/ext/standard/tests/strings/strings001.phpt +++ b/ext/standard/tests/strings/strings001.phpt @@ -2,7 +2,6 @@ Test whether strstr() and strrchr() are binary safe. --FILE-- <?php -/* Do not change this test it is a README.TESTING example. */ $s = "alabala nica".chr(0)."turska panica"; var_dump(strstr($s, "nic")); var_dump(strrchr($s," nic")); diff --git a/ext/standard/tests/strings/strip_tags_array.phpt b/ext/standard/tests/strings/strip_tags_array.phpt new file mode 100644 index 0000000000..5c2e6118e6 --- /dev/null +++ b/ext/standard/tests/strings/strip_tags_array.phpt @@ -0,0 +1,32 @@ +--TEST-- +Test strip_tags() function : basic functionality - with array argument +--FILE-- +<?php + +$string = '<p>foo <b>bar</b> <a href="#">foobar</a></p>'; +var_dump(strip_tags($string)); +var_dump(strip_tags($string, ['a'])); +var_dump(strip_tags($string, ['p', 'a'])); +var_dump(strip_tags($string, [])); +var_dump(strip_tags($string, ['p' => true, 'a' => false])); +var_dump(strip_tags($string, ['p' => 'a'])); + +// Previous tests from strip_tags_variation2.phpt +var_dump(strip_tags($string, [0])); +var_dump(strip_tags($string, [1])); +var_dump(strip_tags($string, [1, 2])); +var_dump(strip_tags($string, ['color' => 'red', 'item' => 'pen'])); +echo "Done"; +?> +--EXPECT-- +string(14) "foo bar foobar" +string(30) "foo bar <a href="#">foobar</a>" +string(37) "<p>foo bar <a href="#">foobar</a></p>" +string(14) "foo bar foobar" +string(14) "foo bar foobar" +string(30) "foo bar <a href="#">foobar</a>" +string(14) "foo bar foobar" +string(14) "foo bar foobar" +string(14) "foo bar foobar" +string(14) "foo bar foobar" +Done diff --git a/ext/standard/tests/strings/strip_tags_variation1.phpt b/ext/standard/tests/strings/strip_tags_variation1.phpt deleted file mode 100644 index cca444c0e0..0000000000 --- a/ext/standard/tests/strings/strip_tags_variation1.phpt +++ /dev/null @@ -1,159 +0,0 @@ ---TEST-- -Test strip_tags() function : usage variations - unexpected values for 'str' argument ---INI-- -set short_open_tag = on ---FILE-- -<?php -/* Prototype : string strip_tags(string $str [, string $allowable_tags]) - * Description: Strips HTML and PHP tags from a string - * Source code: ext/standard/string.c -*/ - -/* - * testing functionality of strip_tags() by giving unexpected input values for $str argument -*/ - -echo "*** Testing strip_tags() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//get a resource variable -$fp = fopen(__FILE__, "r"); - -//get a class -class classA{ - public function __toString(){ - return "Class A object"; - } -} - -//array of values to iterate over -$values = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data -/*10*/ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data -/*15*/ NULL, - null, - - // boolean data -/*17*/ true, - false, - TRUE, - FALSE, - - // empty data -/*21*/ "", - '', - - // object data -/*23*/ new classA(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - // resource variable -/*26*/ $fp - -); - -// loop through each element of the array for allowable_tags -$iterator = 1; -foreach($values as $value) { - echo "-- Iteration $iterator --\n"; - var_dump( strip_tags($value) ); - $iterator++; -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing strip_tags() : usage variations *** --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(5) "12345" --- Iteration 4 -- -string(5) "-2345" --- Iteration 5 -- -string(4) "10.5" --- Iteration 6 -- -string(5) "-10.5" --- Iteration 7 -- -string(12) "101234567000" --- Iteration 8 -- -string(13) "1.07654321E-9" --- Iteration 9 -- -string(3) "0.5" --- Iteration 10 -- - -Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(0) "" --- Iteration 16 -- -string(0) "" --- Iteration 17 -- -string(1) "1" --- Iteration 18 -- -string(0) "" --- Iteration 19 -- -string(1) "1" --- Iteration 20 -- -string(0) "" --- Iteration 21 -- -string(0) "" --- Iteration 22 -- -string(0) "" --- Iteration 23 -- -string(14) "Class A object" --- Iteration 24 -- -string(0) "" --- Iteration 25 -- -string(0) "" --- Iteration 26 -- - -Warning: strip_tags() expects parameter 1 to be string, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/strings/strip_tags_variation2.phpt b/ext/standard/tests/strings/strip_tags_variation2.phpt index a32e3eccad..c30f29dc3f 100644 --- a/ext/standard/tests/strings/strip_tags_variation2.phpt +++ b/ext/standard/tests/strings/strip_tags_variation2.phpt @@ -48,13 +48,6 @@ $values = array( 10.6E-10, .5, - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - // null data NULL, null, @@ -113,24 +106,14 @@ string(10) "helloworld" -- Iteration 9 -- string(10) "helloworld" -- Iteration 10 -- - -Notice: Array to string conversion in %s on line %d string(10) "helloworld" -- Iteration 11 -- - -Notice: Array to string conversion in %s on line %d string(10) "helloworld" -- Iteration 12 -- - -Notice: Array to string conversion in %s on line %d string(10) "helloworld" -- Iteration 13 -- - -Notice: Array to string conversion in %s on line %d string(10) "helloworld" -- Iteration 14 -- - -Notice: Array to string conversion in %s on line %d string(10) "helloworld" -- Iteration 15 -- string(10) "helloworld" @@ -146,14 +129,4 @@ string(10) "helloworld" string(10) "helloworld" -- Iteration 21 -- string(10) "helloworld" --- Iteration 22 -- -string(10) "helloworld" --- Iteration 23 -- -string(10) "helloworld" --- Iteration 24 -- -string(10) "helloworld" --- Iteration 25 -- -string(10) "helloworld" --- Iteration 26 -- -string(10) "helloworld" Done diff --git a/ext/standard/tests/strings/strip_tags_variation3.phpt b/ext/standard/tests/strings/strip_tags_variation3.phpt deleted file mode 100644 index d6dc34a080..0000000000 --- a/ext/standard/tests/strings/strip_tags_variation3.phpt +++ /dev/null @@ -1,159 +0,0 @@ ---TEST-- -Test strip_tags() function : usage variations - unexpected values for both 'str' and 'allowable_tags' ---INI-- -set short_open_tag = on ---FILE-- -<?php -/* Prototype : string strip_tags(string $str [, string $allowable_tags]) - * Description: Strips HTML and PHP tags from a string - * Source code: ext/standard/string.c -*/ - -/* - * testing functionality of strip_tags() by giving unexpected values for $str and $allowable_tags arguments -*/ - -echo "*** Testing strip_tags() : usage variations ***\n"; - -// get a resource -$fp=fopen(__FILE__, "r"); - -// get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA{ - public function __toString(){ - return "Class A object"; - } -} - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new classA(), - - // undefined data - @$undefined_var, - - // unset data - @$unset_var, - - // resource variable - $fp - -); - -// loop through each element of the array for allowable_tags -$iterator = 1; -foreach($values as $value) { - echo "-- Iteration $iterator --\n"; - var_dump( strip_tags($value, $value) ); - $iterator++; -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing strip_tags() : usage variations *** --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(5) "12345" --- Iteration 4 -- -string(5) "-2345" --- Iteration 5 -- -string(4) "10.5" --- Iteration 6 -- -string(5) "-10.5" --- Iteration 7 -- -string(12) "101234567000" --- Iteration 8 -- -string(13) "1.07654321E-9" --- Iteration 9 -- -string(3) "0.5" --- Iteration 10 -- - -Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(0) "" --- Iteration 16 -- -string(0) "" --- Iteration 17 -- -string(1) "1" --- Iteration 18 -- -string(0) "" --- Iteration 19 -- -string(1) "1" --- Iteration 20 -- -string(0) "" --- Iteration 21 -- -string(0) "" --- Iteration 22 -- -string(0) "" --- Iteration 23 -- -string(14) "Class A object" --- Iteration 24 -- -string(0) "" --- Iteration 25 -- -string(0) "" --- Iteration 26 -- - -Warning: strip_tags() expects parameter 1 to be string, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/strings/stripcslashes_variation1.phpt b/ext/standard/tests/strings/stripcslashes_variation1.phpt deleted file mode 100644 index fe3a786678..0000000000 --- a/ext/standard/tests/strings/stripcslashes_variation1.phpt +++ /dev/null @@ -1,173 +0,0 @@ ---TEST-- -Test stripcslashes() function : usage variations - non-string type argument ---FILE-- -<?php -/* Prototype : string stripcslashes ( string $str ) - * Description: Returns a string with backslashes stripped off. Recognizes C-like \n, \r ..., - * octal and hexadecimal representation. - * Source code: ext/standard/string.c -*/ - -/* - * Test stripcslashes() with non-string type argument such as int, float, etc -*/ - -echo "*** Testing stripcslashes() : with non-string type argument ***\n"; -// initialize all required variables - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// declaring a class -class sample { - public function __toString() { - return "obj'ct"; - } -} - -// Defining resource -$file_handle = fopen(__FILE__, 'r'); - -// array with different values -$values = array ( - - // integer values -/*1*/ 0, - 1, - 12345, - -2345, - - // float values -/*5*/ 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array values -/*10*/ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values -/*15*/ true, - false, - TRUE, - FALSE, - - // empty string -/*19*/ "", - '', - - // undefined variable -/*21*/ $undefined_var, - - // unset variable -/*22*/ $unset_var, - - // objects -/*23*/ new sample(), - - // resource -/*24*/ $file_handle, - - // null values -/*25*/ NULL, - null -); - - -// loop through each element of the array and check the working of stripcslashes() -// when $str argument is supplied with different values -echo "\n--- Testing stripcslashes() by supplying different values for 'str' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $str = $values [$index]; - - var_dump( stripcslashes($str) ); - - $counter ++; -} - -// closing the file -fclose($file_handle); - -?> -===DONE=== ---EXPECTF-- -*** Testing stripcslashes() : with non-string type argument *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - ---- Testing stripcslashes() by supplying different values for 'str' argument --- --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(5) "12345" --- Iteration 4 -- -string(5) "-2345" --- Iteration 5 -- -string(4) "10.5" --- Iteration 6 -- -string(5) "-10.5" --- Iteration 7 -- -string(12) "101234567000" --- Iteration 8 -- -string(13) "1.07654321E-9" --- Iteration 9 -- -string(3) "0.5" --- Iteration 10 -- - -Warning: stripcslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: stripcslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: stripcslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: stripcslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: stripcslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(1) "1" --- Iteration 16 -- -string(0) "" --- Iteration 17 -- -string(1) "1" --- Iteration 18 -- -string(0) "" --- Iteration 19 -- -string(0) "" --- Iteration 20 -- -string(0) "" --- Iteration 21 -- -string(0) "" --- Iteration 22 -- -string(0) "" --- Iteration 23 -- -string(6) "obj'ct" --- Iteration 24 -- - -Warning: stripcslashes() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 25 -- -string(0) "" --- Iteration 26 -- -string(0) "" -===DONE=== diff --git a/ext/standard/tests/strings/stripos_variation14.phpt b/ext/standard/tests/strings/stripos_variation14.phpt deleted file mode 100644 index 10b481fb71..0000000000 --- a/ext/standard/tests/strings/stripos_variation14.phpt +++ /dev/null @@ -1,153 +0,0 @@ ---TEST-- -Test stripos() function : usage variations - unexpected inputs for 'offset' argument ---FILE-- -<?php -/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] ); - * Description: Find position of first occurrence of a case-insensitive string - * Source code: ext/standard/string.c -*/ - -/* Test stripos() function with unexpected inputs for 'offset' argument */ - -echo "*** Testing stripos() function with unexpected values for offset ***\n"; - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// defining a class -class sample { - public function __toString() { - return "object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -//definition of input args -$haystack = "hello world"; -$needle = "world"; - -// array with different values -$offsets = array ( - - // float values - 1.5, - -1.5, - 1.5e6, - 1.6E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // objects - new sample(), - - // empty string - "", - '', - - // null values - NULL, - null, - - //resource - $file_handle, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - - -// loop through each element of the array and check the working of stripos() -$counter = 1; -for($index = 0; $index < count($offsets); $index ++) { - echo "-- Iteration $counter --\n"; - var_dump( stripos($haystack, $needle, $offsets[$index]) ); - $counter ++; -} - -echo "*** Done ***"; -?> ---EXPECTF-- -*** Testing stripos() function with unexpected values for offset *** --- Iteration 1 -- -int(6) --- Iteration 2 -- -bool(false) --- Iteration 3 -- - -Warning: stripos(): Offset not contained in string in %s on line %d -bool(false) --- Iteration 4 -- -int(6) --- Iteration 5 -- -int(6) --- Iteration 6 -- - -Warning: stripos() expects parameter 3 to be int, array given in %s on line %d -NULL --- Iteration 7 -- - -Warning: stripos() expects parameter 3 to be int, array given in %s on line %d -NULL --- Iteration 8 -- - -Warning: stripos() expects parameter 3 to be int, array given in %s on line %d -NULL --- Iteration 9 -- - -Warning: stripos() expects parameter 3 to be int, array given in %s on line %d -NULL --- Iteration 10 -- - -Warning: stripos() expects parameter 3 to be int, array given in %s on line %d -NULL --- Iteration 11 -- -int(6) --- Iteration 12 -- -int(6) --- Iteration 13 -- -int(6) --- Iteration 14 -- -int(6) --- Iteration 15 -- - -Warning: stripos() expects parameter 3 to be int, object given in %s on line %d -NULL --- Iteration 16 -- - -Warning: stripos() expects parameter 3 to be int, string given in %s on line %d -NULL --- Iteration 17 -- - -Warning: stripos() expects parameter 3 to be int, string given in %s on line %d -NULL --- Iteration 18 -- -int(6) --- Iteration 19 -- -int(6) --- Iteration 20 -- - -Warning: stripos() expects parameter 3 to be int, resource given in %s on line %d -NULL --- Iteration 21 -- -int(6) --- Iteration 22 -- -int(6) -*** Done *** diff --git a/ext/standard/tests/strings/stripos_variation9.phpt b/ext/standard/tests/strings/stripos_variation9.phpt deleted file mode 100644 index c0713c57ab..0000000000 --- a/ext/standard/tests/strings/stripos_variation9.phpt +++ /dev/null @@ -1,184 +0,0 @@ ---TEST-- -Test stripos() function : usage variations - unexpected inputs for 'haystack' argument ---FILE-- -<?php -/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] ); - * Description: Find position of first occurrence of a case-insensitive string - * Source code: ext/standard/string.c -*/ - -/* Test stripos() function with unexpected inputs for haystack argument */ - -echo "*** Testing stripos() function with unexpected values for haystack ***\n"; - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// defining a class -class sample { - public function __toString() { - return "object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values -$haystacks = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // float values - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // objects - new sample(), - - // empty string - "", - '', - - // null values - NULL, - null, - - // resource - $file_handle, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - -$needle = "heredoc 0 1 2 -2 10.5 -10.5 10.5e10 10.6E-10 .5 array true false object \"\" null Resource"; - -// loop through each element of the array and check the working of stripos() -$counter = 1; -for($index = 0; $index < count($haystacks); $index ++) { - echo "\n-- Iteration $counter --\n"; - var_dump( stripos($haystacks[$index], $needle) ); - $counter ++; -} - -fclose($file_handle); //closing the file handle - -echo "*** Done ***"; -?> ---EXPECTF-- -*** Testing stripos() function with unexpected values for haystack *** - --- Iteration 1 -- -bool(false) - --- Iteration 2 -- -bool(false) - --- Iteration 3 -- -bool(false) - --- Iteration 4 -- -bool(false) - --- Iteration 5 -- -bool(false) - --- Iteration 6 -- -bool(false) - --- Iteration 7 -- -bool(false) - --- Iteration 8 -- -bool(false) - --- Iteration 9 -- -bool(false) - --- Iteration 10 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 12 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 13 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 14 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 15 -- -bool(false) - --- Iteration 16 -- -bool(false) - --- Iteration 17 -- -bool(false) - --- Iteration 18 -- -bool(false) - --- Iteration 19 -- -bool(false) - --- Iteration 20 -- -bool(false) - --- Iteration 21 -- -bool(false) - --- Iteration 22 -- -bool(false) - --- Iteration 23 -- -bool(false) - --- Iteration 24 -- - -Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d -NULL - --- Iteration 25 -- -bool(false) - --- Iteration 26 -- -bool(false) -*** Done *** diff --git a/ext/standard/tests/strings/stripslashes_variation1.phpt b/ext/standard/tests/strings/stripslashes_variation1.phpt deleted file mode 100644 index 2f9239ceee..0000000000 --- a/ext/standard/tests/strings/stripslashes_variation1.phpt +++ /dev/null @@ -1,172 +0,0 @@ ---TEST-- -Test stripslashes() function : usage variations - non-string type argument ---FILE-- -<?php -/* Prototype : string stripslashes ( string $str ) - * Description: Returns an un-quoted string - * Source code: ext/standard/string.c -*/ - -/* - * Test stripslashes() with non-string type argument such as int, float, etc -*/ - -echo "*** Testing stripslashes() : with non-string type argument ***\n"; -// initialize all required variables - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// declaring a class -class sample { - public function __toString() { - return "obj\'ct"; - } -} - -// Defining resource -$file_handle = fopen(__FILE__, 'r'); - -// array with different values -$values = array ( - - // integer values -/*1*/ 0, - 1, - 12345, - -2345, - - // float values -/*5*/ 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array values -/*10*/ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values -/*15*/ true, - false, - TRUE, - FALSE, - - // empty string -/*19*/ "", - '', - - // undefined variable -/*21*/ $undefined_var, - - // unset variable -/*22*/ $unset_var, - - // objects -/*23*/ new sample(), - - // resource -/*24*/ $file_handle, - - // null values -/*25*/ NULL, - null -); - - -// loop through each element of the array and check the working of stripslashes() -// when $str argument is supplied with different values -echo "\n--- Testing stripslashes() by supplying different values for 'str' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $str = $values [$index]; - - var_dump( stripslashes($str) ); - - $counter ++; -} - -// closing the file -fclose($file_handle); - -?> -===DONE=== ---EXPECTF-- -*** Testing stripslashes() : with non-string type argument *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - ---- Testing stripslashes() by supplying different values for 'str' argument --- --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(5) "12345" --- Iteration 4 -- -string(5) "-2345" --- Iteration 5 -- -string(4) "10.5" --- Iteration 6 -- -string(5) "-10.5" --- Iteration 7 -- -string(12) "101234567000" --- Iteration 8 -- -string(13) "1.07654321E-9" --- Iteration 9 -- -string(3) "0.5" --- Iteration 10 -- - -Warning: stripslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: stripslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: stripslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: stripslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: stripslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(1) "1" --- Iteration 16 -- -string(0) "" --- Iteration 17 -- -string(1) "1" --- Iteration 18 -- -string(0) "" --- Iteration 19 -- -string(0) "" --- Iteration 20 -- -string(0) "" --- Iteration 21 -- -string(0) "" --- Iteration 22 -- -string(0) "" --- Iteration 23 -- -string(6) "obj'ct" --- Iteration 24 -- - -Warning: stripslashes() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 25 -- -string(0) "" --- Iteration 26 -- -string(0) "" -===DONE=== diff --git a/ext/standard/tests/strings/stristr_variation1.phpt b/ext/standard/tests/strings/stristr_variation1.phpt deleted file mode 100644 index 795bf09323..0000000000 --- a/ext/standard/tests/strings/stristr_variation1.phpt +++ /dev/null @@ -1,133 +0,0 @@ ---TEST-- -Test stristr() function : usage variations - test values for $haystack argument ---FILE-- -<?php - -/* Prototype: string stristr ( string $haystack, string $needle ); - Description: Case-insensitive strstr(). -*/ - -echo "*** Testing stristr() function: with unexpected inputs for 'string' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - -2, - -PHP_INT_MAX, - - // float values -/*5*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*8*/ array(), - array(0), - array(1, 2), - - // boolean values -/*11*/ true, - false, - TRUE, - FALSE, - - // null values -/*15*/ NULL, - null, - - // objects -/*17*/ new sample(), - - // resource -/*18*/ $file_handle, - - // undefined variable -/*19*/ @$undefined_var, - - // unset variable -/*20*/ @$unset_var -); - -//defining '$pad_length' argument -$pad_length = "20"; - -// loop through with each element of the $inputs array to test stristr() function -$count = 1; -foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - var_dump( stristr($input, " ") ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing stristr() function: with unexpected inputs for 'string' argument *** --- Iteration 1 -- -bool(false) --- Iteration 2 -- -bool(false) --- Iteration 3 -- -bool(false) --- Iteration 4 -- -bool(false) --- Iteration 5 -- -bool(false) --- Iteration 6 -- -bool(false) --- Iteration 7 -- -bool(false) --- Iteration 8 -- - -Warning: stristr() expects parameter 1 to be string, array given in %s on line %d2 -NULL --- Iteration 9 -- - -Warning: stristr() expects parameter 1 to be string, array given in %s on line %d2 -NULL --- Iteration 10 -- - -Warning: stristr() expects parameter 1 to be string, array given in %s on line %d2 -NULL --- Iteration 11 -- -bool(false) --- Iteration 12 -- -bool(false) --- Iteration 13 -- -bool(false) --- Iteration 14 -- -bool(false) --- Iteration 15 -- -bool(false) --- Iteration 16 -- -bool(false) --- Iteration 17 -- -string(7) " object" --- Iteration 18 -- - -Warning: stristr() expects parameter 1 to be string, resource given in %s on line %d2 -NULL --- Iteration 19 -- -bool(false) --- Iteration 20 -- -bool(false) -===DONE=== diff --git a/ext/standard/tests/strings/strlen.phpt b/ext/standard/tests/strings/strlen.phpt Binary files differindex 8e6f857b74..a546bdb8d2 100644 --- a/ext/standard/tests/strings/strlen.phpt +++ b/ext/standard/tests/strings/strlen.phpt diff --git a/ext/standard/tests/strings/strncasecmp_variation10.phpt b/ext/standard/tests/strings/strncasecmp_variation10.phpt deleted file mode 100644 index 1c5708ae69..0000000000 --- a/ext/standard/tests/strings/strncasecmp_variation10.phpt +++ /dev/null @@ -1,188 +0,0 @@ ---TEST-- -Test strncasecmp() function : usage variations - unexpected values for 'str1' ---FILE-- -<?php -/* Prototype : int strncasecmp ( string $str1, string $str2, int $len ); - * Description: Binary safe case-insensitive string comparison of the first n characters - * Source code: Zend/zend_builtin_functions.c -*/ - -/* Test strncasecmp() function with the unexpected inputs for 'str1' */ - -echo "*** Testing strncasecmp() function: with unexpected values for 'str1' ***\n"; -/* get an unset variable */ -$unset_var = 'string_val'; -unset($unset_var); - -/* get resource handle */ -$file_handle = fopen(__FILE__, "r"); - -/* declaring a class */ -class sample { - public function __toString() { - return "object"; - } -} - - -/* array with different values */ -$values = array ( - /* integer values */ - 0, - 1, - 12345, - -2345, - - /* float values */ - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - /* hexadecimal values */ - 0x12, - -0x12, - - /* octal values */ - 012, - -012, - 01.2, - - /* array values */ - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - /* boolean values */ - true, - false, - TRUE, - FALSE, - - /* nulls */ - NULL, - null, - - /* empty string */ - "", - '', - - /* undefined variable */ - @$undefined_var, - - /* unset variable */ - @$unset_var, - - /* resource */ - $file_handle, - - /* object */ - new sample() -); - -/* loop through each element of the array and check the working of strncasecmp() */ -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $str1 = $values[$index]; - $len = strlen($values[$index]) + 1; - var_dump( strncasecmp($str1, "string", $len) ); - $counter ++; -} - -fclose($file_handle); //closing the file handle - -echo "*** Done ***\n"; -?> ---EXPECTF-- -*** Testing strncasecmp() function: with unexpected values for 'str1' *** --- Iteration 1 -- -int(-%d) --- Iteration 2 -- -int(-%d) --- Iteration 3 -- -int(-%d) --- Iteration 4 -- -int(-%d) --- Iteration 5 -- -int(-%d) --- Iteration 6 -- -int(-%d) --- Iteration 7 -- -int(-%d) --- Iteration 8 -- -int(-%d) --- Iteration 9 -- -int(-%d) --- Iteration 10 -- -int(-%d) --- Iteration 11 -- -int(-%d) --- Iteration 12 -- -int(-%d) --- Iteration 13 -- -int(-%d) --- Iteration 14 -- -int(-%d) --- Iteration 15 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line 88 - -Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line 89 -NULL --- Iteration 16 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line 88 - -Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line 89 -NULL --- Iteration 17 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line 88 - -Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line 89 -NULL --- Iteration 18 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line 88 - -Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line 89 -NULL --- Iteration 19 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line 88 - -Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line 89 -NULL --- Iteration 20 -- -int(-%d) --- Iteration 21 -- -int(-%d) --- Iteration 22 -- -int(-%d) --- Iteration 23 -- -int(-%d) --- Iteration 24 -- -int(-%d) --- Iteration 25 -- -int(-%d) --- Iteration 26 -- -int(-%d) --- Iteration 27 -- -int(-%d) --- Iteration 28 -- -int(-%d) --- Iteration 29 -- -int(-%d) --- Iteration 30 -- - -Warning: strlen() expects parameter 1 to be string, resource given in %s on line 88 - -Warning: strncasecmp() expects parameter 1 to be string, resource given in %s on line 89 -NULL --- Iteration 31 -- -int(-%d) -*** Done *** diff --git a/ext/standard/tests/strings/strncasecmp_variation11.phpt b/ext/standard/tests/strings/strncasecmp_variation11.phpt deleted file mode 100644 index 362bbf1167..0000000000 --- a/ext/standard/tests/strings/strncasecmp_variation11.phpt +++ /dev/null @@ -1,189 +0,0 @@ ---TEST-- -Test strncasecmp() function : usage variations - unexpected values for 'str2' ---FILE-- -<?php -/* Prototype : int strncasecmp ( string $str1, string $str2, int $len ); - * Description: Binary safe case-insensitive string comparison of the first n characters - * Source code: Zend/zend_builtin_functions.c -*/ - -/* Test strncasecmp() function with the unexpected inputs for 'str2' */ - -echo "*** Testing strncasecmp() function: with unexpected values for 'str2' ***\n"; -/* get an unset variable */ -$unset_var = 'string_val'; -unset($unset_var); - -/* get resource handle */ -$file_handle = fopen(__FILE__, "r"); - -/* declaring a class */ -class sample { - public function __toString() { - return "object"; - } -} - - -/* array with different values */ -$values = array ( - /* integer values */ - 0, - 1, - 12345, - -2345, - - /* float values */ - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - /* hexadecimal values */ - 0x12, - -0x12, - - /* octal values */ - 012, - -012, - 01.2, - - /* array values */ - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - /* boolean values */ - true, - false, - TRUE, - FALSE, - - /* nulls */ - NULL, - null, - - /* empty string */ - "", - '', - - /* undefined variable */ - @$undefined_var, - - /* unset variable */ - @$unset_var, - - /* resource */ - $file_handle, - - /* object */ - new sample() -); - -/* loop through each element of the array and check the working of strncasecmp() */ -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $str1 = $values[$index]; - $str2 = $values[$index]; - $len = strlen($values[$index]) + 1; - var_dump( strncasecmp("string", $str2, $len) ); - $counter ++; -} - -fclose($file_handle); //closing the file handle - -echo "*** Done ***\n"; -?> ---EXPECTF-- -*** Testing strncasecmp() function: with unexpected values for 'str2' *** --- Iteration 1 -- -int(%d) --- Iteration 2 -- -int(%d) --- Iteration 3 -- -int(%d) --- Iteration 4 -- -int(%d) --- Iteration 5 -- -int(%d) --- Iteration 6 -- -int(%d) --- Iteration 7 -- -int(%d) --- Iteration 8 -- -int(%d) --- Iteration 9 -- -int(%d) --- Iteration 10 -- -int(%d) --- Iteration 11 -- -int(%d) --- Iteration 12 -- -int(%d) --- Iteration 13 -- -int(%d) --- Iteration 14 -- -int(%d) --- Iteration 15 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncasecmp() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 16 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncasecmp() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 17 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncasecmp() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 18 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncasecmp() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 19 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncasecmp() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 20 -- -int(%d) --- Iteration 21 -- -int(%d) --- Iteration 22 -- -int(%d) --- Iteration 23 -- -int(%d) --- Iteration 24 -- -int(%d) --- Iteration 25 -- -int(%d) --- Iteration 26 -- -int(%d) --- Iteration 27 -- -int(%d) --- Iteration 28 -- -int(%d) --- Iteration 29 -- -int(%d) --- Iteration 30 -- - -Warning: strlen() expects parameter 1 to be string, resource given in %s on line %d - -Warning: strncasecmp() expects parameter 2 to be string, resource given in %s on line %d -NULL --- Iteration 31 -- -int(4) -*** Done *** diff --git a/ext/standard/tests/strings/strncasecmp_variation4.phpt b/ext/standard/tests/strings/strncasecmp_variation4.phpt deleted file mode 100644 index 93968db2da..0000000000 --- a/ext/standard/tests/strings/strncasecmp_variation4.phpt +++ /dev/null @@ -1,189 +0,0 @@ ---TEST-- -Test strncasecmp() function : usage variations - unexpected values for 'str1' & 'str2' ---FILE-- -<?php -/* Prototype : int strncasecmp ( string $str1, string $str2, int $len ); - * Description: Binary safe case-insensitive string comparison of the first n characters - * Source code: Zend/zend_builtin_functions.c -*/ - -/* Test strncasecmp() function with the unexpected inputs for 'str1' and 'str2' */ - -echo "*** Testing strncasecmp() function: with unexpected values for 'str1' and 'str2' ***\n"; -/* get an unset variable */ -$unset_var = 'string_val'; -unset($unset_var); - -/* get resource handle */ -$file_handle = fopen(__FILE__, "r"); - -/* declaring a class */ -class sample { - public function __toString() { - return "object"; - } -} - - -/* array with different values */ -$values = array ( - /* integer values */ - 0, - 1, - 12345, - -2345, - - /* float values */ - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - /* hexadecimal values */ - 0x12, - -0x12, - - /* octal values */ - 012, - -012, - 01.2, - - /* array values */ - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - /* boolean values */ - true, - false, - TRUE, - FALSE, - - /* nulls */ - NULL, - null, - - /* empty string */ - "", - '', - - /* undefined variable */ - @$undefined_var, - - /* unset variable */ - @$unset_var, - - /* resource */ - $file_handle, - - /* object */ - new sample() -); - -/* loop through each element of the array and check the working of strncasecmp() */ -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $str1 = $values[$index]; - $str2 = $values[$index]; - $len = strlen($values[$index]) + 1; - var_dump( strncasecmp($str1, $str2, $len) ); - $counter ++; -} - -fclose($file_handle); //closing the file handle - -echo "*** Done ***\n"; -?> ---EXPECTF-- -*** Testing strncasecmp() function: with unexpected values for 'str1' and 'str2' *** --- Iteration 1 -- -int(0) --- Iteration 2 -- -int(0) --- Iteration 3 -- -int(0) --- Iteration 4 -- -int(0) --- Iteration 5 -- -int(0) --- Iteration 6 -- -int(0) --- Iteration 7 -- -int(0) --- Iteration 8 -- -int(0) --- Iteration 9 -- -int(0) --- Iteration 10 -- -int(0) --- Iteration 11 -- -int(0) --- Iteration 12 -- -int(0) --- Iteration 13 -- -int(0) --- Iteration 14 -- -int(0) --- Iteration 15 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 16 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 17 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 18 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 19 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 20 -- -int(0) --- Iteration 21 -- -int(0) --- Iteration 22 -- -int(0) --- Iteration 23 -- -int(0) --- Iteration 24 -- -int(0) --- Iteration 25 -- -int(0) --- Iteration 26 -- -int(0) --- Iteration 27 -- -int(0) --- Iteration 28 -- -int(0) --- Iteration 29 -- -int(0) --- Iteration 30 -- - -Warning: strlen() expects parameter 1 to be string, resource given in %s on line %d - -Warning: strncasecmp() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 31 -- -int(0) -*** Done *** diff --git a/ext/standard/tests/strings/strncasecmp_variation5.phpt b/ext/standard/tests/strings/strncasecmp_variation5.phpt deleted file mode 100644 index 44a58f78e1..0000000000 --- a/ext/standard/tests/strings/strncasecmp_variation5.phpt +++ /dev/null @@ -1,165 +0,0 @@ ---TEST-- -Test strncasecmp() function : usage variations - unexpected values for 'len' ---SKIPIF-- -<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); ---FILE-- -<?php -/* Prototype : int strncasecmp ( string $str1, string $str2, int $len ); - * Description: Binary safe case-insensitive string comparison of the first n characters - * Source code: Zend/zend_builtin_functions.c -*/ - -/* Test strncasecmp() function with the unexpected values, and giving the same strings for 'str1' and 'str2' */ - -echo "*** Test strncasecmp() function: unexpected values for 'len' ***\n"; - -/* definition of required variables */ -$str1 = "Hello, World\n"; -$str2 = "Hello, World\n"; - -/* get an unset variable */ -$unset_var = 'string_val'; -unset($unset_var); - -/* get resource handle */ -$file_handle = fopen(__FILE__, "r"); - -/* declaring a class */ -class sample { - public function __toString() { - return "object"; - } -} - - -/* array with different values */ -$lengths = array ( - - /* float values */ - 10.5, - 10.5e10, - 10.6E-10, - .5, - - /* hexadecimal values */ - 0x12, - - /* octal values */ - 012, - 01.2, - - /* array values */ - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - /* boolean values */ - true, - false, - TRUE, - FALSE, - - /* nulls */ - NULL, - null, - - /* empty string */ - "", - '', - - /* undefined variable */ - @$undefined_var, - - /* unset variable */ - @$unset_var, - - /* resource */ - $file_handle, - - /* object */ - new sample() -); - -/* loop through each element of the array and check the working of strncasecmp() */ -$counter = 1; -for($index = 0; $index < count($lengths); $index ++) { - $len = $lengths[$index]; - echo "-- Iteration $counter --\n"; - var_dump( strncasecmp($str1, $str2, $len) ); - $counter ++; -} -fclose($file_handle); - -echo "*** Done ***\n"; -?> ---EXPECTF-- -*** Test strncasecmp() function: unexpected values for 'len' *** --- Iteration 1 -- -int(0) --- Iteration 2 -- -int(0) --- Iteration 3 -- -int(0) --- Iteration 4 -- -int(0) --- Iteration 5 -- -int(0) --- Iteration 6 -- -int(0) --- Iteration 7 -- -int(0) --- Iteration 8 -- - -Warning: strncasecmp() expects parameter 3 to be int, array given in %s on line %d -NULL --- Iteration 9 -- - -Warning: strncasecmp() expects parameter 3 to be int, array given in %s on line %d -NULL --- Iteration 10 -- - -Warning: strncasecmp() expects parameter 3 to be int, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: strncasecmp() expects parameter 3 to be int, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: strncasecmp() expects parameter 3 to be int, array given in %s on line %d -NULL --- Iteration 13 -- -int(0) --- Iteration 14 -- -int(0) --- Iteration 15 -- -int(0) --- Iteration 16 -- -int(0) --- Iteration 17 -- -int(0) --- Iteration 18 -- -int(0) --- Iteration 19 -- - -Warning: strncasecmp() expects parameter 3 to be int, string given in %s on line %d -NULL --- Iteration 20 -- - -Warning: strncasecmp() expects parameter 3 to be int, string given in %s on line %d -NULL --- Iteration 21 -- -int(0) --- Iteration 22 -- -int(0) --- Iteration 23 -- - -Warning: strncasecmp() expects parameter 3 to be int, resource given in %s on line %d -NULL --- Iteration 24 -- - -Warning: strncasecmp() expects parameter 3 to be int, object given in %s on line %d -NULL -*** Done *** diff --git a/ext/standard/tests/strings/strncmp_variation4.phpt b/ext/standard/tests/strings/strncmp_variation4.phpt deleted file mode 100644 index 5e96e5d16f..0000000000 --- a/ext/standard/tests/strings/strncmp_variation4.phpt +++ /dev/null @@ -1,192 +0,0 @@ ---TEST-- -Test strncmp() function : usage variations - different inputs(all types) ---FILE-- -<?php -/* Prototype : int strncmp ( string $str1, string $str2, int $len ); - * Description: Binary safe case-sensitive string comparison of the first n characters - * Source code: Zend/zend_builtin_functions.c -*/ - -/* Test strncmp() function with the input strings are of all types */ - -echo "*** Testing strncmp() function: by supplying all types for 'str1' and 'str2' ***\n"; -/* get an unset variable */ -$unset_var = 'string_val'; -unset($unset_var); - -/* get resource handle */ -$file_handle = fopen(__FILE__, "r"); - -/* declaring a class */ -class sample { - public function __toString() { - return "object"; - } -} - - -/* array with different values */ -$values = array ( - /* integer values */ - 0, - 1, - 12345, - -2345, - - /* float values */ - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - /* hexadecimal values */ - 0x12, - -0x12, - - /* octal values */ - 012, - -012, - 01.2, - - /* array values */ - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - /* boolean values */ - true, - false, - TRUE, - FALSE, - - /* nulls */ - NULL, - null, - - /* empty string */ - "", - '', - - /* undefined variable */ - $undefined_var, - - /* unset variable */ - $unset_var, - - /* resource */ - $file_handle, - - /* object */ - new sample() -); - -/* loop through each element of the array and check the working of strncmp() */ -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $str1 = $values[$index]; - $str2 = $values[$index]; - $len = strlen($values[$index]) + 1; - var_dump( strncmp($str1, $str2, $len) ); - $counter ++; -} -fclose($file_handle); - -echo "*** Done ***\n"; -?> ---EXPECTF-- -*** Testing strncmp() function: by supplying all types for 'str1' and 'str2' *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d --- Iteration 1 -- -int(0) --- Iteration 2 -- -int(0) --- Iteration 3 -- -int(0) --- Iteration 4 -- -int(0) --- Iteration 5 -- -int(0) --- Iteration 6 -- -int(0) --- Iteration 7 -- -int(0) --- Iteration 8 -- -int(0) --- Iteration 9 -- -int(0) --- Iteration 10 -- -int(0) --- Iteration 11 -- -int(0) --- Iteration 12 -- -int(0) --- Iteration 13 -- -int(0) --- Iteration 14 -- -int(0) --- Iteration 15 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncmp() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 16 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncmp() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 17 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncmp() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 18 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncmp() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 19 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncmp() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 20 -- -int(0) --- Iteration 21 -- -int(0) --- Iteration 22 -- -int(0) --- Iteration 23 -- -int(0) --- Iteration 24 -- -int(0) --- Iteration 25 -- -int(0) --- Iteration 26 -- -int(0) --- Iteration 27 -- -int(0) --- Iteration 28 -- -int(0) --- Iteration 29 -- -int(0) --- Iteration 30 -- - -Warning: strlen() expects parameter 1 to be string, resource given in %s on line %d - -Warning: strncmp() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 31 -- -int(0) -*** Done *** diff --git a/ext/standard/tests/strings/strncmp_variation5.phpt b/ext/standard/tests/strings/strncmp_variation5.phpt deleted file mode 100644 index 85e50f5929..0000000000 --- a/ext/standard/tests/strings/strncmp_variation5.phpt +++ /dev/null @@ -1,179 +0,0 @@ ---TEST-- -Test strncmp() function : usage variations - different lengths(all types) ---SKIPIF-- -<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); ---FILE-- -<?php -/* Prototype : int strncmp ( string $str1, string $str2, int $len ); - * Description: Binary safe case-sensitive string comparison of the first n characters - * Source code: Zend/zend_builtin_functions.c -*/ - -/* Test strncmp() function with the length as all types, and giving the same strings for 'str1' and 'str2' */ - -echo "*** Test strncmp() function: by supplying all types for 'len' ***\n"; - -/* definition of required variables */ -$str1 = "Hello, World\n"; -$str2 = "Hello, World\n"; - -/* get an unset variable */ -$unset_var = 'string_val'; -unset($unset_var); - -/* get resource handle */ -$file_handle = fopen(__FILE__, "r"); - -/* declaring a class */ -class sample { - public function __toString() { - return "object"; - } -} - - -/* array with different values */ -$lengths = array ( - /* integer values */ - 0, - 1, - 12345, - - /* float values */ - 10.5, - 10.5e10, - 10.6E-10, - .5, - - /* hexadecimal values */ - 0x12, - - /* octal values */ - 012, - 01.2, - - /* array values */ - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - /* boolean values */ - true, - false, - TRUE, - FALSE, - - /* nulls */ - NULL, - null, - - /* empty string */ - "", - '', - - /* undefined variable */ - $undefined_var, - - /* unset variable */ - $unset_var, - - /* resource */ - $file_handle, - - /* object */ - new sample() -); - -/* loop through each element of the array and check the working of strncmp() */ -$counter = 1; -for($index = 0; $index < count($lengths); $index ++) { - $len = $lengths[$index]; - echo "-- Iteration $counter --\n"; - var_dump( strncmp($str1, $str2, $len) ); - $counter ++; -} -fclose($file_handle); - -echo "*** Done ***\n"; -?> ---EXPECTF-- -*** Test strncmp() function: by supplying all types for 'len' *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d --- Iteration 1 -- -int(0) --- Iteration 2 -- -int(0) --- Iteration 3 -- -int(0) --- Iteration 4 -- -int(0) --- Iteration 5 -- -int(0) --- Iteration 6 -- -int(0) --- Iteration 7 -- -int(0) --- Iteration 8 -- -int(0) --- Iteration 9 -- -int(0) --- Iteration 10 -- -int(0) --- Iteration 11 -- - -Warning: strncmp() expects parameter 3 to be int, array given in%s on line %d -NULL --- Iteration 12 -- - -Warning: strncmp() expects parameter 3 to be int, array given in%s on line %d -NULL --- Iteration 13 -- - -Warning: strncmp() expects parameter 3 to be int, array given in%s on line %d -NULL --- Iteration 14 -- - -Warning: strncmp() expects parameter 3 to be int, array given in%s on line %d -NULL --- Iteration 15 -- - -Warning: strncmp() expects parameter 3 to be int, array given in%s on line %d -NULL --- Iteration 16 -- -int(0) --- Iteration 17 -- -int(0) --- Iteration 18 -- -int(0) --- Iteration 19 -- -int(0) --- Iteration 20 -- -int(0) --- Iteration 21 -- -int(0) --- Iteration 22 -- - -Warning: strncmp() expects parameter 3 to be int, string given in%s on line %d -NULL --- Iteration 23 -- - -Warning: strncmp() expects parameter 3 to be int, string given in%s on line %d -NULL --- Iteration 24 -- -int(0) --- Iteration 25 -- -int(0) --- Iteration 26 -- - -Warning: strncmp() expects parameter 3 to be int, resource given in%s on line %d -NULL --- Iteration 27 -- - -Warning: strncmp() expects parameter 3 to be int, object given in%s on line %d -NULL -*** Done *** diff --git a/ext/standard/tests/strings/strncmp_variation6.phpt b/ext/standard/tests/strings/strncmp_variation6.phpt deleted file mode 100644 index f71119faf5..0000000000 --- a/ext/standard/tests/strings/strncmp_variation6.phpt +++ /dev/null @@ -1,811 +0,0 @@ ---TEST-- -Test strncmp() function : usage variations - binary safe(binary values) ---FILE-- -<?php -/* Prototype : int strncmp ( string $str1, string $str2, int $len ); - * Description: Binary safe case-sensitive string comparison of the first n characters - * Source code: Zend/zend_builtin_functions.c -*/ - -/* Test strncmp() function with binary values passed to 'str1' & 'str2' and with the null terminated strings */ - -echo "*** Test strncmp() function: with binary inputs ***\n"; - -echo "\n-- Checking with all 256 characters given, in binary format --\n"; -/* A binary function should work with all 256 characters that a character(8-bit) can take */ -/* loop through to get all 256 character's equivalent binary value, and check working of strncmp() */ -$count = 1; -for($ASCII = 0; $ASCII <= 255; $ASCII++) { - $str1 = decbin($ASCII); //ASCII value in binary form - $str2 = decbin( ord( chr($ASCII) ) ); //Getting equivalent ASCII value for the character in binary form - echo "-- Iteration $count --\n"; - var_dump( strncmp($str1, $str2, 8) ); //comparing all the 8-bits; expected: int(0) - var_dump( strncmp($str1, $str2, 4) ); //comparing only 4-bits; expected: int(0) - $count++; -} - -echo "\n-- Checking with out of character's range, given in binary format --\n"; -/* Checking with the out of range ASCII value(given in binary format) */ -$str1 = decbin(256); -$str2 = decbin( ord( chr(256) )); -var_dump( strncmp($str1, $str2, 8) ); //comparing all the 8-bits; expected: int(1) - -echo "\n*** Done ***\n"; -?> ---EXPECT-- -*** Test strncmp() function: with binary inputs *** - --- Checking with all 256 characters given, in binary format -- --- Iteration 1 -- -int(0) -int(0) --- Iteration 2 -- -int(0) -int(0) --- Iteration 3 -- -int(0) -int(0) --- Iteration 4 -- -int(0) -int(0) --- Iteration 5 -- -int(0) -int(0) --- Iteration 6 -- -int(0) -int(0) --- Iteration 7 -- -int(0) -int(0) --- Iteration 8 -- -int(0) -int(0) --- Iteration 9 -- -int(0) -int(0) --- Iteration 10 -- -int(0) -int(0) --- Iteration 11 -- -int(0) -int(0) --- Iteration 12 -- -int(0) -int(0) --- Iteration 13 -- -int(0) -int(0) --- Iteration 14 -- -int(0) -int(0) --- Iteration 15 -- -int(0) -int(0) --- Iteration 16 -- -int(0) -int(0) --- Iteration 17 -- -int(0) -int(0) --- Iteration 18 -- -int(0) -int(0) --- Iteration 19 -- -int(0) -int(0) --- Iteration 20 -- -int(0) -int(0) --- Iteration 21 -- -int(0) -int(0) --- Iteration 22 -- -int(0) -int(0) --- Iteration 23 -- -int(0) -int(0) --- Iteration 24 -- -int(0) -int(0) --- Iteration 25 -- -int(0) -int(0) --- Iteration 26 -- -int(0) -int(0) --- Iteration 27 -- -int(0) -int(0) --- Iteration 28 -- -int(0) -int(0) --- Iteration 29 -- -int(0) -int(0) --- Iteration 30 -- -int(0) -int(0) --- Iteration 31 -- -int(0) -int(0) --- Iteration 32 -- -int(0) -int(0) --- Iteration 33 -- -int(0) -int(0) --- Iteration 34 -- -int(0) -int(0) --- Iteration 35 -- -int(0) -int(0) --- Iteration 36 -- -int(0) -int(0) --- Iteration 37 -- -int(0) -int(0) --- Iteration 38 -- -int(0) -int(0) --- Iteration 39 -- -int(0) -int(0) --- Iteration 40 -- -int(0) -int(0) --- Iteration 41 -- -int(0) -int(0) --- Iteration 42 -- -int(0) -int(0) --- Iteration 43 -- -int(0) -int(0) --- Iteration 44 -- -int(0) -int(0) --- Iteration 45 -- -int(0) -int(0) --- Iteration 46 -- -int(0) -int(0) --- Iteration 47 -- -int(0) -int(0) --- Iteration 48 -- -int(0) -int(0) --- Iteration 49 -- -int(0) -int(0) --- Iteration 50 -- -int(0) -int(0) --- Iteration 51 -- -int(0) -int(0) --- Iteration 52 -- -int(0) -int(0) --- Iteration 53 -- -int(0) -int(0) --- Iteration 54 -- -int(0) -int(0) --- Iteration 55 -- -int(0) -int(0) --- Iteration 56 -- -int(0) -int(0) --- Iteration 57 -- -int(0) -int(0) --- Iteration 58 -- -int(0) -int(0) --- Iteration 59 -- -int(0) -int(0) --- Iteration 60 -- -int(0) -int(0) --- Iteration 61 -- -int(0) -int(0) --- Iteration 62 -- -int(0) -int(0) --- Iteration 63 -- -int(0) -int(0) --- Iteration 64 -- -int(0) -int(0) --- Iteration 65 -- -int(0) -int(0) --- Iteration 66 -- -int(0) -int(0) --- Iteration 67 -- -int(0) -int(0) --- Iteration 68 -- -int(0) -int(0) --- Iteration 69 -- -int(0) -int(0) --- Iteration 70 -- -int(0) -int(0) --- Iteration 71 -- -int(0) -int(0) --- Iteration 72 -- -int(0) -int(0) --- Iteration 73 -- -int(0) -int(0) --- Iteration 74 -- -int(0) -int(0) --- Iteration 75 -- -int(0) -int(0) --- Iteration 76 -- -int(0) -int(0) --- Iteration 77 -- -int(0) -int(0) --- Iteration 78 -- -int(0) -int(0) --- Iteration 79 -- -int(0) -int(0) --- Iteration 80 -- -int(0) -int(0) --- Iteration 81 -- -int(0) -int(0) --- Iteration 82 -- -int(0) -int(0) --- Iteration 83 -- -int(0) -int(0) --- Iteration 84 -- -int(0) -int(0) --- Iteration 85 -- -int(0) -int(0) --- Iteration 86 -- -int(0) -int(0) --- Iteration 87 -- -int(0) -int(0) --- Iteration 88 -- -int(0) -int(0) --- Iteration 89 -- -int(0) -int(0) --- Iteration 90 -- -int(0) -int(0) --- Iteration 91 -- -int(0) -int(0) --- Iteration 92 -- -int(0) -int(0) --- Iteration 93 -- -int(0) -int(0) --- Iteration 94 -- -int(0) -int(0) --- Iteration 95 -- -int(0) -int(0) --- Iteration 96 -- -int(0) -int(0) --- Iteration 97 -- -int(0) -int(0) --- Iteration 98 -- -int(0) -int(0) --- Iteration 99 -- -int(0) -int(0) --- Iteration 100 -- -int(0) -int(0) --- Iteration 101 -- -int(0) -int(0) --- Iteration 102 -- -int(0) -int(0) --- Iteration 103 -- -int(0) -int(0) --- Iteration 104 -- -int(0) -int(0) --- Iteration 105 -- -int(0) -int(0) --- Iteration 106 -- -int(0) -int(0) --- Iteration 107 -- -int(0) -int(0) --- Iteration 108 -- -int(0) -int(0) --- Iteration 109 -- -int(0) -int(0) --- Iteration 110 -- -int(0) -int(0) --- Iteration 111 -- -int(0) -int(0) --- Iteration 112 -- -int(0) -int(0) --- Iteration 113 -- -int(0) -int(0) --- Iteration 114 -- -int(0) -int(0) --- Iteration 115 -- -int(0) -int(0) --- Iteration 116 -- -int(0) -int(0) --- Iteration 117 -- -int(0) -int(0) --- Iteration 118 -- -int(0) -int(0) --- Iteration 119 -- -int(0) -int(0) --- Iteration 120 -- -int(0) -int(0) --- Iteration 121 -- -int(0) -int(0) --- Iteration 122 -- -int(0) -int(0) --- Iteration 123 -- -int(0) -int(0) --- Iteration 124 -- -int(0) -int(0) --- Iteration 125 -- -int(0) -int(0) --- Iteration 126 -- -int(0) -int(0) --- Iteration 127 -- -int(0) -int(0) --- Iteration 128 -- -int(0) -int(0) --- Iteration 129 -- -int(0) -int(0) --- Iteration 130 -- -int(0) -int(0) --- Iteration 131 -- -int(0) -int(0) --- Iteration 132 -- -int(0) -int(0) --- Iteration 133 -- -int(0) -int(0) --- Iteration 134 -- -int(0) -int(0) --- Iteration 135 -- -int(0) -int(0) --- Iteration 136 -- -int(0) -int(0) --- Iteration 137 -- -int(0) -int(0) --- Iteration 138 -- -int(0) -int(0) --- Iteration 139 -- -int(0) -int(0) --- Iteration 140 -- -int(0) -int(0) --- Iteration 141 -- -int(0) -int(0) --- Iteration 142 -- -int(0) -int(0) --- Iteration 143 -- -int(0) -int(0) --- Iteration 144 -- -int(0) -int(0) --- Iteration 145 -- -int(0) -int(0) --- Iteration 146 -- -int(0) -int(0) --- Iteration 147 -- -int(0) -int(0) --- Iteration 148 -- -int(0) -int(0) --- Iteration 149 -- -int(0) -int(0) --- Iteration 150 -- -int(0) -int(0) --- Iteration 151 -- -int(0) -int(0) --- Iteration 152 -- -int(0) -int(0) --- Iteration 153 -- -int(0) -int(0) --- Iteration 154 -- -int(0) -int(0) --- Iteration 155 -- -int(0) -int(0) --- Iteration 156 -- -int(0) -int(0) --- Iteration 157 -- -int(0) -int(0) --- Iteration 158 -- -int(0) -int(0) --- Iteration 159 -- -int(0) -int(0) --- Iteration 160 -- -int(0) -int(0) --- Iteration 161 -- -int(0) -int(0) --- Iteration 162 -- -int(0) -int(0) --- Iteration 163 -- -int(0) -int(0) --- Iteration 164 -- -int(0) -int(0) --- Iteration 165 -- -int(0) -int(0) --- Iteration 166 -- -int(0) -int(0) --- Iteration 167 -- -int(0) -int(0) --- Iteration 168 -- -int(0) -int(0) --- Iteration 169 -- -int(0) -int(0) --- Iteration 170 -- -int(0) -int(0) --- Iteration 171 -- -int(0) -int(0) --- Iteration 172 -- -int(0) -int(0) --- Iteration 173 -- -int(0) -int(0) --- Iteration 174 -- -int(0) -int(0) --- Iteration 175 -- -int(0) -int(0) --- Iteration 176 -- -int(0) -int(0) --- Iteration 177 -- -int(0) -int(0) --- Iteration 178 -- -int(0) -int(0) --- Iteration 179 -- -int(0) -int(0) --- Iteration 180 -- -int(0) -int(0) --- Iteration 181 -- -int(0) -int(0) --- Iteration 182 -- -int(0) -int(0) --- Iteration 183 -- -int(0) -int(0) --- Iteration 184 -- -int(0) -int(0) --- Iteration 185 -- -int(0) -int(0) --- Iteration 186 -- -int(0) -int(0) --- Iteration 187 -- -int(0) -int(0) --- Iteration 188 -- -int(0) -int(0) --- Iteration 189 -- -int(0) -int(0) --- Iteration 190 -- -int(0) -int(0) --- Iteration 191 -- -int(0) -int(0) --- Iteration 192 -- -int(0) -int(0) --- Iteration 193 -- -int(0) -int(0) --- Iteration 194 -- -int(0) -int(0) --- Iteration 195 -- -int(0) -int(0) --- Iteration 196 -- -int(0) -int(0) --- Iteration 197 -- -int(0) -int(0) --- Iteration 198 -- -int(0) -int(0) --- Iteration 199 -- -int(0) -int(0) --- Iteration 200 -- -int(0) -int(0) --- Iteration 201 -- -int(0) -int(0) --- Iteration 202 -- -int(0) -int(0) --- Iteration 203 -- -int(0) -int(0) --- Iteration 204 -- -int(0) -int(0) --- Iteration 205 -- -int(0) -int(0) --- Iteration 206 -- -int(0) -int(0) --- Iteration 207 -- -int(0) -int(0) --- Iteration 208 -- -int(0) -int(0) --- Iteration 209 -- -int(0) -int(0) --- Iteration 210 -- -int(0) -int(0) --- Iteration 211 -- -int(0) -int(0) --- Iteration 212 -- -int(0) -int(0) --- Iteration 213 -- -int(0) -int(0) --- Iteration 214 -- -int(0) -int(0) --- Iteration 215 -- -int(0) -int(0) --- Iteration 216 -- -int(0) -int(0) --- Iteration 217 -- -int(0) -int(0) --- Iteration 218 -- -int(0) -int(0) --- Iteration 219 -- -int(0) -int(0) --- Iteration 220 -- -int(0) -int(0) --- Iteration 221 -- -int(0) -int(0) --- Iteration 222 -- -int(0) -int(0) --- Iteration 223 -- -int(0) -int(0) --- Iteration 224 -- -int(0) -int(0) --- Iteration 225 -- -int(0) -int(0) --- Iteration 226 -- -int(0) -int(0) --- Iteration 227 -- -int(0) -int(0) --- Iteration 228 -- -int(0) -int(0) --- Iteration 229 -- -int(0) -int(0) --- Iteration 230 -- -int(0) -int(0) --- Iteration 231 -- -int(0) -int(0) --- Iteration 232 -- -int(0) -int(0) --- Iteration 233 -- -int(0) -int(0) --- Iteration 234 -- -int(0) -int(0) --- Iteration 235 -- -int(0) -int(0) --- Iteration 236 -- -int(0) -int(0) --- Iteration 237 -- -int(0) -int(0) --- Iteration 238 -- -int(0) -int(0) --- Iteration 239 -- -int(0) -int(0) --- Iteration 240 -- -int(0) -int(0) --- Iteration 241 -- -int(0) -int(0) --- Iteration 242 -- -int(0) -int(0) --- Iteration 243 -- -int(0) -int(0) --- Iteration 244 -- -int(0) -int(0) --- Iteration 245 -- -int(0) -int(0) --- Iteration 246 -- -int(0) -int(0) --- Iteration 247 -- -int(0) -int(0) --- Iteration 248 -- -int(0) -int(0) --- Iteration 249 -- -int(0) -int(0) --- Iteration 250 -- -int(0) -int(0) --- Iteration 251 -- -int(0) -int(0) --- Iteration 252 -- -int(0) -int(0) --- Iteration 253 -- -int(0) -int(0) --- Iteration 254 -- -int(0) -int(0) --- Iteration 255 -- -int(0) -int(0) --- Iteration 256 -- -int(0) -int(0) - --- Checking with out of character's range, given in binary format -- -int(1) - -*** Done *** diff --git a/ext/standard/tests/strings/strncmp_variation9.phpt b/ext/standard/tests/strings/strncmp_variation9.phpt index 1c83e80f09..194642fad4 100644 --- a/ext/standard/tests/strings/strncmp_variation9.phpt +++ b/ext/standard/tests/strings/strncmp_variation9.phpt @@ -22,7 +22,7 @@ EOD; $str2 = <<<identifier_str2 Example of heredoc string, whose identifier -having underscore("_") +having underscore("_") & numeric value. identifier_str2; diff --git a/ext/standard/tests/strings/strrchr_variation9.phpt b/ext/standard/tests/strings/strrchr_variation9.phpt deleted file mode 100644 index 760bfa6067..0000000000 --- a/ext/standard/tests/strings/strrchr_variation9.phpt +++ /dev/null @@ -1,198 +0,0 @@ ---TEST-- -Test strrchr() function : usage variations - unexpected inputs for haystack ---FILE-- -<?php -/* Prototype : string strrchr(string $haystack, string $needle); - * Description: Finds the last occurrence of a character in a string. - * Source code: ext/standard/string.c -*/ - -/* Test strrchr() function with unexpected inputs for haystack - * and expected type for 'needle' -*/ - -echo "*** Testing strrchr() function: with unexpected inputs for haystack ***\n"; - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// declaring a class -class sample { - public function __toString() { - return "object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values -$haystacks = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // float values - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // null values - NULL, - null, - - // objects - new sample(), - - // empty string - "", - '', - - // resource - $file_handle, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - -$needles = array ( - //integer numeric strings - "0", - "1", - "2", - "-2", - - //float numeric strings - "10.5", - "-10.5", - "10.5e10", - "10.6E-10", - ".5", - - //regular strings - "array", - "a", - "r", - "y", - "ay", - "true", - "false", - "TRUE", - "FALSE", - "NULL", - "null", - "object", - - //empty string - "", - '', - - //resource variable in string form - "\$file_handle", - - //undefined variable in string form - @"$undefined_var", - @"$unset_var" -); - -// loop through each element of the array and check the working of strrchr() -$count = 1; -for($index = 0; $index < count($haystacks); $index++) { - echo "-- Iteration $count --\n"; - var_dump( strrchr($haystacks[$index], $needles[$index]) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -echo "*** Done ***"; -?> ---EXPECTF-- -*** Testing strrchr() function: with unexpected inputs for haystack *** --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(4) "2345" --- Iteration 4 -- -string(5) "-2345" --- Iteration 5 -- -string(4) "10.5" --- Iteration 6 -- -string(5) "-10.5" --- Iteration 7 -- -string(12) "105000000000" --- Iteration 8 -- -string(7) "1.06E-9" --- Iteration 9 -- -string(2) ".5" --- Iteration 10 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -bool(false) --- Iteration 16 -- -bool(false) --- Iteration 17 -- -bool(false) --- Iteration 18 -- -bool(false) --- Iteration 19 -- -bool(false) --- Iteration 20 -- -bool(false) --- Iteration 21 -- -string(6) "object" --- Iteration 22 -- -bool(false) --- Iteration 23 -- -bool(false) --- Iteration 24 -- - -Warning: strrchr() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 25 -- -bool(false) --- Iteration 26 -- -bool(false) -*** Done *** diff --git a/ext/standard/tests/strings/strrev_variation4.phpt b/ext/standard/tests/strings/strrev_variation4.phpt deleted file mode 100644 index b585035c11..0000000000 --- a/ext/standard/tests/strings/strrev_variation4.phpt +++ /dev/null @@ -1,182 +0,0 @@ ---TEST-- -Test strrev() function : usage variations - unexpected inputs ---FILE-- -<?php -/* Prototype : string strrev(string $str); - * Description: Reverse a string - * Source code: ext/standard/string.c -*/ - -/* Testing strrev() function with unexpected inputs for 'str' */ - -echo "*** Testing strrev() : unexpected inputs for 'str' ***\n"; -//class declaration -class sample { - public function __toString(){ - return "object"; - } -} - -//get the resource -$resource = fopen(__FILE__, "r"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new sample(), - - // resource - $resource, - - // undefined data - @$undefined_var, - - // unset data - @$unset_var -); - -// loop through each element of the array for str - -$count = 1; -foreach($values as $value) { - echo "\n-- Iterator $count --\n"; - var_dump( strrev($value) ); - $count++; -}; - -fclose($resource); //closing the file handle - -echo "*** Done ***"; -?> ---EXPECTF-- -*** Testing strrev() : unexpected inputs for 'str' *** - --- Iterator 1 -- -string(1) "0" - --- Iterator 2 -- -string(1) "1" - --- Iterator 3 -- -string(5) "54321" - --- Iterator 4 -- -string(5) "5432-" - --- Iterator 5 -- -string(4) "5.01" - --- Iterator 6 -- -string(5) "5.01-" - --- Iterator 7 -- -string(12) "000000000501" - --- Iterator 8 -- -string(7) "9-E60.1" - --- Iterator 9 -- -string(3) "5.0" - --- Iterator 10 -- - -Warning: strrev() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iterator 11 -- - -Warning: strrev() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iterator 12 -- - -Warning: strrev() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iterator 13 -- - -Warning: strrev() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iterator 14 -- - -Warning: strrev() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iterator 15 -- -string(0) "" - --- Iterator 16 -- -string(0) "" - --- Iterator 17 -- -string(1) "1" - --- Iterator 18 -- -string(0) "" - --- Iterator 19 -- -string(1) "1" - --- Iterator 20 -- -string(0) "" - --- Iterator 21 -- -string(0) "" - --- Iterator 22 -- -string(0) "" - --- Iterator 23 -- -string(6) "tcejbo" - --- Iterator 24 -- - -Warning: strrev() expects parameter 1 to be string, resource given in %s on line %d -NULL - --- Iterator 25 -- -string(0) "" - --- Iterator 26 -- -string(0) "" -*** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation14.phpt b/ext/standard/tests/strings/strrpos_variation14.phpt deleted file mode 100644 index db4a0590d0..0000000000 --- a/ext/standard/tests/strings/strrpos_variation14.phpt +++ /dev/null @@ -1,155 +0,0 @@ ---TEST-- -Test strrpos() function : usage variations - unexpected inputs for 'offset' argument ---SKIPIF-- -<?php if (PHP_INT_SIZE !== 4) die("skip this test is for 32-bit only"); ---FILE-- -<?php -/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] ); - * Description: Find position of last occurrence of 'needle' in 'haystack'. - * Source code: ext/standard/string.c -*/ - -/* Test strrpos() function with unexpected inputs for 'offset' argument */ - -echo "*** Testing strrpos() function: with unexpected values for offset ***\n"; - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// defining a class -class sample { - public function __toString() { - return "object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -//definition of input args -$haystack = "hello world"; -$needle = "world"; - -// array with different values -$offsets = array ( - - // float values - 1.5, - -1.5, - 1.5e10, - 1.6E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // objects - new sample(), - - // empty string - "", - '', - - // null values - NULL, - null, - - //resource - $file_handle, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - - -// loop through each element of the array and check the working of strrpos() -$counter = 1; -for($index = 0; $index < count($offsets); $index ++) { - echo "-- Iteration $counter --\n"; - var_dump( strrpos($haystack, $needle, $offsets[$index]) ); - $counter ++; -} - -echo "*** Done ***"; -?> ---EXPECTF-- -*** Testing strrpos() function: with unexpected values for offset *** --- Iteration 1 -- -int(6) --- Iteration 2 -- -int(6) --- Iteration 3 -- - -Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d -bool(false) --- Iteration 4 -- -int(6) --- Iteration 5 -- -int(6) --- Iteration 6 -- - -Warning: strrpos() expects parameter 3 to be int, array given in %s on line %d -bool(false) --- Iteration 7 -- - -Warning: strrpos() expects parameter 3 to be int, array given in %s on line %d -bool(false) --- Iteration 8 -- - -Warning: strrpos() expects parameter 3 to be int, array given in %s on line %d -bool(false) --- Iteration 9 -- - -Warning: strrpos() expects parameter 3 to be int, array given in %s on line %d -bool(false) --- Iteration 10 -- - -Warning: strrpos() expects parameter 3 to be int, array given in %s on line %d -bool(false) --- Iteration 11 -- -int(6) --- Iteration 12 -- -int(6) --- Iteration 13 -- -int(6) --- Iteration 14 -- -int(6) --- Iteration 15 -- - -Warning: strrpos() expects parameter 3 to be int, object given in %s on line %d -bool(false) --- Iteration 16 -- - -Warning: strrpos() expects parameter 3 to be int, string given in %s on line %d -bool(false) --- Iteration 17 -- - -Warning: strrpos() expects parameter 3 to be int, string given in %s on line %d -bool(false) --- Iteration 18 -- -int(6) --- Iteration 19 -- -int(6) --- Iteration 20 -- - -Warning: strrpos() expects parameter 3 to be int, resource given in %s on line %d -bool(false) --- Iteration 21 -- -int(6) --- Iteration 22 -- -int(6) -*** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation9.phpt b/ext/standard/tests/strings/strrpos_variation9.phpt deleted file mode 100644 index 576d5b41e4..0000000000 --- a/ext/standard/tests/strings/strrpos_variation9.phpt +++ /dev/null @@ -1,184 +0,0 @@ ---TEST-- -Test strrpos() function : usage variations - unexpected inputs for 'haystack' argument ---FILE-- -<?php -/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] ); - * Description: Find position of last occurrence of 'needle' in 'haystack'. - * Source code: ext/standard/string.c -*/ - -/* Test strrpos() function with unexpected inputs for haystack argument */ - -echo "*** Testing strrpos() function with unexpected values for haystack ***\n"; - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// defining a class -class sample { - public function __toString() { - return "object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values -$haystacks = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // float values - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // objects - new sample(), - - // empty string - "", - '', - - // null values - NULL, - null, - - // resource - $file_handle, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - -$needle = "heredoc 0 1 2 -2 10.5 -10.5 10.5e10 10.6E-10 .5 array true false object \"\" null Resource"; - -// loop through each element of the array and check the working of strrpos() -$counter = 1; -for($index = 0; $index < count($haystacks); $index ++) { - echo "\n-- Iteration $counter --\n"; - var_dump( strrpos($haystacks[$index], $needle) ); - $counter ++; -} - -fclose($file_handle); //closing the file handle - -echo "*** Done ***"; -?> ---EXPECTF-- -*** Testing strrpos() function with unexpected values for haystack *** - --- Iteration 1 -- -bool(false) - --- Iteration 2 -- -bool(false) - --- Iteration 3 -- -bool(false) - --- Iteration 4 -- -bool(false) - --- Iteration 5 -- -bool(false) - --- Iteration 6 -- -bool(false) - --- Iteration 7 -- -bool(false) - --- Iteration 8 -- -bool(false) - --- Iteration 9 -- -bool(false) - --- Iteration 10 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- Iteration 11 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- Iteration 12 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- Iteration 13 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- Iteration 14 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- Iteration 15 -- -bool(false) - --- Iteration 16 -- -bool(false) - --- Iteration 17 -- -bool(false) - --- Iteration 18 -- -bool(false) - --- Iteration 19 -- -bool(false) - --- Iteration 20 -- -bool(false) - --- Iteration 21 -- -bool(false) - --- Iteration 22 -- -bool(false) - --- Iteration 23 -- -bool(false) - --- Iteration 24 -- - -Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d -bool(false) - --- Iteration 25 -- -bool(false) - --- Iteration 26 -- -bool(false) -*** Done *** diff --git a/ext/standard/tests/strings/strspn_variation1.phpt b/ext/standard/tests/strings/strspn_variation1.phpt deleted file mode 100644 index db6e8f9a15..0000000000 --- a/ext/standard/tests/strings/strspn_variation1.phpt +++ /dev/null @@ -1,273 +0,0 @@ ---TEST-- -Test strspn() function : usage variations - unexpected values for str argument ---FILE-- -<?php -/* Prototype : proto int strspn(string str, string mask [, int start [, int len]]) - * Description: Finds length of initial segment consisting entirely of characters found in mask. - If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars) - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -error_reporting(E_ALL & ~E_NOTICE); - -/* -* Testing strspn() : with different unexpected values for str argument -*/ - -echo "*** Testing strspn() : with unexpected values for str argument ***\n"; - -// Initialise function arguments not being substititued (if any) -$mask = 'abons1234567890'; -$start = 1; -$len = 10; - - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// declaring class -class sample { - public function __toString() { - return "object"; - } -} - -// creating a file resource -$file_handle = fopen(__FILE__, 'r'); - - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new sample, - - // undefined data - $undefined_var, - - // unset data - $unset_var, - - // resource - $file_handle -); - -// loop through each element of the array for str - -foreach($values as $value) { - echo "\n-- Iteration with str value as \"$value\"\n"; - var_dump( strspn($value,$mask) ); // with default args - var_dump( strspn($value,$mask,$start) ); // with default len value - var_dump( strspn($value,$mask,$start,$len) ); // with all args -}; - -// closing the resource -fclose($file_handle); - -echo "Done" -?> ---EXPECTF-- -*** Testing strspn() : with unexpected values for str argument *** - --- Iteration with str value as "0" -int(1) -int(0) -int(0) - --- Iteration with str value as "1" -int(1) -int(0) -int(0) - --- Iteration with str value as "12345" -int(5) -int(4) -int(4) - --- Iteration with str value as "-2345" -int(0) -int(4) -int(4) - --- Iteration with str value as "10.5" -int(2) -int(1) -int(1) - --- Iteration with str value as "-10.5" -int(0) -int(2) -int(2) - --- Iteration with str value as "101234567000" -int(12) -int(11) -int(10) - --- Iteration with str value as "1.07654321E-9" -int(1) -int(0) -int(0) - --- Iteration with str value as "0.5" -int(1) -int(0) -int(0) - --- Iteration with str value as "Array" - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration with str value as "Array" - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration with str value as "Array" - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration with str value as "Array" - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration with str value as "Array" - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "1" -int(1) -int(0) -int(0) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "1" -int(1) -int(0) -int(0) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "object" -int(2) -int(1) -int(1) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "Resource id #%d" - -Warning: strspn() expects parameter 1 to be string, resource given in %s on line %d -NULL - -Warning: strspn() expects parameter 1 to be string, resource given in %s on line %d -NULL - -Warning: strspn() expects parameter 1 to be string, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/strspn_variation2.phpt b/ext/standard/tests/strings/strspn_variation2.phpt deleted file mode 100644 index 1d31a1c802..0000000000 --- a/ext/standard/tests/strings/strspn_variation2.phpt +++ /dev/null @@ -1,272 +0,0 @@ ---TEST-- -Test strspn() function : usage variations - unexpected values for mask argument ---FILE-- -<?php -/* Prototype : proto int strspn(string str, string mask [, int start [, int len]]) - * Description: Finds length of initial segment consisting entirely of characters found in mask. - If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars) - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -error_reporting(E_ALL & ~E_NOTICE); - -/* -* Testing strspn() : with different unexpected values for mask argument -*/ - -echo "*** Testing strspn() : with different unexpected values of mask argument ***\n"; - -$str = 'string_val'; -$start = 1; -$len = 10; - - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// declaring class -class sample { - public function __toString() { - return "object"; - } -} - -// creating a file resource -$file_handle = fopen(__FILE__, 'r'); - - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new sample(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, - - // resource - $file_handle -); - -// loop through each element of the array for mask - -foreach($values as $value) { - echo "\n-- Iteration with mask value as \"$value\" --\n"; - var_dump( strspn($str,$value) ); // with defalut args - var_dump( strspn($str,$value,$start) ); // with default len value - var_dump( strspn($str,$value,$start,$len) ); // with all args -}; - -// close the resource -fclose($file_handle); - -echo "Done" -?> ---EXPECTF-- -*** Testing strspn() : with different unexpected values of mask argument *** - --- Iteration with mask value as "0" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "1" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "12345" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "-2345" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "10.5" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "-10.5" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "101234567000" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "1.07654321E-9" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "0.5" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "Array" -- - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - --- Iteration with mask value as "Array" -- - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - --- Iteration with mask value as "Array" -- - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - --- Iteration with mask value as "Array" -- - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - --- Iteration with mask value as "Array" -- - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - --- Iteration with mask value as "" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "1" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "1" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "object" -- -int(0) -int(1) -int(1) - --- Iteration with mask value as "" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "Resource id #%d" -- - -Warning: strspn() expects parameter 2 to be string, resource given in %s on line %d -NULL - -Warning: strspn() expects parameter 2 to be string, resource given in %s on line %d -NULL - -Warning: strspn() expects parameter 2 to be string, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/strspn_variation3.phpt b/ext/standard/tests/strings/strspn_variation3.phpt deleted file mode 100644 index 76f11acc26..0000000000 --- a/ext/standard/tests/strings/strspn_variation3.phpt +++ /dev/null @@ -1,243 +0,0 @@ ---TEST-- -Test strspn() function : usage variations - unexpected values of start argument ---FILE-- -<?php -/* Prototype : proto int strspn(string str, string mask [, int start [, int len]]) - * Description: Finds length of initial segment consisting entirely of characters found in mask. - If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars) - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -error_reporting(E_ALL & ~E_NOTICE); - -/* -* Testing strspn() : with unexpected values of start argument -*/ - -echo "*** Testing strspn() : with unexpected values of start argument ***\n"; - -// initialing required variables -$str = 'string_val'; -$mask = 'soibtFTf1234567890'; -$len = 10; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// declaring class -class sample { - public function __toString() { - return "object"; - } -} - -// creating a file resource -$file_handle = fopen(__FILE__, 'r'); - - -//array of values to iterate over -$values = array( - - // float data - 10.5, - -10.5, - 10.1234567e8, - 10.7654321E-8, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // object data - new sample(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, - - // resource - $file_handle -); - -// loop through each element of the array for start - -foreach($values as $value) { - echo "\n-- Iteration with start value as \"$value\" --\n"; - var_dump( strspn($str,$mask,$value) ); // with default len value - var_dump( strspn($str,$mask,$value,$len) ); // with all args -}; - -// closing the resource -fclose($file_handle); - -echo "Done" -?> ---EXPECTF-- -*** Testing strspn() : with unexpected values of start argument *** - --- Iteration with start value as "10.5" -- -int(0) -int(0) - --- Iteration with start value as "-10.5" -- -int(2) -int(2) - --- Iteration with start value as "1012345670" -- -bool(false) -bool(false) - --- Iteration with start value as "1.07654321E-7" -- -int(2) -int(2) - --- Iteration with start value as "0.5" -- -int(2) -int(2) - --- Iteration with start value as "Array" -- - -Warning: strspn() expects parameter 3 to be int, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 3 to be int, array given in %s on line %d -NULL - --- Iteration with start value as "Array" -- - -Warning: strspn() expects parameter 3 to be int, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 3 to be int, array given in %s on line %d -NULL - --- Iteration with start value as "Array" -- - -Warning: strspn() expects parameter 3 to be int, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 3 to be int, array given in %s on line %d -NULL - --- Iteration with start value as "Array" -- - -Warning: strspn() expects parameter 3 to be int, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 3 to be int, array given in %s on line %d -NULL - --- Iteration with start value as "Array" -- - -Warning: strspn() expects parameter 3 to be int, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 3 to be int, array given in %s on line %d -NULL - --- Iteration with start value as "" -- -int(2) -int(2) - --- Iteration with start value as "" -- -int(2) -int(2) - --- Iteration with start value as "1" -- -int(1) -int(1) - --- Iteration with start value as "" -- -int(2) -int(2) - --- Iteration with start value as "1" -- -int(1) -int(1) - --- Iteration with start value as "" -- -int(2) -int(2) - --- Iteration with start value as "" -- - -Warning: strspn() expects parameter 3 to be int, string given in %s on line %d -NULL - -Warning: strspn() expects parameter 3 to be int, string given in %s on line %d -NULL - --- Iteration with start value as "" -- - -Warning: strspn() expects parameter 3 to be int, string given in %s on line %d -NULL - -Warning: strspn() expects parameter 3 to be int, string given in %s on line %d -NULL - --- Iteration with start value as "string" -- - -Warning: strspn() expects parameter 3 to be int, string given in %s on line %d -NULL - -Warning: strspn() expects parameter 3 to be int, string given in %s on line %d -NULL - --- Iteration with start value as "string" -- - -Warning: strspn() expects parameter 3 to be int, string given in %s on line %d -NULL - -Warning: strspn() expects parameter 3 to be int, string given in %s on line %d -NULL - --- Iteration with start value as "object" -- - -Warning: strspn() expects parameter 3 to be int, object given in %s on line %d -NULL - -Warning: strspn() expects parameter 3 to be int, object given in %s on line %d -NULL - --- Iteration with start value as "" -- -int(2) -int(2) - --- Iteration with start value as "" -- -int(2) -int(2) - --- Iteration with start value as "Resource id #%d" -- - -Warning: strspn() expects parameter 3 to be int, resource given in %s on line %d -NULL - -Warning: strspn() expects parameter 3 to be int, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/strspn_variation4.phpt b/ext/standard/tests/strings/strspn_variation4.phpt deleted file mode 100644 index 858a4fb608..0000000000 --- a/ext/standard/tests/strings/strspn_variation4.phpt +++ /dev/null @@ -1,196 +0,0 @@ ---TEST-- -Test strspn() function : usage variations - unexpected values of len argument ---FILE-- -<?php -/* Prototype : proto int strspn(string str, string mask [, int start [, int len]]) - * Description: Finds length of initial segment consisting entirely of characters found in mask. - If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars) - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -error_reporting(E_ALL & ~E_NOTICE); - -/* -* Testing strspn() : with unexpected values of len argument -*/ - -echo "*** Testing strspn() : with unexpected values of len argument ***\n"; - -// initialing required variables -$str = 'string_val'; -$mask = 'soibtFTf1234567890'; -$start = 0; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// declaring class -class sample { - public function __toString() { - return "object"; - } -} - -// creating a file resource -$file_handle = fopen(__FILE__, 'r'); - - -//array of values to iterate over -$values = array( - - // float data - 10.5, - -10.5, - 10.1234567e8, - 10.7654321E-8, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // object data - new sample(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, - - // resource - $file_handle -); - -// loop through each element of the array for start - -foreach($values as $value) { - echo "\n-- Iteration with len value as \"$value\" --\n"; - var_dump( strspn($str,$mask,$start,$value) ); // with all args -}; - -// closing the resource -fclose($file_handle); - -echo "Done" -?> ---EXPECTF-- -*** Testing strspn() : with unexpected values of len argument *** - --- Iteration with len value as "10.5" -- -int(2) - --- Iteration with len value as "-10.5" -- -int(0) - --- Iteration with len value as "1012345670" -- -int(2) - --- Iteration with len value as "1.07654321E-7" -- -int(0) - --- Iteration with len value as "0.5" -- -int(0) - --- Iteration with len value as "Array" -- - -Warning: strspn() expects parameter 4 to be int, array given in %s on line %d -NULL - --- Iteration with len value as "Array" -- - -Warning: strspn() expects parameter 4 to be int, array given in %s on line %d -NULL - --- Iteration with len value as "Array" -- - -Warning: strspn() expects parameter 4 to be int, array given in %s on line %d -NULL - --- Iteration with len value as "Array" -- - -Warning: strspn() expects parameter 4 to be int, array given in %s on line %d -NULL - --- Iteration with len value as "Array" -- - -Warning: strspn() expects parameter 4 to be int, array given in %s on line %d -NULL - --- Iteration with len value as "" -- -int(0) - --- Iteration with len value as "" -- -int(0) - --- Iteration with len value as "1" -- -int(1) - --- Iteration with len value as "" -- -int(0) - --- Iteration with len value as "1" -- -int(1) - --- Iteration with len value as "" -- -int(0) - --- Iteration with len value as "" -- - -Warning: strspn() expects parameter 4 to be int, string given in %s on line %d -NULL - --- Iteration with len value as "" -- - -Warning: strspn() expects parameter 4 to be int, string given in %s on line %d -NULL - --- Iteration with len value as "string" -- - -Warning: strspn() expects parameter 4 to be int, string given in %s on line %d -NULL - --- Iteration with len value as "string" -- - -Warning: strspn() expects parameter 4 to be int, string given in %s on line %d -NULL - --- Iteration with len value as "object" -- - -Warning: strspn() expects parameter 4 to be int, object given in %s on line %d -NULL - --- Iteration with len value as "" -- -int(0) - --- Iteration with len value as "" -- -int(0) - --- Iteration with len value as "Resource id #%d" -- - -Warning: strspn() expects parameter 4 to be int, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/strtok_variation1.phpt b/ext/standard/tests/strings/strtok_variation1.phpt deleted file mode 100644 index 9c46428a65..0000000000 --- a/ext/standard/tests/strings/strtok_variation1.phpt +++ /dev/null @@ -1,174 +0,0 @@ ---TEST-- -Test strtok() function : usage variations - first argument as non-string ---FILE-- -<?php -/* Prototype : string strtok ( string $str, string $token ) - * Description: splits a string (str) into smaller strings (tokens), with each token being delimited by any character from token - * Source code: ext/standard/string.c -*/ - -/* - * Testing strtok() : with first argument as non-string -*/ - -echo "*** Testing strtok() : with first argument as non-string ***\n"; -// initialize all required variables -$token = '-'; - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// declaring a class -class sample { - public function __toString() { - return "obj-ect"; - } -} - -// Defining resource -$file_handle = fopen(__FILE__, 'r'); - -// array with different values -$values = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // float values - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red-color', 'item' => 'pen-color'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // objects - new sample(), - - // empty string - "", - '', - - // null values - NULL, - null, - - // undefined variable - $undefined_var, - - // unset variable - $unset_var, - - // resource - $file_handle -); - - -// loop through each element of the array and check the working of strtok() -// when $str argument is supplied with different values - -echo "\n--- Testing strtok() by supplying different values for 'str' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $str = $values [$index]; - - var_dump( strtok($str, $token) ); - - $counter ++; -} - -//closing the resource -fclose($file_handle); - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing strtok() : with first argument as non-string *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - ---- Testing strtok() by supplying different values for 'str' argument --- --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(5) "12345" --- Iteration 4 -- -string(4) "2345" --- Iteration 5 -- -string(4) "10.5" --- Iteration 6 -- -string(4) "10.5" --- Iteration 7 -- -string(12) "101234567000" --- Iteration 8 -- -string(11) "1.07654321E" --- Iteration 9 -- -string(3) "0.5" --- Iteration 10 -- - -Warning: strtok() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: strtok() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: strtok() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: strtok() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: strtok() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(1) "1" --- Iteration 16 -- -bool(false) --- Iteration 17 -- -string(1) "1" --- Iteration 18 -- -bool(false) --- Iteration 19 -- -string(3) "obj" --- Iteration 20 -- -bool(false) --- Iteration 21 -- -bool(false) --- Iteration 22 -- -bool(false) --- Iteration 23 -- -bool(false) --- Iteration 24 -- -bool(false) --- Iteration 25 -- -bool(false) --- Iteration 26 -- - -Warning: strtok() expects parameter 1 to be string, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/strtok_variation2.phpt b/ext/standard/tests/strings/strtok_variation2.phpt deleted file mode 100644 index 26de1ae0b5..0000000000 --- a/ext/standard/tests/strings/strtok_variation2.phpt +++ /dev/null @@ -1,174 +0,0 @@ ---TEST-- -Test strtok() function : usage variations - with different token strings ---FILE-- -<?php -/* Prototype : string strtok ( str $str, str $token ) - * Description: splits a string (str) into smaller strings (tokens), with each token being delimited by any character from token - * Source code: ext/standard/string.c -*/ - -/* - * Testing strtok() : with different token strings -*/ - -echo "*** Testing strtok() : with different token strings ***\n"; -// initialize all required variables -$str = 'this testcase test strtok() function '; - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// declaring a class -class sample { - public function __toString() { - return "obj-ect"; - } -} - -// Defining resource -$file_handle = fopen(__FILE__, 'r'); - -// array with different values -$values = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // float values - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // objects - new sample(), - - // empty string - "", - '', - - // null values - NULL, - null, - - // undefined variable - $undefined_var, - - // unset variable - $unset_var, - - // resource - $file_handle -); - - -// loop through each element of the array and check the working of strtok() -// when $token argument is supplied with different values - -echo "\n--- Testing strtok() by supplying different values for 'token' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $token = $values [$index]; - - var_dump( strtok($str, $token) ); - - $counter ++; -} - -// closing the resource -fclose($file_handle); - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing strtok() : with different token strings *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - ---- Testing strtok() by supplying different values for 'token' argument --- --- Iteration 1 -- -string(37) "this testcase test strtok() function " --- Iteration 2 -- -string(37) "this testcase test strtok() function " --- Iteration 3 -- -string(37) "this testcase test strtok() function " --- Iteration 4 -- -string(37) "this testcase test strtok() function " --- Iteration 5 -- -string(37) "this testcase test strtok() function " --- Iteration 6 -- -string(37) "this testcase test strtok() function " --- Iteration 7 -- -string(37) "this testcase test strtok() function " --- Iteration 8 -- -string(37) "this testcase test strtok() function " --- Iteration 9 -- -string(37) "this testcase test strtok() function " --- Iteration 10 -- - -Warning: strtok() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: strtok() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: strtok() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: strtok() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: strtok() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(37) "this testcase test strtok() function " --- Iteration 16 -- -string(37) "this testcase test strtok() function " --- Iteration 17 -- -string(37) "this testcase test strtok() function " --- Iteration 18 -- -string(37) "this testcase test strtok() function " --- Iteration 19 -- -string(4) "his " --- Iteration 20 -- -string(37) "this testcase test strtok() function " --- Iteration 21 -- -string(37) "this testcase test strtok() function " --- Iteration 22 -- -string(37) "this testcase test strtok() function " --- Iteration 23 -- -string(37) "this testcase test strtok() function " --- Iteration 24 -- -string(37) "this testcase test strtok() function " --- Iteration 25 -- -string(37) "this testcase test strtok() function " --- Iteration 26 -- - -Warning: strtok() expects parameter 2 to be string, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/strtr.phpt b/ext/standard/tests/strings/strtr.phpt index 77666ced8c..1dc1e9c4ef 100644 --- a/ext/standard/tests/strings/strtr.phpt +++ b/ext/standard/tests/strings/strtr.phpt @@ -2,7 +2,6 @@ strtr() function --FILE-- <?php -/* Do not change this test it is a README.TESTING example. */ $trans = array("hello"=>"hi", "hi"=>"hello", "a"=>"A", "world"=>"planet"); var_dump(strtr("# hi all, I said hello world! #", $trans)); ?> diff --git a/ext/standard/tests/strings/strtr_variation5.phpt b/ext/standard/tests/strings/strtr_variation5.phpt deleted file mode 100644 index cb6ad267ad..0000000000 --- a/ext/standard/tests/strings/strtr_variation5.phpt +++ /dev/null @@ -1,139 +0,0 @@ ---TEST-- -Test strtr() function : usage variations - unexpected inputs for 'str' argument ---FILE-- -<?php -/* Prototype : string strtr(string $str, string $from[, string $to]); - string strtr(string $str, array $replace_pairs); - * Description: Translates characters in str using given translation tables - * Source code: ext/standard/string.c -*/ - -/* Test strtr() function: with unexpected inputs for 'str' - * and expected type for 'from' & 'to' arguments -*/ - -echo "*** Testing strtr() function: with unexpected inputs for 'str' ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values -$strings = array ( - - // integer values -/*1*/ 0, - 1, - -2, - - // float values -/*4*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*7*/ array(), - array(0), - array(1, 2), - - // boolean values -/*10*/ true, - false, - TRUE, - FALSE, - - // null values -/*14*/ NULL, - null, - - // objects -/*16*/ new sample(), - - // resource -/*17*/ $file_handle, - - // undefined variable -/*18*/ @$undefined_var, - - // unset variable -/*19*/ @$unset_var -); - -//defining 'from' argument -$from = "012atm"; - -//defining 'to' argument -$to = "atm012"; - -// loop through with each element of the $strings array to test strtr() function -$count = 1; -for($index = 0; $index < count($strings); $index++) { - echo "-- Iteration $count --\n"; - $str = $strings[$index]; - var_dump( strtr($str, $from, $to) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing strtr() function: with unexpected inputs for 'str' *** --- Iteration 1 -- -string(1) "a" --- Iteration 2 -- -string(1) "t" --- Iteration 3 -- -string(2) "-m" --- Iteration 4 -- -string(4) "ta.5" --- Iteration 5 -- -string(5) "-ma.5" --- Iteration 6 -- -string(12) "tatm34567aaa" --- Iteration 7 -- - -Warning: strtr() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 8 -- - -Warning: strtr() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 9 -- - -Warning: strtr() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 10 -- -string(1) "t" --- Iteration 11 -- -string(0) "" --- Iteration 12 -- -string(1) "t" --- Iteration 13 -- -string(0) "" --- Iteration 14 -- -string(0) "" --- Iteration 15 -- -string(0) "" --- Iteration 16 -- -string(13) "s02ple objec1" --- Iteration 17 -- - -Warning: strtr() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 18 -- -string(0) "" --- Iteration 19 -- -string(0) "" -===DONE=== diff --git a/ext/standard/tests/strings/strtr_variation7.phpt b/ext/standard/tests/strings/strtr_variation7.phpt deleted file mode 100644 index 9f7cb95371..0000000000 --- a/ext/standard/tests/strings/strtr_variation7.phpt +++ /dev/null @@ -1,158 +0,0 @@ ---TEST-- -Test strtr() function : usage variations - unexpected inputs for 'to' argument ---FILE-- -<?php -/* Prototype : string strtr(string $str, string $from[, string $to]); - string strtr(string $str, array $replace_pairs); - * Description: Translates characters in str using given translation tables - * Source code: ext/standard/string.c -*/ - -/* Test strtr() function: with unexpected inputs for 'to' - * and expected types for 'str' & 'from' arguments -*/ - -echo "*** Testing strtr() function: with unexpected inputs for 'to' ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -//defining 'str' argument -$str = "012atm"; - -//defining 'from' argument -$from = "atm012"; - -// array of values for 'to' argument -$to_arr = array ( - - // integer values -/*1*/ 0, - 1, - -2, - - // float values -/*4*/ 10.5, - -20.5, - 10.12345675e10, - - // array values -/*7*/ array(), - array(0), - array(1, 2), - - // boolean values -/*10*/ true, - false, - TRUE, - FALSE, - - // null values -/*14*/ NULL, - null, - - // objects -/*16*/ new sample(), - - // resource -/*17*/ $file_handle, - - // undefined variable -/*18*/ @$undefined_var, - - // unset variable -/*19*/ @$unset_var -); - -// loop through with each element of the $to array to test strtr() function -$count = 1; -for($index = 0; $index < count($to_arr); $index++) { - echo "\n-- Iteration $count --\n"; - $to = $to_arr[$index]; - var_dump( strtr($str, $from, $to) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing strtr() function: with unexpected inputs for 'to' *** - --- Iteration 1 -- -string(6) "0120tm" - --- Iteration 2 -- -string(6) "0121tm" - --- Iteration 3 -- -string(6) "012-2m" - --- Iteration 4 -- -string(6) "51210." - --- Iteration 5 -- -string(6) ".52-20" - --- Iteration 6 -- -string(6) "234101" - --- Iteration 7 -- - -Warning: strtr() expects parameter 3 to be string, array given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: strtr() expects parameter 3 to be string, array given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: strtr() expects parameter 3 to be string, array given in %s on line %d -NULL - --- Iteration 10 -- -string(6) "0121tm" - --- Iteration 11 -- -string(6) "012atm" - --- Iteration 12 -- -string(6) "0121tm" - --- Iteration 13 -- -string(6) "012atm" - --- Iteration 14 -- -string(6) "012atm" - --- Iteration 15 -- -string(6) "012atm" - --- Iteration 16 -- -string(6) "plesam" - --- Iteration 17 -- - -Warning: strtr() expects parameter 3 to be string, resource given in %s on line %d -NULL - --- Iteration 18 -- -string(6) "012atm" - --- Iteration 19 -- -string(6) "012atm" -===DONE=== diff --git a/ext/standard/tests/strings/strtr_variation9.phpt b/ext/standard/tests/strings/strtr_variation9.phpt deleted file mode 100644 index 427fde5f75..0000000000 --- a/ext/standard/tests/strings/strtr_variation9.phpt +++ /dev/null @@ -1,225 +0,0 @@ ---TEST-- -Test strtr() function : usage variations - unexpected inputs for all arguments ---FILE-- -<?php -/* Prototype : string strtr(string $str, string $from[, string $to]); - string strtr(string $str, array $replace_pairs); - * Description: Translates characters in str using given translation tables - * Source code: ext/standard/string.c -*/ - -/* Test strtr() function: with unexpected inputs for 'str', 'from', 'to' & 'replace_pairs' arguments */ - -echo "*** Testing strtr() function: with unexpected inputs for all arguments ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values -$values = array ( - - // integer values -/*1*/ 0, - 1, - -2, - - // float values -/*4*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*7*/ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values -/*12*/ true, - false, - TRUE, - FALSE, - - // null values -/*16*/ NULL, - null, - - // objects -/*18*/ new sample(), - - // resource -/*19*/ $file_handle, - - // undefined variable -/*20*/ @$undefined_var, - - // unset variable -/*21*/ @$unset_var -); - -// loop through with each element of the $values array to test strtr() function -$count = 1; -for($index = 0; $index < count($values); $index++) { - echo "\n-- Iteration $count --\n"; - var_dump( strtr($values[$index], $values[$index], $values[$index]) ); //fn call with three args - var_dump( strtr($values[$index], $values[$index]) ); //fn call with two args - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing strtr() function: with unexpected inputs for all arguments *** - --- Iteration 1 -- -string(1) "0" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 2 -- -string(1) "1" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 3 -- -string(2) "-2" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 4 -- -string(4) "10.5" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 5 -- -string(5) "-20.5" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 6 -- -string(12) "101234567000" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 7 -- - -Warning: strtr() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strtr() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: strtr() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strtr() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: strtr() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strtr() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 10 -- - -Warning: strtr() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strtr() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: strtr() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strtr() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 12 -- -string(1) "1" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 13 -- -string(0) "" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 14 -- -string(1) "1" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 15 -- -string(0) "" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 16 -- -string(0) "" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 17 -- -string(0) "" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 18 -- -string(13) "sample object" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 19 -- - -Warning: strtr() expects parameter 1 to be string, resource given in %s on line %d -NULL - -Warning: strtr() expects parameter 1 to be string, resource given in %s on line %d -NULL - --- Iteration 20 -- -string(0) "" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 21 -- -string(0) "" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) -===DONE=== diff --git a/ext/standard/tests/strings/trim_variation1.phpt b/ext/standard/tests/strings/trim_variation1.phpt deleted file mode 100644 index 56578fb75c..0000000000 --- a/ext/standard/tests/strings/trim_variation1.phpt +++ /dev/null @@ -1,138 +0,0 @@ ---TEST-- -Test trim() function : usage variations - test values for $str argument ---FILE-- -<?php - -/* Prototype : string trim ( string $str [, string $charlist ] ) - * Description: Strip whitespace (or other characters) from the beginning and end of a string. - * Source code: ext/standard/string.c -*/ - -echo "*** Testing trim() function: with unexpected inputs for 'str' argument ***\n"; - -//get an unset variable -$unset_var = ' !--string_val--! '; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return " !---sample object---! "; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $inputs array to test trim() function -$count = 1; -foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - // strip white space and any "minus" signs - var_dump( trim($input, " !-") ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing trim() function: with unexpected inputs for 'str' argument *** --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(3) "255" --- Iteration 4 -- -string(3) "256" --- Iteration 5 -- -string(10) "2147483647" --- Iteration 6 -- -string(10) "2147483648" --- Iteration 7 -- -string(4) "10.5" --- Iteration 8 -- -string(4) "20.5" --- Iteration 9 -- -string(12) "101234567000" --- Iteration 10 -- - -Warning: trim() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: trim() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: trim() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -string(1) "1" --- Iteration 14 -- -string(0) "" --- Iteration 15 -- -string(1) "1" --- Iteration 16 -- -string(0) "" --- Iteration 17 -- -string(0) "" --- Iteration 18 -- -string(0) "" --- Iteration 19 -- -string(13) "sample object" --- Iteration 20 -- - -Warning: trim() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- -string(0) "" --- Iteration 22 -- -string(0) "" -===DONE=== diff --git a/ext/standard/tests/strings/trim_variation2.phpt b/ext/standard/tests/strings/trim_variation2.phpt deleted file mode 100644 index d38f898862..0000000000 --- a/ext/standard/tests/strings/trim_variation2.phpt +++ /dev/null @@ -1,138 +0,0 @@ ---TEST-- -Test trim() function : usage variations - test values for $charlist argument ---FILE-- -<?php - -/* Prototype : string trim ( string $str [, string $charlist ] ) - * Description: Strip whitespace (or other characters) from the beginning and end of a string. - * Source code: ext/standard/string.c -*/ - -echo "*** Testing trim() function: with unexpected inputs for 'charlist' argument ***\n"; - -//get an unset variable -$unset_var = ' string_val '; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return " sample object "; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $inputs array to test trim() function -$count = 1; -foreach($inputs as $charlist) { - echo "-- Iteration $count --\n"; - // strip white space and any "minus" signs - var_dump( trim("!---Hello World---!", $charlist) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing trim() function: with unexpected inputs for 'charlist' argument *** --- Iteration 1 -- -string(19) "!---Hello World---!" --- Iteration 2 -- -string(19) "!---Hello World---!" --- Iteration 3 -- -string(19) "!---Hello World---!" --- Iteration 4 -- -string(19) "!---Hello World---!" --- Iteration 5 -- -string(19) "!---Hello World---!" --- Iteration 6 -- -string(19) "!---Hello World---!" --- Iteration 7 -- -string(19) "!---Hello World---!" --- Iteration 8 -- -string(19) "!---Hello World---!" --- Iteration 9 -- -string(19) "!---Hello World---!" --- Iteration 10 -- - -Warning: trim() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: trim() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: trim() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -string(19) "!---Hello World---!" --- Iteration 14 -- -string(19) "!---Hello World---!" --- Iteration 15 -- -string(19) "!---Hello World---!" --- Iteration 16 -- -string(19) "!---Hello World---!" --- Iteration 17 -- -string(19) "!---Hello World---!" --- Iteration 18 -- -string(19) "!---Hello World---!" --- Iteration 19 -- -string(19) "!---Hello World---!" --- Iteration 20 -- - -Warning: trim() expects parameter 2 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- -string(19) "!---Hello World---!" --- Iteration 22 -- -string(19) "!---Hello World---!" -===DONE=== diff --git a/ext/standard/tests/strings/ucfirst.phpt b/ext/standard/tests/strings/ucfirst.phpt Binary files differindex 66da7a90f3..b524b45e59 100644 --- a/ext/standard/tests/strings/ucfirst.phpt +++ b/ext/standard/tests/strings/ucfirst.phpt diff --git a/ext/standard/tests/strings/ucwords_variation1.phpt b/ext/standard/tests/strings/ucwords_variation1.phpt deleted file mode 100644 index 1604402353..0000000000 --- a/ext/standard/tests/strings/ucwords_variation1.phpt +++ /dev/null @@ -1,201 +0,0 @@ ---TEST-- -Test ucwords() function : usage variations - unexpected input values ---FILE-- -<?php -/* Prototype : string ucwords ( string $str ) - * Description: Uppercase the first character of each word in a string - * Source code: ext/standard/string.c -*/ - -/* - * Test ucwords() by passing different values including scalar and non scalar values -*/ - -echo "*** Testing ucwords() : usage variations ***\n"; -// initialize all required variables - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -$fp = fopen(__FILE__, "r"); - -class my -{ - function __toString() { - return "myString"; - } -} - -// array with different values -$values = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // hex values - 0x10, - 0X20, - 0xAA, - -0XF5, - - // octal values - 0123, - -0342, - - // float values - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // objects - new my(), - - // empty string - "", - '', - - //NULL - NULL, - null, - - // hex in string - "0x123", - '0x123', - "0xFF12", - "-0xFF12", - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var, - - // resource variable - $fp -); - -// loop through each element of the array and check the working of ucwords() -// when $str argument is supplied with different values -echo "\n--- Testing ucwords() by supplying different values for 'str' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $str = $values [$index]; - - var_dump( ucwords($str) ); - - $counter ++; -} - -// close the file handle -fclose($fp); -echo "Done\n"; -?> ---EXPECTF-- -*** Testing ucwords() : usage variations *** - ---- Testing ucwords() by supplying different values for 'str' argument --- --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(5) "12345" --- Iteration 4 -- -string(5) "-2345" --- Iteration 5 -- -string(2) "16" --- Iteration 6 -- -string(2) "32" --- Iteration 7 -- -string(3) "170" --- Iteration 8 -- -string(4) "-245" --- Iteration 9 -- -string(2) "83" --- Iteration 10 -- -string(4) "-226" --- Iteration 11 -- -string(4) "10.5" --- Iteration 12 -- -string(5) "-10.5" --- Iteration 13 -- -string(12) "101234567000" --- Iteration 14 -- -string(13) "1.07654321E-9" --- Iteration 15 -- -string(3) "0.5" --- Iteration 16 -- - -Warning: ucwords() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 17 -- - -Warning: ucwords() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 18 -- - -Warning: ucwords() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 19 -- - -Warning: ucwords() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 20 -- - -Warning: ucwords() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 21 -- -string(1) "1" --- Iteration 22 -- -string(0) "" --- Iteration 23 -- -string(1) "1" --- Iteration 24 -- -string(0) "" --- Iteration 25 -- -string(8) "MyString" --- Iteration 26 -- -string(0) "" --- Iteration 27 -- -string(0) "" --- Iteration 28 -- -string(0) "" --- Iteration 29 -- -string(0) "" --- Iteration 30 -- -string(5) "0x123" --- Iteration 31 -- -string(5) "0x123" --- Iteration 32 -- -string(6) "0xFF12" --- Iteration 33 -- -string(7) "-0xFF12" --- Iteration 34 -- -string(0) "" --- Iteration 35 -- -string(0) "" --- Iteration 36 -- - -Warning: ucwords() expects parameter 1 to be string, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/utf8_decode_variation1.phpt b/ext/standard/tests/strings/utf8_decode_variation1.phpt deleted file mode 100644 index 10d4f31ca4..0000000000 --- a/ext/standard/tests/strings/utf8_decode_variation1.phpt +++ /dev/null @@ -1,169 +0,0 @@ ---TEST-- -Test utf8_decode() function : usage variations - different types for data ---FILE-- -<?php -/* Prototype : proto string utf8_decode(string data) - * Description: Converts a UTF-8 encoded string to ISO-8859-1 - * Source code: ext/standard/string.c - * Alias to functions: - */ - -echo "*** Testing utf8_decode() : usage variations ***\n"; -error_reporting(E_ALL & ~E_NOTICE); - -class aClass { - function __toString() { - return "Some Ascii Data"; - } -} - -// Initialise function arguments not being substituted (if any) - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new aClass(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, -); - -// loop through each element of the array for data - -foreach($values as $value) { - echo @"\nArg value $value \n"; - var_dump( utf8_decode($value) ); -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing utf8_decode() : usage variations *** - -Arg value 0 -string(1) "0" - -Arg value 1 -string(1) "1" - -Arg value 12345 -string(5) "12345" - -Arg value -2345 -string(5) "-2345" - -Arg value 10.5 -string(4) "10.5" - -Arg value -10.5 -string(5) "-10.5" - -Arg value 101234567000 -string(12) "101234567000" - -Arg value 1.07654321E-9 -string(13) "1.07654321E-9" - -Arg value 0.5 -string(3) "0.5" - -Arg value Array - -Warning: utf8_decode() expects parameter 1 to be string, array given in %s on line %d -NULL - -Arg value Array - -Warning: utf8_decode() expects parameter 1 to be string, array given in %s on line %d -NULL - -Arg value Array - -Warning: utf8_decode() expects parameter 1 to be string, array given in %s on line %d -NULL - -Arg value Array - -Warning: utf8_decode() expects parameter 1 to be string, array given in %s on line %d -NULL - -Arg value Array - -Warning: utf8_decode() expects parameter 1 to be string, array given in %s on line %d -NULL - -Arg value -string(0) "" - -Arg value -string(0) "" - -Arg value 1 -string(1) "1" - -Arg value -string(0) "" - -Arg value 1 -string(1) "1" - -Arg value -string(0) "" - -Arg value -string(0) "" - -Arg value -string(0) "" - -Arg value Some Ascii Data -string(15) "Some Ascii Data" - -Arg value -string(0) "" - -Arg value -string(0) "" -Done diff --git a/ext/standard/tests/strings/utf8_encode_variation1.phpt b/ext/standard/tests/strings/utf8_encode_variation1.phpt deleted file mode 100644 index a0212ea45e..0000000000 --- a/ext/standard/tests/strings/utf8_encode_variation1.phpt +++ /dev/null @@ -1,169 +0,0 @@ ---TEST-- -Test utf8_encode() function : usage variations - <type here specifics of this variation> ---FILE-- -<?php -/* Prototype : proto string utf8_encode(string data) - * Description: Encodes an ISO-8859-1 string to UTF-8 - * Source code: ext/standard/string.c - * Alias to functions: - */ - -echo "*** Testing utf8_encode() : usage variations ***\n"; -error_reporting(E_ALL & ~E_NOTICE); - -class aClass { - function __toString() { - return "Some Ascii Data"; - } -} - -// Initialise function arguments not being substituted (if any) - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new aClass(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, -); - -// loop through each element of the array for data - -foreach($values as $value) { - echo @"\nArg value $value \n"; - var_dump( utf8_encode($value) ); -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing utf8_encode() : usage variations *** - -Arg value 0 -string(1) "0" - -Arg value 1 -string(1) "1" - -Arg value 12345 -string(5) "12345" - -Arg value -2345 -string(5) "-2345" - -Arg value 10.5 -string(4) "10.5" - -Arg value -10.5 -string(5) "-10.5" - -Arg value 101234567000 -string(12) "101234567000" - -Arg value 1.07654321E-9 -string(13) "1.07654321E-9" - -Arg value 0.5 -string(3) "0.5" - -Arg value Array - -Warning: utf8_encode() expects parameter 1 to be string, array given in %s on line %d -NULL - -Arg value Array - -Warning: utf8_encode() expects parameter 1 to be string, array given in %s on line %d -NULL - -Arg value Array - -Warning: utf8_encode() expects parameter 1 to be string, array given in %s on line %d -NULL - -Arg value Array - -Warning: utf8_encode() expects parameter 1 to be string, array given in %s on line %d -NULL - -Arg value Array - -Warning: utf8_encode() expects parameter 1 to be string, array given in %s on line %d -NULL - -Arg value -string(0) "" - -Arg value -string(0) "" - -Arg value 1 -string(1) "1" - -Arg value -string(0) "" - -Arg value 1 -string(1) "1" - -Arg value -string(0) "" - -Arg value -string(0) "" - -Arg value -string(0) "" - -Arg value Some Ascii Data -string(15) "Some Ascii Data" - -Arg value -string(0) "" - -Arg value -string(0) "" -Done diff --git a/ext/standard/tests/strings/vfprintf_basic.phpt b/ext/standard/tests/strings/vfprintf_basic.phpt index 2843e33af5..30cd5348bf 100644 --- a/ext/standard/tests/strings/vfprintf_basic.phpt +++ b/ext/standard/tests/strings/vfprintf_basic.phpt @@ -25,7 +25,7 @@ function writeAndDump($fp, $format, $args) echo "*** Testing vfprintf() : basic functionality ***\n"; // Open handle -$file = 'vfprintf_test.txt'; +$file = 'vfprintf_basic.txt'; $fp = fopen( $file, "a+" ); // Test vfprintf() @@ -46,7 +46,7 @@ fclose( $fp ); --CLEAN-- <?php -$file = 'vfprintf_test.txt'; +$file = 'vfprintf_basic.txt'; unlink( $file ); ?> diff --git a/ext/standard/tests/strings/vfprintf_error1.phpt b/ext/standard/tests/strings/vfprintf_error1.phpt index c3c869bb4d..c56631ecd7 100644 --- a/ext/standard/tests/strings/vfprintf_error1.phpt +++ b/ext/standard/tests/strings/vfprintf_error1.phpt @@ -13,7 +13,7 @@ precision=14 */ // Open handle -$file = 'vfprintf_test.txt'; +$file = 'vfprintf_error1.txt'; $fp = fopen( $file, "a+" ); echo "\n-- Testing vfprintf() function with more than expected no. of arguments --\n"; @@ -31,7 +31,7 @@ fclose($fp); --CLEAN-- <?php -$file = 'vfprintf_test.txt'; +$file = 'vfprintf_error1.txt'; unlink( $file ); ?> diff --git a/ext/standard/tests/strings/vfprintf_error2.phpt b/ext/standard/tests/strings/vfprintf_error2.phpt index 1eb89694ec..7da28468b3 100644 --- a/ext/standard/tests/strings/vfprintf_error2.phpt +++ b/ext/standard/tests/strings/vfprintf_error2.phpt @@ -13,7 +13,7 @@ precision=14 */ // Open handle -$file = 'vfprintf_test.txt'; +$file = 'vfprintf_error2.txt'; $fp = fopen( $file, "a+" ); echo "\n-- Testing vfprintf() function with less than expected no. of arguments --\n"; @@ -30,7 +30,7 @@ fclose($fp); --CLEAN-- <?php -$file = 'vfprintf_test.txt'; +$file = 'vfprintf_error2.txt'; unlink( $file ); ?> diff --git a/ext/standard/tests/strings/vfprintf_error3.phpt b/ext/standard/tests/strings/vfprintf_error3.phpt index dbc0d08897..8be51e1798 100644 --- a/ext/standard/tests/strings/vfprintf_error3.phpt +++ b/ext/standard/tests/strings/vfprintf_error3.phpt @@ -13,7 +13,7 @@ precision=14 */ // Open handle -$file = 'vfprintf_test.txt'; +$file = 'vfprintf_error3.txt'; $fp = fopen( $file, "a+" ); echo "\n-- Testing vfprintf() function with wrong variable types as argument --\n"; @@ -39,7 +39,7 @@ fclose( $fp ); --CLEAN-- <?php -$file = 'vfprintf_test.txt'; +$file = 'vfprintf_error3.txt'; unlink( $file ); ?> diff --git a/ext/standard/tests/strings/vfprintf_error4.phpt b/ext/standard/tests/strings/vfprintf_error4.phpt index 589d82c3d6..2865d42a9e 100644 --- a/ext/standard/tests/strings/vfprintf_error4.phpt +++ b/ext/standard/tests/strings/vfprintf_error4.phpt @@ -13,7 +13,7 @@ precision=14 */ // Open handle -$file = 'vfprintf_test.txt'; +$file = 'vfprintf_error4.txt'; $fp = fopen( $file, "a+" ); echo "\n-- Testing vfprintf() function with other strangeties --\n"; @@ -28,7 +28,7 @@ fclose( $fp ); --CLEAN-- <?php -$file = 'vfprintf_test.txt'; +$file = 'vfprintf_error4.txt'; unlink( $file ); ?> diff --git a/ext/standard/tests/strings/vfprintf_variation1.phpt b/ext/standard/tests/strings/vfprintf_variation1.phpt index 6358bccd1c..76422011c2 100644 --- a/ext/standard/tests/strings/vfprintf_variation1.phpt +++ b/ext/standard/tests/strings/vfprintf_variation1.phpt @@ -15,7 +15,7 @@ precision=14 echo "*** Testing vfprintf() : variation functionality ***\n"; // Open handle -$file = 'vfprintf_test.txt'; +$file = 'vfprintf_variation1.txt'; $fp = fopen( $file, 'a+' ); $funset = fopen( __FILE__, 'r' ); @@ -59,7 +59,7 @@ fclose( $fp ); --CLEAN-- <?php -$file = 'vfprintf_test.txt'; +$file = 'vfprintf_variation1.txt'; unlink( $file ); ?> diff --git a/ext/standard/tests/strings/vprintf_error.phpt b/ext/standard/tests/strings/vprintf_error.phpt index cf25257fc5..070b1b086c 100644 --- a/ext/standard/tests/strings/vprintf_error.phpt +++ b/ext/standard/tests/strings/vprintf_error.phpt @@ -31,16 +31,16 @@ var_dump( vprintf($format, $args, $extra_arg) ); -- Testing vprintf() function with Zero arguments -- -Warning: vprintf() expects at least 1 parameter, 0 given in %s on line %d +Warning: vprintf() expects exactly 2 parameters, 0 given in %s on line %d bool(false) -- Testing vprintf() function with less than expected no. of arguments -- -Warning: Wrong parameter count for vprintf() in %s on line %d +Warning: vprintf() expects exactly 2 parameters, 1 given in %s on line %d bool(false) -- testing vprintf() function with more than expected no. of arguments -- -Warning: Wrong parameter count for vprintf() in %s on line %d +Warning: vprintf() expects exactly 2 parameters, 3 given in %s on line %d bool(false) ===DONE=== diff --git a/ext/standard/tests/strings/vsprintf_error.phpt b/ext/standard/tests/strings/vsprintf_error.phpt index 2876eb1334..2fe85f09f4 100644 --- a/ext/standard/tests/strings/vsprintf_error.phpt +++ b/ext/standard/tests/strings/vsprintf_error.phpt @@ -31,16 +31,16 @@ echo "Done"; -- Testing vsprintf() function with Zero arguments -- -Warning: vsprintf() expects at least %d parameter, %d given in %s on line %d +Warning: vsprintf() expects exactly 2 parameters, 0 given in %s on line %d bool(false) -- Testing vsprintf() function with less than expected no. of arguments -- -Warning: Wrong parameter count for vsprintf() in %s on line %d +Warning: vsprintf() expects exactly 2 parameters, 1 given in %s on line %d bool(false) -- testing vsprintf() function with more than expected no. of arguments -- -Warning: Wrong parameter count for vsprintf() in %s on line %d +Warning: vsprintf() expects exactly 2 parameters, 3 given in %s on line %d bool(false) Done diff --git a/ext/standard/tests/strings/wordwrap_variation1.phpt b/ext/standard/tests/strings/wordwrap_variation1.phpt deleted file mode 100644 index 86f6fac482..0000000000 --- a/ext/standard/tests/strings/wordwrap_variation1.phpt +++ /dev/null @@ -1,335 +0,0 @@ ---TEST-- -Test wordwrap() function : usage variations - unexpected values for str argument ---FILE-- -<?php -/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] ) - * Description: Wraps buffer to selected number of characters using string break char - * Source code: ext/standard/string.c -*/ - -/* - * testing wordwrap() by providing different values for str argument -*/ - -echo "*** Testing wordwrap() : usage variations ***\n"; -// initialize all required variables -$width = 3; -$break = '<br />\n'; -$cut = true; - -// resource variable -$fp = fopen(__FILE__, "r"); - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// array with different values -$values = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // float values - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // objects - new stdclass(), - - // Null - NULL, - null, - - // empty string - "", - '', - - // resource variable - $fp, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - -// loop though each element of the array and check the working of wordwrap() -// when $str argument is supplied with different values -echo "\n--- Testing wordwrap() by supplying different values for 'str' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $str = $values [$index]; - - var_dump( wordwrap($str) ); - var_dump( wordwrap($str, $width) ); - var_dump( wordwrap($str, $width, $break) ); - - // $cut as false - $cut = false; - var_dump( wordwrap($str, $width, $break, $cut) ); - - // $cut as true - $cut = true; - var_dump( wordwrap($str, $width, $break, $cut) ); - - $counter ++; -} - -// close the resource -fclose($fp); - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing wordwrap() : usage variations *** - ---- Testing wordwrap() by supplying different values for 'str' argument --- --- Iteration 1 -- -string(1) "0" -string(1) "0" -string(1) "0" -string(1) "0" -string(1) "0" --- Iteration 2 -- -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" --- Iteration 3 -- -string(5) "12345" -string(5) "12345" -string(5) "12345" -string(5) "12345" -string(13) "123<br />\n45" --- Iteration 4 -- -string(5) "-2345" -string(5) "-2345" -string(5) "-2345" -string(5) "-2345" -string(13) "-23<br />\n45" --- Iteration 5 -- -string(4) "10.5" -string(4) "10.5" -string(4) "10.5" -string(4) "10.5" -string(12) "10.<br />\n5" --- Iteration 6 -- -string(5) "-10.5" -string(5) "-10.5" -string(5) "-10.5" -string(5) "-10.5" -string(13) "-10<br />\n.5" --- Iteration 7 -- -string(12) "101234567000" -string(12) "101234567000" -string(12) "101234567000" -string(12) "101234567000" -string(36) "101<br />\n234<br />\n567<br />\n000" --- Iteration 8 -- -string(13) "1.07654321E-9" -string(13) "1.07654321E-9" -string(13) "1.07654321E-9" -string(13) "1.07654321E-9" -string(45) "1.0<br />\n765<br />\n432<br />\n1E-<br />\n9" --- Iteration 9 -- -string(3) "0.5" -string(3) "0.5" -string(3) "0.5" -string(3) "0.5" -string(3) "0.5" --- Iteration 10 -- - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" --- Iteration 16 -- -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(0) "" --- Iteration 17 -- -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" --- Iteration 18 -- -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(0) "" --- Iteration 19 -- - -Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d -NULL --- Iteration 20 -- -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(0) "" --- Iteration 21 -- -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(0) "" --- Iteration 22 -- -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(0) "" --- Iteration 23 -- -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(0) "" --- Iteration 24 -- - -Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 25 -- -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(0) "" --- Iteration 26 -- -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(0) "" -Done diff --git a/ext/standard/tests/strings/wordwrap_variation2.phpt b/ext/standard/tests/strings/wordwrap_variation2.phpt deleted file mode 100644 index 4756e98674..0000000000 --- a/ext/standard/tests/strings/wordwrap_variation2.phpt +++ /dev/null @@ -1,340 +0,0 @@ ---TEST-- -Test wordwrap() function : usage variations - unexpected values for width argument ---FILE-- -<?php -/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] ) - * Description: Wraps buffer to selected number of characters using string break char - * Source code: ext/standard/string.c -*/ - -/* - * test wordwrap by passing different values for width argument -*/ -echo "*** Testing wordwrap() : usage variations ***\n"; -// initialize all required variables -$str = 'testing wordwrap function'; -$break = '<br />\n'; -$cut = true; - -// resource var -$fp = fopen(__FILE__, "r"); - -// get an unset variable -$unset_var = 10; -unset($unset_var); - - -// array with different values as width -$values = array ( - // zerovalue for width - 0, - - // -ve value for width - -1, - -10, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // string values - "string", - 'string', - - // objects - new stdclass(), - - // Null value - NULL, - null, - - // empty string - "", - '', - - // resource variable - $fp, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - - -// loop though each element of the array and check the working of wordwrap() -// when $width argument is supplied with different values -echo "\n--- Testing wordwrap() by supplying different values for 'width' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $width = $values [$index]; - - var_dump( wordwrap($str, $width) ); - var_dump( wordwrap($str, $width, $break) ); - - // cut as false - $cut = false; - var_dump( wordwrap($str, $width, $break, $cut) ); - - // cut as true - $cut = true; - var_dump( wordwrap($str, $width, $break, $cut) ); - - $counter ++; -} - -// close the resource -fclose($fp); - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing wordwrap() : usage variations *** - ---- Testing wordwrap() by supplying different values for 'width' argument --- --- Iteration 1 -- -string(25) "testing -wordwrap -function" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(39) "testing<br />\nwordwrap<br />\nfunction" - -Warning: wordwrap(): Can't force cut when width is zero in %s on line %d -bool(false) --- Iteration 2 -- -string(25) "testing -wordwrap -function" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(223) "<br />\nt<br />\ne<br />\ns<br />\nt<br />\ni<br />\nn<br />\ng<br />\n<br />\nw<br />\no<br />\nr<br />\nd<br />\nw<br />\nr<br />\na<br />\np<br />\n<br />\nf<br />\nu<br />\nn<br />\nc<br />\nt<br />\ni<br />\no<br />\nn" --- Iteration 3 -- -string(25) "testing -wordwrap -function" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(223) "<br />\nt<br />\ne<br />\ns<br />\nt<br />\ni<br />\nn<br />\ng<br />\n<br />\nw<br />\no<br />\nr<br />\nd<br />\nw<br />\nr<br />\na<br />\np<br />\n<br />\nf<br />\nu<br />\nn<br />\nc<br />\nt<br />\ni<br />\no<br />\nn" --- Iteration 4 -- - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 5 -- - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 6 -- - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 7 -- - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 8 -- - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 9 -- -string(25) "testing -wordwrap -function" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(199) "t<br />\ne<br />\ns<br />\nt<br />\ni<br />\nn<br />\ng<br />\nw<br />\no<br />\nr<br />\nd<br />\nw<br />\nr<br />\na<br />\np<br />\nf<br />\nu<br />\nn<br />\nc<br />\nt<br />\ni<br />\no<br />\nn" --- Iteration 10 -- -string(25) "testing -wordwrap -function" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(39) "testing<br />\nwordwrap<br />\nfunction" - -Warning: wordwrap(): Can't force cut when width is zero in %s on line %d -bool(false) --- Iteration 11 -- -string(25) "testing -wordwrap -function" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(199) "t<br />\ne<br />\ns<br />\nt<br />\ni<br />\nn<br />\ng<br />\nw<br />\no<br />\nr<br />\nd<br />\nw<br />\nr<br />\na<br />\np<br />\nf<br />\nu<br />\nn<br />\nc<br />\nt<br />\ni<br />\no<br />\nn" --- Iteration 12 -- -string(25) "testing -wordwrap -function" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(39) "testing<br />\nwordwrap<br />\nfunction" - -Warning: wordwrap(): Can't force cut when width is zero in %s on line %d -bool(false) --- Iteration 13 -- - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 14 -- - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 15 -- - -Warning: wordwrap() expects parameter 2 to be int, object given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, object given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, object given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, object given in %s on line %d -NULL --- Iteration 16 -- -string(25) "testing -wordwrap -function" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(39) "testing<br />\nwordwrap<br />\nfunction" - -Warning: wordwrap(): Can't force cut when width is zero in %s on line %d -bool(false) --- Iteration 17 -- -string(25) "testing -wordwrap -function" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(39) "testing<br />\nwordwrap<br />\nfunction" - -Warning: wordwrap(): Can't force cut when width is zero in %s on line %d -bool(false) --- Iteration 18 -- - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 19 -- - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 20 -- - -Warning: wordwrap() expects parameter 2 to be int, resource given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, resource given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, resource given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, resource given in %s on line %d -NULL --- Iteration 21 -- -string(25) "testing -wordwrap -function" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(39) "testing<br />\nwordwrap<br />\nfunction" - -Warning: wordwrap(): Can't force cut when width is zero in %s on line %d -bool(false) --- Iteration 22 -- -string(25) "testing -wordwrap -function" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(39) "testing<br />\nwordwrap<br />\nfunction" - -Warning: wordwrap(): Can't force cut when width is zero in %s on line %d -bool(false) -Done diff --git a/ext/standard/tests/strings/wordwrap_variation3.phpt b/ext/standard/tests/strings/wordwrap_variation3.phpt deleted file mode 100644 index 5774ce3752..0000000000 --- a/ext/standard/tests/strings/wordwrap_variation3.phpt +++ /dev/null @@ -1,301 +0,0 @@ ---TEST-- -Test wordwrap() function : usage variations - unexptected values for break argument ---FILE-- -<?php -/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] ) - * Description: Wraps buffer to selected number of characters using string break char - * Source code: ext/standard/string.c -*/ - -/* - * test wordwrap by passing different values for break argument -*/ -echo "*** Testing wordwrap() : usage variations ***\n"; -// initialize all required variables -$str = 'testing wordwrap function'; -$width = 10; -$cut = true; - -// resource var -$fp = fopen(__FILE__, "r"); - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - - -// array with different values for break arg -$values = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // float values - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // objects - new stdclass(), - - // empty string - "", - '', - - //Null - NULL, - null, - - // resource var - $fp, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - -// loop though each element of the array and check the working of wordwrap() -// when $break argument is supplied with different values -echo "\n--- Testing wordwrap() by supplying different values for 'break' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $break = $values [$index]; - - var_dump( wordwrap($str, $width, $break) ); - - // $cut as false - $cut = false; - var_dump( wordwrap($str, $width, $break, $cut) ); - - // $cut as true - $cut = true; - var_dump( wordwrap($str, $width, $break, $cut) ); - - $counter ++; -} - -// close the resource used -fclose($fp); - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing wordwrap() : usage variations *** - ---- Testing wordwrap() by supplying different values for 'break' argument --- --- Iteration 1 -- -string(25) "testing0wordwrap0function" -string(25) "testing0wordwrap0function" -string(25) "testing0wordwrap0function" --- Iteration 2 -- -string(25) "testing1wordwrap1function" -string(25) "testing1wordwrap1function" -string(25) "testing1wordwrap1function" --- Iteration 3 -- -string(33) "testing12345wordwrap12345function" -string(33) "testing12345wordwrap12345function" -string(33) "testing12345wordwrap12345function" --- Iteration 4 -- -string(33) "testing-2345wordwrap-2345function" -string(33) "testing-2345wordwrap-2345function" -string(33) "testing-2345wordwrap-2345function" --- Iteration 5 -- -string(31) "testing10.5wordwrap10.5function" -string(31) "testing10.5wordwrap10.5function" -string(31) "testing10.5wordwrap10.5function" --- Iteration 6 -- -string(33) "testing-10.5wordwrap-10.5function" -string(33) "testing-10.5wordwrap-10.5function" -string(33) "testing-10.5wordwrap-10.5function" --- Iteration 7 -- -string(47) "testing101234567000wordwrap101234567000function" -string(47) "testing101234567000wordwrap101234567000function" -string(47) "testing101234567000wordwrap101234567000function" --- Iteration 8 -- -string(49) "testing1.07654321E-9wordwrap1.07654321E-9function" -string(49) "testing1.07654321E-9wordwrap1.07654321E-9function" -string(49) "testing1.07654321E-9wordwrap1.07654321E-9function" --- Iteration 9 -- -string(29) "testing0.5wordwrap0.5function" -string(29) "testing0.5wordwrap0.5function" -string(29) "testing0.5wordwrap0.5function" --- Iteration 10 -- - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(25) "testing1wordwrap1function" -string(25) "testing1wordwrap1function" -string(25) "testing1wordwrap1function" --- Iteration 16 -- - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) --- Iteration 17 -- -string(25) "testing1wordwrap1function" -string(25) "testing1wordwrap1function" -string(25) "testing1wordwrap1function" --- Iteration 18 -- - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) --- Iteration 19 -- - -Warning: wordwrap() expects parameter 3 to be string, object given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, object given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, object given in %s on line %d -NULL --- Iteration 20 -- - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) --- Iteration 21 -- - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) --- Iteration 22 -- - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) --- Iteration 23 -- - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) --- Iteration 24 -- - -Warning: wordwrap() expects parameter 3 to be string, resource given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, resource given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, resource given in %s on line %d -NULL --- Iteration 25 -- - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) --- Iteration 26 -- - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) -Done diff --git a/ext/standard/tests/strings/wordwrap_variation4.phpt b/ext/standard/tests/strings/wordwrap_variation4.phpt deleted file mode 100644 index 656db58b15..0000000000 --- a/ext/standard/tests/strings/wordwrap_variation4.phpt +++ /dev/null @@ -1,144 +0,0 @@ ---TEST-- -Test wordwrap() function : usage variations - unexptected value for cut argument ---FILE-- -<?php -/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] ) - * Description: Wraps buffer to selected number of characters using string break char - * Source code: ext/standard/string.c -*/ - -/* - * test wordwrap() by supplying different values for cut argument -*/ - -echo "*** Testing wordwrap() : usage variations ***\n"; -// initialize all required variables -$str = 'testing wordwrap function'; -$width = 10; -$break = '<br />\n'; - -// get an unset variable -$unset_var = true; -unset($unset_var); - -// resource variable -$fp = fopen(__FILE__, "r"); - -// array with different values -$values = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // float values - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // string values - "string", - 'string', - - // objects - new stdclass(), - - // empty string - "", - '', - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - -// loop though each element of the array and check the working of wordwrap() -// when $cut argument is supplied with different values -echo "\n--- Testing wordwrap() by supplying different values for 'cut' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $cut = $values [$index]; - - var_dump( wordwrap($str, $width, $break, $cut) ); - - $counter ++; -} - -// close the resource -fclose($fp); - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing wordwrap() : usage variations *** - ---- Testing wordwrap() by supplying different values for 'cut' argument --- --- Iteration 1 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 2 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 3 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 4 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 5 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 6 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 7 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 8 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 9 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 10 -- - -Warning: wordwrap() expects parameter 4 to be bool, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: wordwrap() expects parameter 4 to be bool, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: wordwrap() expects parameter 4 to be bool, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: wordwrap() expects parameter 4 to be bool, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: wordwrap() expects parameter 4 to be bool, array given in %s on line %d -NULL --- Iteration 15 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 16 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 17 -- - -Warning: wordwrap() expects parameter 4 to be bool, object given in %s on line %d -NULL --- Iteration 18 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 19 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 20 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 21 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" -Done |