cvs: php-src(PHP_5_2) /ext/standard/tests/strings chunk_split_variation1.phpt chunk_split_variation2.phpt chunk_split_variation3.phpt
crc32_variation1.phpt strcspn_variation1.phpt strcspn_variation2.phpt strcspn_variation3.phpt strcspn_variation4.phpt strspn_variation1.phpt
strspn_variation2.phpt strspn_variation3.phpt strspn_variation4.phpt strtok_variation1.phpt ucwords_variation1.phpt
| From: | Raghubansh Kumar | Date: | Fri, 09 Nov 2007 07:09:52 +0000 |
| Subject: | cvs: php-src(PHP_5_2) /ext/standard/tests/strings chunk_split_variation1.phpt chunk_split_variation2.phpt chunk_split_variation3.phpt crc32_variation1.phpt strcspn_variation1.phpt strcspn_variation2.phpt strcspn_variation3.phpt strcspn_variation4.phpt strspn_variation1.phpt strspn_variation2.phpt strspn_variation3.phpt strspn_variation4.phpt strtok_variation1.phpt ucwords_variation1.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-47080@lists.php.net to get a copy of this message | ||
kraghuba Fri Nov 9 07:09:52 2007 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/standard/tests/strings strcspn_variation1.phpt
strcspn_variation4.phpt
strtok_variation1.phpt
chunk_split_variation2.phpt
strspn_variation1.phpt
strspn_variation4.phpt
strcspn_variation3.phpt
ucwords_variation1.phpt
chunk_split_variation3.phpt
strspn_variation3.phpt
crc32_variation1.phpt
strcspn_variation2.phpt
chunk_split_variation1.phpt
strspn_variation2.phpt
Log:
fix tests: better float values
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strcspn_variation1.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-src/ext/standard/tests/strings/strcspn_variation1.phpt diff -u php-src/ext/standard/tests/strings/strcspn_variation1.phpt:1.1.2.1 php-src/ext/standard/tests/strings/strcspn_variation1.phpt:1.1.2.2 --- php-src/ext/standard/tests/strings/strcspn_variation1.phpt:1.1.2.1 Sat Sep 22 10:36:15 2007 +++ php-src/ext/standard/tests/strings/strcspn_variation1.phpt Fri Nov 9 07:09:52 2007 @@ -1,276 +1,273 @@ ---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 -*/ - - -/* -* 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.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, - - // 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 *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - --- 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 "105000000000" -int(0) -int(0) -int(0) - --- Iteration with str value as "1.06E-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 +--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 \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strcspn_variation4.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-src/ext/standard/tests/strings/strcspn_variation4.phpt diff -u php-src/ext/standard/tests/strings/strcspn_variation4.phpt:1.1.2.1 php-src/ext/standard/tests/strings/strcspn_variation4.phpt:1.1.2.2 --- php-src/ext/standard/tests/strings/strcspn_variation4.phpt:1.1.2.1 Sat Sep 22 10:36:15 2007 +++ php-src/ext/standard/tests/strings/strcspn_variation4.phpt Fri Nov 9 07:09:52 2007 @@ -1,198 +1,196 @@ ---TEST-- -Test strcspn() function : usage variations - unexpected values of len 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 -*/ - -/* -* 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.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 - "", - '', - - // 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 *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - --- Iteration with len value as "10.5" -- -int(0) - --- Iteration with len value as "-10.5" -- -int(0) - --- Iteration with len value as "105000000000" -- -int(0) - --- Iteration with len value as "1.06E-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 long, array given in %s on line %d -NULL - --- Iteration with len value as "Array" -- - -Warning: strcspn() expects parameter 4 to be long, array given in %s on line %d -NULL - --- Iteration with len value as "Array" -- - -Warning: strcspn() expects parameter 4 to be long, array given in %s on line %d -NULL - --- Iteration with len value as "Array" -- - -Warning: strcspn() expects parameter 4 to be long, array given in %s on line %d -NULL - --- Iteration with len value as "Array" -- - -Warning: strcspn() expects parameter 4 to be long, 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 long, string given in %s on line %d -NULL - --- Iteration with len value as "" -- - -Warning: strcspn() expects parameter 4 to be long, string given in %s on line %d -NULL - --- Iteration with len value as "string" -- - -Warning: strcspn() expects parameter 4 to be long, string given in %s on line %d -NULL - --- Iteration with len value as "string" -- - -Warning: strcspn() expects parameter 4 to be long, string given in %s on line %d -NULL - --- Iteration with len value as "object" -- - -Warning: strcspn() expects parameter 4 to be long, 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 long, resource given in %s on line %d -NULL -Done +--TEST-- +Test strcspn() function : usage variations - unexpected values of len 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 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 long, array given in %s on line %d +NULL + +-- Iteration with len value as "Array" -- + +Warning: strcspn() expects parameter 4 to be long, array given in %s on line %d +NULL + +-- Iteration with len value as "Array" -- + +Warning: strcspn() expects parameter 4 to be long, array given in %s on line %d +NULL + +-- Iteration with len value as "Array" -- + +Warning: strcspn() expects parameter 4 to be long, array given in %s on line %d +NULL + +-- Iteration with len value as "Array" -- + +Warning: strcspn() expects parameter 4 to be long, 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 long, string given in %s on line %d +NULL + +-- Iteration with len value as "" -- + +Warning: strcspn() expects parameter 4 to be long, string given in %s on line %d +NULL + +-- Iteration with len value as "string" -- + +Warning: strcspn() expects parameter 4 to be long, string given in %s on line %d +NULL + +-- Iteration with len value as "string" -- + +Warning: strcspn() expects parameter 4 to be long, string given in %s on line %d +NULL + +-- Iteration with len value as "object" -- + +Warning: strcspn() expects parameter 4 to be long, 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 long, resource given in %s on line %d +NULL +Done \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strtok_variation1.phpt?r1=1.1.2.3&r2=1.1.2.4&diff_format=u Index: php-src/ext/standard/tests/strings/strtok_variation1.phpt diff -u php-src/ext/standard/tests/strings/strtok_variation1.phpt:1.1.2.3 php-src/ext/standard/tests/strings/strtok_variation1.phpt:1.1.2.4 --- php-src/ext/standard/tests/strings/strtok_variation1.phpt:1.1.2.3 Tue Oct 9 12:12:19 2007 +++ php-src/ext/standard/tests/strings/strtok_variation1.phpt Fri Nov 9 07:09:52 2007 @@ -1,172 +1,172 @@ ---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.5e10, - 10.6E-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 vlaues - 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 arugment 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) "105000000000" --- Iteration 8 -- -string(5) "1.06E" --- Iteration 9 -- -string(3) "0.5" --- Iteration 10 -- - -Notice: Array to string conversion in %s on line %d -string(5) "Array" --- Iteration 11 -- - -Notice: Array to string conversion in %s on line %d -string(5) "Array" --- Iteration 12 -- - -Notice: Array to string conversion in %s on line %d -string(5) "Array" --- Iteration 13 -- - -Notice: Array to string conversion in %s on line %d -string(5) "Array" --- Iteration 14 -- - -Notice: Array to string conversion in %s on line %d -string(5) "Array" --- 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 -- -string(%d) "Resource id #%d" -Done +--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 vlaues + 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 arugment 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 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 11 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 12 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 13 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 14 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- 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 -- +string(%d) "Resource id #%d" +Done \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/chunk_split_variation2.phpt?r1=1.1.2.3&r2=1.1.2.4&diff_format=u Index: php-src/ext/standard/tests/strings/chunk_split_variation2.phpt diff -u php-src/ext/standard/tests/strings/chunk_split_variation2.phpt:1.1.2.3 php-src/ext/standard/tests/strings/chunk_split_variation2.phpt:1.1.2.4 --- php-src/ext/standard/tests/strings/chunk_split_variation2.phpt:1.1.2.3 Thu Oct 4 13:31:11 2007 +++ php-src/ext/standard/tests/strings/chunk_split_variation2.phpt Fri Nov 9 07:09:52 2007 @@ -1,172 +1,174 @@ ---TEST-- -Test chunk_split() function : usage variations - unexpected values for 'chunklen' argument(Bug#42796) ---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, - 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 - "", - '', - - // 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) ); -} - -echo "Done"; - -//closing resource -fclose($fp); - -?> ---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 %s on line %d -bool(false) --- Iteration 3 -- -string(26) "This is chuklen variation*" --- Iteration 4 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d -bool(false) --- Iteration 7 -- -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 8 -- -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 9 -- -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 10 -- -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 11 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d -bool(false) --- Iteration 12 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s 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 %s 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 %s on line %d -bool(false) --- Iteration 17 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d -bool(false) --- Iteration 18 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d -bool(false) --- Iteration 19 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d -bool(false) --- Iteration 20 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d -bool(false) --- Iteration 21 -- - -Notice: Object of class MyClass could not be converted to int in %s on line %d -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 22 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d -bool(false) --- Iteration 23 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d -bool(false) --- Iteration 24 -- -string(30) "This *is ch*uklen* vari*ation*" -Done +--TEST-- +Test chunk_split() function : usage variations - unexpected values for 'chunklen' argument(Bug#42796) +--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, + 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 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) ); +} + +echo "Done"; + +//closing resource +fclose($fp); + +?> +--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 %s on line %d +bool(false) +-- Iteration 3 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 4 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 5 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 6 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 7 -- +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 8 -- +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 9 -- +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 10 -- +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 11 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 12 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s 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 %s 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 %s on line %d +bool(false) +-- Iteration 17 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 18 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 19 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 20 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 21 -- + +Notice: Object of class MyClass could not be converted to int in %s on line %d +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 22 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 23 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 24 -- +string(%d) "%s" +Done \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strspn_variation1.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u Index: php-src/ext/standard/tests/strings/strspn_variation1.phpt diff -u php-src/ext/standard/tests/strings/strspn_variation1.phpt:1.1.2.2 php-src/ext/standard/tests/strings/strspn_variation1.phpt:1.1.2.3 --- php-src/ext/standard/tests/strings/strspn_variation1.phpt:1.1.2.2 Sat Sep 22 10:51:38 2007 +++ php-src/ext/standard/tests/strings/strspn_variation1.phpt Fri Nov 9 07:09:52 2007 @@ -1,275 +1,273 @@ ---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 -*/ - -/* -* 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.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, - - // 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 *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - --- 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 "105000000000" -int(12) -int(11) -int(10) - --- Iteration with str value as "1.06E-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 +--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 \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strspn_variation4.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u Index: php-src/ext/standard/tests/strings/strspn_variation4.phpt diff -u php-src/ext/standard/tests/strings/strspn_variation4.phpt:1.1.2.2 php-src/ext/standard/tests/strings/strspn_variation4.phpt:1.1.2.3 --- php-src/ext/standard/tests/strings/strspn_variation4.phpt:1.1.2.2 Sat Sep 22 10:51:38 2007 +++ php-src/ext/standard/tests/strings/strspn_variation4.phpt Fri Nov 9 07:09:52 2007 @@ -9,6 +9,8 @@ * Alias to functions: none */ +error_reporting(E_ALL & ~E_NOTICE); + /* * Testing strspn() : with unexpected values of len argument */ @@ -41,8 +43,8 @@ // float data 10.5, -10.5, - 10.5e10, - 10.6E-10, + 10.1234567e10, + 10.7654321E-10, .5, // array data @@ -98,20 +100,16 @@ --EXPECTF-- *** Testing strspn() : with unexpected values of len argument *** -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - -- Iteration with len value as "10.5" -- int(2) -- Iteration with len value as "-10.5" -- int(0) --- Iteration with len value as "105000000000" -- -int(2) +-- Iteration with len value as "101234567000" -- +int(0) --- Iteration with len value as "1.06E-9" -- +-- Iteration with len value as "1.07654321E-9" -- int(0) -- Iteration with len value as "0.5" -- @@ -195,4 +193,4 @@ Warning: strspn() expects parameter 4 to be long, resource given in %s on line %d NULL -Done +Done \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strcspn_variation3.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-src/ext/standard/tests/strings/strcspn_variation3.phpt diff -u php-src/ext/standard/tests/strings/strcspn_variation3.phpt:1.1.2.1 php-src/ext/standard/tests/strings/strcspn_variation3.phpt:1.1.2.2 --- php-src/ext/standard/tests/strings/strcspn_variation3.phpt:1.1.2.1 Sat Sep 22 10:36:15 2007 +++ php-src/ext/standard/tests/strings/strcspn_variation3.phpt Fri Nov 9 07:09:52 2007 @@ -1,245 +1,243 @@ ---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 -*/ - -/* -* 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.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 - "", - '', - - // 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 *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - --- 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 "105000000000" -- -bool(false) -bool(false) - --- Iteration with start value as "1.06E-9" -- -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 long, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d -NULL - --- Iteration with start value as "Array" -- - -Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d -NULL - --- Iteration with start value as "Array" -- - -Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d -NULL - --- Iteration with start value as "Array" -- - -Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d -NULL - --- Iteration with start value as "Array" -- - -Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be long, 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 long, string given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d -NULL - --- Iteration with start value as "" -- - -Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d -NULL - --- Iteration with start value as "string" -- - -Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d -NULL - --- Iteration with start value as "string" -- - -Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d -NULL - --- Iteration with start value as "object" -- - -Warning: strcspn() expects parameter 3 to be long, object given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be long, 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 long, resource given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be long, resource given in %s on line %d -NULL -Done +--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.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 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 "101234567000" -- +int(0) +int(0) + +-- Iteration with start value as "1.07654321E-9" -- +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 long, array given in %s on line 89 +NULL + +Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +-- Iteration with start value as "Array" -- + +Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +-- Iteration with start value as "Array" -- + +Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +-- Iteration with start value as "Array" -- + +Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +-- Iteration with start value as "Array" -- + +Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +Warning: strcspn() expects parameter 3 to be long, 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 long, string given in %s on line %d +NULL + +Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +-- Iteration with start value as "" -- + +Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +-- Iteration with start value as "string" -- + +Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +-- Iteration with start value as "string" -- + +Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +-- Iteration with start value as "object" -- + +Warning: strcspn() expects parameter 3 to be long, object given in %s on line %d +NULL + +Warning: strcspn() expects parameter 3 to be long, 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 long, resource given in %s on line %d +NULL + +Warning: strcspn() expects parameter 3 to be long, resource given in %s on line %d +NULL +Done \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/ucwords_variation1.phpt?r1=1.1.2.4&r2=1.1.2.5&diff_format=u Index: php-src/ext/standard/tests/strings/ucwords_variation1.phpt diff -u php-src/ext/standard/tests/strings/ucwords_variation1.phpt:1.1.2.4 php-src/ext/standard/tests/strings/ucwords_variation1.phpt:1.1.2.5 --- php-src/ext/standard/tests/strings/ucwords_variation1.phpt:1.1.2.4 Tue Oct 9 10:56:45 2007 +++ php-src/ext/standard/tests/strings/ucwords_variation1.phpt Fri Nov 9 07:09:52 2007 @@ -49,8 +49,8 @@ // float values 10.5, -10.5, - 10.5e10, - 10.6E-10, + 10.1234567e10, + 10.7654321E-10, .5, // array values @@ -139,9 +139,9 @@ -- Iteration 12 -- string(5) "-10.5" -- Iteration 13 -- -string(12) "105000000000" +string(12) "101234567000" -- Iteration 14 -- -string(7) "1.06E-9" +string(13) "1.07654321E-9" -- Iteration 15 -- string(3) "0.5" -- Iteration 16 -- @@ -162,7 +162,7 @@ string(5) "Array" -- Iteration 20 -- -Notice: Array to string conversion in %s on line %d +Notice: Array to string conversion in %s on line 101 string(5) "Array" -- Iteration 21 -- string(1) "1" @@ -196,4 +196,4 @@ string(0) "" -- Iteration 36 -- string(%d) "Resource Id #%d" -Done +Done \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/chunk_split_variation3.phpt?r1=1.1.2.3&r2=1.1.2.4&diff_format=u Index: php-src/ext/standard/tests/strings/chunk_split_variation3.phpt diff -u php-src/ext/standard/tests/strings/chunk_split_variation3.phpt:1.1.2.3 php-src/ext/standard/tests/strings/chunk_split_variation3.phpt:1.1.2.4 --- php-src/ext/standard/tests/strings/chunk_split_variation3.phpt:1.1.2.3 Tue Oct 9 10:56:45 2007 +++ php-src/ext/standard/tests/strings/chunk_split_variation3.phpt Fri Nov 9 07:09:52 2007 @@ -1,158 +1,158 @@ ---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.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 '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) "This105000000000 is 105000000000simp105000000000le s105000000000trin105000000000g.105000000000" --- Iteration 8 -- -string(64) "This1.06E-9 is 1.06E-9simp1.06E-9le s1.06E-9trin1.06E-9g.1.06E-9" --- Iteration 9 -- -string(40) "This0.5 is 0.5simp0.5le s0.5trin0.5g.0.5" --- Iteration 10 -- - -Notice: Array to string conversion in %s on line %d -string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array" --- Iteration 11 -- - -Notice: Array to string conversion in %s on line %d -string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array" --- Iteration 12 -- - -Notice: Array to string conversion in %s on line %d -string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array" --- Iteration 13 -- - -Notice: Array to string conversion in %s on line %d -string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array" --- Iteration 14 -- - -Notice: Array to string conversion in %s on line %d -string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array" --- 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 -- -string(%d) "ThisResource id #%d is Resource id #%dsimpResource id #%dle sResource id #%dtrinResource id #%dg.Resource id #%d" -Done +--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 -- + +Notice: Array to string conversion in %s on line %d +string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array" +-- Iteration 11 -- + +Notice: Array to string conversion in %s on line %d +string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array" +-- Iteration 12 -- + +Notice: Array to string conversion in %s on line %d +string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array" +-- Iteration 13 -- + +Notice: Array to string conversion in %s on line %d +string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array" +-- Iteration 14 -- + +Notice: Array to string conversion in %s on line %d +string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array" +-- 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 -- +string(%d) "ThisResource id #%d is Resource id #%dsimpResource id #%dle sResource id #%dtrinResource id #%dg.Resource id #%d" +Done \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strspn_variation3.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u Index: php-src/ext/standard/tests/strings/strspn_variation3.phpt diff -u php-src/ext/standard/tests/strings/strspn_variation3.phpt:1.1.2.2 php-src/ext/standard/tests/strings/strspn_variation3.phpt:1.1.2.3 --- php-src/ext/standard/tests/strings/strspn_variation3.phpt:1.1.2.2 Sat Sep 22 10:51:38 2007 +++ php-src/ext/standard/tests/strings/strspn_variation3.phpt Fri Nov 9 07:09:52 2007 @@ -9,6 +9,8 @@ * Alias to functions: none */ +error_reporting(E_ALL & ~E_NOTICE); + /* * Testing strspn() : with unexpected values of start argument */ @@ -41,8 +43,8 @@ // float data 10.5, -10.5, - 10.5e10, - 10.6E-10, + 10.1234567e10, + 10.7654321E-10, .5, // array data @@ -99,10 +101,6 @@ --EXPECTF-- *** Testing strspn() : with unexpected values of start argument *** -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - -- Iteration with start value as "10.5" -- int(0) int(0) @@ -111,11 +109,11 @@ int(2) int(2) --- Iteration with start value as "105000000000" -- -bool(false) -bool(false) +-- Iteration with start value as "101234567000" -- +int(2) +int(2) --- Iteration with start value as "1.06E-9" -- +-- Iteration with start value as "1.07654321E-9" -- int(2) int(2) @@ -242,4 +240,4 @@ Warning: strspn() expects parameter 3 to be long, resource given in %s on line %d NULL -Done +Done \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/crc32_variation1.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-src/ext/standard/tests/strings/crc32_variation1.phpt diff -u php-src/ext/standard/tests/strings/crc32_variation1.phpt:1.1.2.1 php-src/ext/standard/tests/strings/crc32_variation1.phpt:1.1.2.2 --- php-src/ext/standard/tests/strings/crc32_variation1.phpt:1.1.2.1 Wed Sep 26 06:03:55 2007 +++ php-src/ext/standard/tests/strings/crc32_variation1.phpt Fri Nov 9 07:09:52 2007 @@ -1,196 +1,197 @@ ---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.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(), - - // 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) ); -}; - -// 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 1 -- -int(-2082672713) - --- Iteration 1 -- -int(-873121252) - --- Iteration 1 -- -int(1860518047) - --- Iteration 1 -- -int(269248583) - --- Iteration 1 -- -int(-834950157) - --- Iteration 1 -- -int(-638440228) - --- Iteration 1 -- -int(-742287383) - --- Iteration 1 -- -int(-2036403827) - --- Iteration 1 -- - -Warning: crc32() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 1 -- - -Warning: crc32() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 1 -- - -Warning: crc32() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 1 -- - -Warning: crc32() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 1 -- - -Warning: crc32() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 1 -- -int(0) - --- Iteration 1 -- -int(0) - --- Iteration 1 -- -int(-2082672713) - --- Iteration 1 -- -int(0) - --- Iteration 1 -- -int(-2082672713) - --- Iteration 1 -- -int(0) - --- Iteration 1 -- -int(0) - --- Iteration 1 -- -int(0) - --- Iteration 1 -- -int(-1465013268) - --- Iteration 1 -- -int(0) - --- Iteration 1 -- -int(0) - --- Iteration 1 -- - -Warning: crc32() expects parameter 1 to be string, resource given in %s on line %d -NULL -Done +--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 \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strcspn_variation2.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-src/ext/standard/tests/strings/strcspn_variation2.phpt diff -u php-src/ext/standard/tests/strings/strcspn_variation2.phpt:1.1.2.1 php-src/ext/standard/tests/strings/strcspn_variation2.phpt:1.1.2.2 --- php-src/ext/standard/tests/strings/strcspn_variation2.phpt:1.1.2.1 Sat Sep 22 10:36:15 2007 +++ php-src/ext/standard/tests/strings/strcspn_variation2.phpt Fri Nov 9 07:09:52 2007 @@ -1,274 +1,272 @@ ---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 -*/ - -/* -* Testing strcspn() : with different unexpected values for mask argument -*/ - -echo "*** Testing strcspn() : with diferent 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.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(), - - // 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 diferent unexpected values of mask argument *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - --- 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 "105000000000" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "1.06E-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 +--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 diferent 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 diferent 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 \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/chunk_split_variation1.phpt?r1=1.1.2.3&r2=1.1.2.4&diff_format=u Index: php-src/ext/standard/tests/strings/chunk_split_variation1.phpt diff -u php-src/ext/standard/tests/strings/chunk_split_variation1.phpt:1.1.2.3 php-src/ext/standard/tests/strings/chunk_split_variation1.phpt:1.1.2.4 --- php-src/ext/standard/tests/strings/chunk_split_variation1.phpt:1.1.2.3 Tue Oct 9 10:56:45 2007 +++ php-src/ext/standard/tests/strings/chunk_split_variation1.phpt Fri Nov 9 07:09:52 2007 @@ -1,167 +1,167 @@ ---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.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 - "", - '', - - // 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 50 00 00 00 00 " --- Iteration 8 -- -string(11) "1. 06 E- 9 " --- Iteration 9 -- -string(5) "0. 5 " --- Iteration 10 -- - -Notice: Array to string conversion in %s on line %d -string(8) "Ar ra y " --- Iteration 11 -- - -Notice: Array to string conversion in %s on line %d -string(8) "Ar ra y " --- Iteration 12 -- - -Notice: Array to string conversion in %s on line %d -string(8) "Ar ra y " --- Iteration 13 -- - -Notice: Array to string conversion in %s on line %d -string(8) "Ar ra y " --- Iteration 14 -- - -Notice: Array to string conversion in %s on line %d -string(8) "Ar ra y " --- 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 -- -string(%d) "Re so ur ce i d #%d " -Done +--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 -- + +Notice: Array to string conversion in %s on line 87 +string(8) "Ar ra y " +-- Iteration 11 -- + +Notice: Array to string conversion in %s on line 87 +string(8) "Ar ra y " +-- Iteration 12 -- + +Notice: Array to string conversion in %s on line 87 +string(8) "Ar ra y " +-- Iteration 13 -- + +Notice: Array to string conversion in %s on line 87 +string(8) "Ar ra y " +-- Iteration 14 -- + +Notice: Array to string conversion in %s on line 87 +string(8) "Ar ra y " +-- 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 -- +string(%d) "Re so ur ce i d #%s " +Done \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strspn_variation2.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u Index: php-src/ext/standard/tests/strings/strspn_variation2.phpt diff -u php-src/ext/standard/tests/strings/strspn_variation2.phpt:1.1.2.2 php-src/ext/standard/tests/strings/strspn_variation2.phpt:1.1.2.3 --- php-src/ext/standard/tests/strings/strspn_variation2.phpt:1.1.2.2 Sat Sep 22 10:51:38 2007 +++ php-src/ext/standard/tests/strings/strspn_variation2.phpt Fri Nov 9 07:09:52 2007 @@ -9,6 +9,8 @@ * Alias to functions: none */ +error_reporting(E_ALL & ~E_NOTICE); + /* * Testing strspn() : with different unexpected values for mask argument */ @@ -47,8 +49,8 @@ // float data 10.5, -10.5, - 10.5e10, - 10.6E-10, + 10.1234567e10, + 10.7654321E-10, .5, // array data @@ -88,7 +90,7 @@ // loop through each element of the array for mask foreach($values as $value) { - echo "\n-- Iteration with mask value as \"$value\" -- \n"; + 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 @@ -102,56 +104,52 @@ --EXPECTF-- *** Testing strspn() : with diferent unexpected values of mask argument *** -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - --- Iteration with mask value as "0" -- +-- Iteration with mask value as "0" -- int(0) int(0) int(0) --- Iteration with mask value as "1" -- +-- Iteration with mask value as "1" -- int(0) int(0) int(0) --- Iteration with mask value as "12345" -- +-- Iteration with mask value as "12345" -- int(0) int(0) int(0) --- Iteration with mask value as "-2345" -- +-- Iteration with mask value as "-2345" -- int(0) int(0) int(0) --- Iteration with mask value as "10.5" -- +-- Iteration with mask value as "10.5" -- int(0) int(0) int(0) --- Iteration with mask value as "-10.5" -- +-- Iteration with mask value as "-10.5" -- int(0) int(0) int(0) --- Iteration with mask value as "105000000000" -- +-- Iteration with mask value as "101234567000" -- int(0) int(0) int(0) --- Iteration with mask value as "1.06E-9" -- +-- Iteration with mask value as "1.07654321E-9" -- int(0) int(0) int(0) --- Iteration with mask value as "0.5" -- +-- Iteration with mask value as "0.5" -- int(0) int(0) int(0) --- Iteration with mask value as "Array" -- +-- Iteration with mask value as "Array" -- Warning: strspn() expects parameter 2 to be string, array given in %s on line %d NULL @@ -162,7 +160,7 @@ Warning: strspn() expects parameter 2 to be string, array given in %s on line %d NULL --- Iteration with mask value as "Array" -- +-- Iteration with mask value as "Array" -- Warning: strspn() expects parameter 2 to be string, array given in %s on line %d NULL @@ -173,7 +171,7 @@ Warning: strspn() expects parameter 2 to be string, array given in %s on line %d NULL --- Iteration with mask value as "Array" -- +-- Iteration with mask value as "Array" -- Warning: strspn() expects parameter 2 to be string, array given in %s on line %d NULL @@ -184,7 +182,7 @@ Warning: strspn() expects parameter 2 to be string, array given in %s on line %d NULL --- Iteration with mask value as "Array" -- +-- Iteration with mask value as "Array" -- Warning: strspn() expects parameter 2 to be string, array given in %s on line %d NULL @@ -195,7 +193,7 @@ Warning: strspn() expects parameter 2 to be string, array given in %s on line %d NULL --- Iteration with mask value as "Array" -- +-- Iteration with mask value as "Array" -- Warning: strspn() expects parameter 2 to be string, array given in %s on line %d NULL @@ -206,62 +204,62 @@ Warning: strspn() expects parameter 2 to be string, array given in %s on line %d NULL --- Iteration with mask value as "" -- +-- Iteration with mask value as "" -- int(0) int(0) int(0) --- Iteration with mask value as "" -- +-- Iteration with mask value as "" -- int(0) int(0) int(0) --- Iteration with mask value as "1" -- +-- Iteration with mask value as "1" -- int(0) int(0) int(0) --- Iteration with mask value as "" -- +-- Iteration with mask value as "" -- int(0) int(0) int(0) --- Iteration with mask value as "1" -- +-- Iteration with mask value as "1" -- int(0) int(0) int(0) --- Iteration with mask value as "" -- +-- Iteration with mask value as "" -- int(0) int(0) int(0) --- Iteration with mask value as "" -- +-- Iteration with mask value as "" -- int(0) int(0) int(0) --- Iteration with mask value as "" -- +-- Iteration with mask value as "" -- int(0) int(0) int(0) --- Iteration with mask value as "object" -- +-- Iteration with mask value as "object" -- int(0) int(1) int(1) --- Iteration with mask value as "" -- +-- Iteration with mask value as "" -- int(0) int(0) int(0) --- Iteration with mask value as "" -- +-- Iteration with mask value as "" -- int(0) int(0) int(0) --- Iteration with mask value as "Resource id #%d" -- +-- Iteration with mask value as "Resource id #%d" -- Warning: strspn() expects parameter 2 to be string, resource given in %s on line %d NULL @@ -271,4 +269,4 @@ Warning: strspn() expects parameter 2 to be string, resource given in %s on line %d NULL -Done +Done \ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strcspn_variation1.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-src/ext/standard/tests/strings/strcspn_variation1.phpt diff -u php-src/ext/standard/tests/strings/strcspn_variation1.phpt:1.1.2.1 php-src/ext/standard/tests/strings/strcspn_variation1.phpt:1.1.2.2 --- php-src/ext/standard/tests/strings/strcspn_variation1.phpt:1.1.2.1 Sat Sep 22 10:36:15 2007 +++ php-src/ext/standard/tests/strings/strcspn_variation1.phpt Fri Nov 9 07:09:52 2007 @@ -1,276 +1,273 @@ ---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 -*/ - - -/* -* 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.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, - - // 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 *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - --- 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 "105000000000" -int(0) -int(0) -int(0) - --- Iteration with str value as "1.06E-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 +--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 \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strcspn_variation4.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-src/ext/standard/tests/strings/strcspn_variation4.phpt diff -u php-src/ext/standard/tests/strings/strcspn_variation4.phpt:1.1.2.1 php-src/ext/standard/tests/strings/strcspn_variation4.phpt:1.1.2.2 --- php-src/ext/standard/tests/strings/strcspn_variation4.phpt:1.1.2.1 Sat Sep 22 10:36:15 2007 +++ php-src/ext/standard/tests/strings/strcspn_variation4.phpt Fri Nov 9 07:09:52 2007 @@ -1,198 +1,196 @@ ---TEST-- -Test strcspn() function : usage variations - unexpected values of len 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 -*/ - -/* -* 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.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 - "", - '', - - // 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 *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - --- Iteration with len value as "10.5" -- -int(0) - --- Iteration with len value as "-10.5" -- -int(0) - --- Iteration with len value as "105000000000" -- -int(0) - --- Iteration with len value as "1.06E-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 long, array given in %s on line %d -NULL - --- Iteration with len value as "Array" -- - -Warning: strcspn() expects parameter 4 to be long, array given in %s on line %d -NULL - --- Iteration with len value as "Array" -- - -Warning: strcspn() expects parameter 4 to be long, array given in %s on line %d -NULL - --- Iteration with len value as "Array" -- - -Warning: strcspn() expects parameter 4 to be long, array given in %s on line %d -NULL - --- Iteration with len value as "Array" -- - -Warning: strcspn() expects parameter 4 to be long, 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 long, string given in %s on line %d -NULL - --- Iteration with len value as "" -- - -Warning: strcspn() expects parameter 4 to be long, string given in %s on line %d -NULL - --- Iteration with len value as "string" -- - -Warning: strcspn() expects parameter 4 to be long, string given in %s on line %d -NULL - --- Iteration with len value as "string" -- - -Warning: strcspn() expects parameter 4 to be long, string given in %s on line %d -NULL - --- Iteration with len value as "object" -- - -Warning: strcspn() expects parameter 4 to be long, 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 long, resource given in %s on line %d -NULL -Done +--TEST-- +Test strcspn() function : usage variations - unexpected values of len 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 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 long, array given in %s on line %d +NULL + +-- Iteration with len value as "Array" -- + +Warning: strcspn() expects parameter 4 to be long, array given in %s on line %d +NULL + +-- Iteration with len value as "Array" -- + +Warning: strcspn() expects parameter 4 to be long, array given in %s on line %d +NULL + +-- Iteration with len value as "Array" -- + +Warning: strcspn() expects parameter 4 to be long, array given in %s on line %d +NULL + +-- Iteration with len value as "Array" -- + +Warning: strcspn() expects parameter 4 to be long, 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 long, string given in %s on line %d +NULL + +-- Iteration with len value as "" -- + +Warning: strcspn() expects parameter 4 to be long, string given in %s on line %d +NULL + +-- Iteration with len value as "string" -- + +Warning: strcspn() expects parameter 4 to be long, string given in %s on line %d +NULL + +-- Iteration with len value as "string" -- + +Warning: strcspn() expects parameter 4 to be long, string given in %s on line %d +NULL + +-- Iteration with len value as "object" -- + +Warning: strcspn() expects parameter 4 to be long, 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 long, resource given in %s on line %d +NULL +Done \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strtok_variation1.phpt?r1=1.1.2.3&r2=1.1.2.4&diff_format=u Index: php-src/ext/standard/tests/strings/strtok_variation1.phpt diff -u php-src/ext/standard/tests/strings/strtok_variation1.phpt:1.1.2.3 php-src/ext/standard/tests/strings/strtok_variation1.phpt:1.1.2.4 --- php-src/ext/standard/tests/strings/strtok_variation1.phpt:1.1.2.3 Tue Oct 9 12:12:19 2007 +++ php-src/ext/standard/tests/strings/strtok_variation1.phpt Fri Nov 9 07:09:52 2007 @@ -1,172 +1,172 @@ ---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.5e10, - 10.6E-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 vlaues - 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 arugment 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) "105000000000" --- Iteration 8 -- -string(5) "1.06E" --- Iteration 9 -- -string(3) "0.5" --- Iteration 10 -- - -Notice: Array to string conversion in %s on line %d -string(5) "Array" --- Iteration 11 -- - -Notice: Array to string conversion in %s on line %d -string(5) "Array" --- Iteration 12 -- - -Notice: Array to string conversion in %s on line %d -string(5) "Array" --- Iteration 13 -- - -Notice: Array to string conversion in %s on line %d -string(5) "Array" --- Iteration 14 -- - -Notice: Array to string conversion in %s on line %d -string(5) "Array" --- 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 -- -string(%d) "Resource id #%d" -Done +--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 vlaues + 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 arugment 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 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 11 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 12 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 13 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 14 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- 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 -- +string(%d) "Resource id #%d" +Done \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/chunk_split_variation2.phpt?r1=1.1.2.3&r2=1.1.2.4&diff_format=u Index: php-src/ext/standard/tests/strings/chunk_split_variation2.phpt diff -u php-src/ext/standard/tests/strings/chunk_split_variation2.phpt:1.1.2.3 php-src/ext/standard/tests/strings/chunk_split_variation2.phpt:1.1.2.4 --- php-src/ext/standard/tests/strings/chunk_split_variation2.phpt:1.1.2.3 Thu Oct 4 13:31:11 2007 +++ php-src/ext/standard/tests/strings/chunk_split_variation2.phpt Fri Nov 9 07:09:52 2007 @@ -1,172 +1,174 @@ ---TEST-- -Test chunk_split() function : usage variations - unexpected values for 'chunklen' argument(Bug#42796) ---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, - 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 - "", - '', - - // 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) ); -} - -echo "Done"; - -//closing resource -fclose($fp); - -?> ---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 %s on line %d -bool(false) --- Iteration 3 -- -string(26) "This is chuklen variation*" --- Iteration 4 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d -bool(false) --- Iteration 7 -- -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 8 -- -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 9 -- -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 10 -- -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 11 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d -bool(false) --- Iteration 12 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s 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 %s 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 %s on line %d -bool(false) --- Iteration 17 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d -bool(false) --- Iteration 18 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d -bool(false) --- Iteration 19 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d -bool(false) --- Iteration 20 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d -bool(false) --- Iteration 21 -- - -Notice: Object of class MyClass could not be converted to int in %s on line %d -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 22 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d -bool(false) --- Iteration 23 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d -bool(false) --- Iteration 24 -- -string(30) "This *is ch*uklen* vari*ation*" -Done +--TEST-- +Test chunk_split() function : usage variations - unexpected values for 'chunklen' argument(Bug#42796) +--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, + 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 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) ); +} + +echo "Done"; + +//closing resource +fclose($fp); + +?> +--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 %s on line %d +bool(false) +-- Iteration 3 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 4 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 5 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 6 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 7 -- +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 8 -- +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 9 -- +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 10 -- +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 11 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 12 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s 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 %s 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 %s on line %d +bool(false) +-- Iteration 17 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 18 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 19 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 20 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 21 -- + +Notice: Object of class MyClass could not be converted to int in %s on line %d +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 22 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 23 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 24 -- +string(%d) "%s" +Done \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strspn_variation1.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u Index: php-src/ext/standard/tests/strings/strspn_variation1.phpt diff -u php-src/ext/standard/tests/strings/strspn_variation1.phpt:1.1.2.2 php-src/ext/standard/tests/strings/strspn_variation1.phpt:1.1.2.3 --- php-src/ext/standard/tests/strings/strspn_variation1.phpt:1.1.2.2 Sat Sep 22 10:51:38 2007 +++ php-src/ext/standard/tests/strings/strspn_variation1.phpt Fri Nov 9 07:09:52 2007 @@ -1,275 +1,273 @@ ---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 -*/ - -/* -* 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.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, - - // 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 *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - --- 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 "105000000000" -int(12) -int(11) -int(10) - --- Iteration with str value as "1.06E-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 +--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 \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strspn_variation4.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u Index: php-src/ext/standard/tests/strings/strspn_variation4.phpt diff -u php-src/ext/standard/tests/strings/strspn_variation4.phpt:1.1.2.2 php-src/ext/standard/tests/strings/strspn_variation4.phpt:1.1.2.3 --- php-src/ext/standard/tests/strings/strspn_variation4.phpt:1.1.2.2 Sat Sep 22 10:51:38 2007 +++ php-src/ext/standard/tests/strings/strspn_variation4.phpt Fri Nov 9 07:09:52 2007 @@ -9,6 +9,8 @@ * Alias to functions: none */ +error_reporting(E_ALL & ~E_NOTICE); + /* * Testing strspn() : with unexpected values of len argument */ @@ -41,8 +43,8 @@ // float data 10.5, -10.5, - 10.5e10, - 10.6E-10, + 10.1234567e10, + 10.7654321E-10, .5, // array data @@ -98,20 +100,16 @@ --EXPECTF-- *** Testing strspn() : with unexpected values of len argument *** -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - -- Iteration with len value as "10.5" -- int(2) -- Iteration with len value as "-10.5" -- int(0) --- Iteration with len value as "105000000000" -- -int(2) +-- Iteration with len value as "101234567000" -- +int(0) --- Iteration with len value as "1.06E-9" -- +-- Iteration with len value as "1.07654321E-9" -- int(0) -- Iteration with len value as "0.5" -- @@ -195,4 +193,4 @@ Warning: strspn() expects parameter 4 to be long, resource given in %s on line %d NULL -Done +Done \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strcspn_variation3.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-src/ext/standard/tests/strings/strcspn_variation3.phpt diff -u php-src/ext/standard/tests/strings/strcspn_variation3.phpt:1.1.2.1 php-src/ext/standard/tests/strings/strcspn_variation3.phpt:1.1.2.2 --- php-src/ext/standard/tests/strings/strcspn_variation3.phpt:1.1.2.1 Sat Sep 22 10:36:15 2007 +++ php-src/ext/standard/tests/strings/strcspn_variation3.phpt Fri Nov 9 07:09:52 2007 @@ -1,245 +1,243 @@ ---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 -*/ - -/* -* 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.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 - "", - '', - - // 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 *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - --- 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 "105000000000" -- -bool(false) -bool(false) - --- Iteration with start value as "1.06E-9" -- -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 long, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d -NULL - --- Iteration with start value as "Array" -- - -Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d -NULL - --- Iteration with start value as "Array" -- - -Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d -NULL - --- Iteration with start value as "Array" -- - -Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d -NULL - --- Iteration with start value as "Array" -- - -Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be long, 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 long, string given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d -NULL - --- Iteration with start value as "" -- - -Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d -NULL - --- Iteration with start value as "string" -- - -Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d -NULL - --- Iteration with start value as "string" -- - -Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d -NULL - --- Iteration with start value as "object" -- - -Warning: strcspn() expects parameter 3 to be long, object given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be long, 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 long, resource given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be long, resource given in %s on line %d -NULL -Done +--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.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 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 "101234567000" -- +int(0) +int(0) + +-- Iteration with start value as "1.07654321E-9" -- +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 long, array given in %s on line 89 +NULL + +Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +-- Iteration with start value as "Array" -- + +Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +-- Iteration with start value as "Array" -- + +Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +-- Iteration with start value as "Array" -- + +Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +-- Iteration with start value as "Array" -- + +Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +Warning: strcspn() expects parameter 3 to be long, 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 long, string given in %s on line %d +NULL + +Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +-- Iteration with start value as "" -- + +Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +-- Iteration with start value as "string" -- + +Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +-- Iteration with start value as "string" -- + +Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +-- Iteration with start value as "object" -- + +Warning: strcspn() expects parameter 3 to be long, object given in %s on line %d +NULL + +Warning: strcspn() expects parameter 3 to be long, 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 long, resource given in %s on line %d +NULL + +Warning: strcspn() expects parameter 3 to be long, resource given in %s on line %d +NULL +Done \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/ucwords_variation1.phpt?r1=1.1.2.4&r2=1.1.2.5&diff_format=u Index: php-src/ext/standard/tests/strings/ucwords_variation1.phpt diff -u php-src/ext/standard/tests/strings/ucwords_variation1.phpt:1.1.2.4 php-src/ext/standard/tests/strings/ucwords_variation1.phpt:1.1.2.5 --- php-src/ext/standard/tests/strings/ucwords_variation1.phpt:1.1.2.4 Tue Oct 9 10:56:45 2007 +++ php-src/ext/standard/tests/strings/ucwords_variation1.phpt Fri Nov 9 07:09:52 2007 @@ -49,8 +49,8 @@ // float values 10.5, -10.5, - 10.5e10, - 10.6E-10, + 10.1234567e10, + 10.7654321E-10, .5, // array values @@ -139,9 +139,9 @@ -- Iteration 12 -- string(5) "-10.5" -- Iteration 13 -- -string(12) "105000000000" +string(12) "101234567000" -- Iteration 14 -- -string(7) "1.06E-9" +string(13) "1.07654321E-9" -- Iteration 15 -- string(3) "0.5" -- Iteration 16 -- @@ -162,7 +162,7 @@ string(5) "Array" -- Iteration 20 -- -Notice: Array to string conversion in %s on line %d +Notice: Array to string conversion in %s on line 101 string(5) "Array" -- Iteration 21 -- string(1) "1" @@ -196,4 +196,4 @@ string(0) "" -- Iteration 36 -- string(%d) "Resource Id #%d" -Done +Done \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/chunk_split_variation3.phpt?r1=1.1.2.3&r2=1.1.2.4&diff_format=u Index: php-src/ext/standard/tests/strings/chunk_split_variation3.phpt diff -u php-src/ext/standard/tests/strings/chunk_split_variation3.phpt:1.1.2.3 php-src/ext/standard/tests/strings/chunk_split_variation3.phpt:1.1.2.4 --- php-src/ext/standard/tests/strings/chunk_split_variation3.phpt:1.1.2.3 Tue Oct 9 10:56:45 2007 +++ php-src/ext/standard/tests/strings/chunk_split_variation3.phpt Fri Nov 9 07:09:52 2007 @@ -1,158 +1,158 @@ ---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.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 '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) "This105000000000 is 105000000000simp105000000000le s105000000000trin105000000000g.105000000000" --- Iteration 8 -- -string(64) "This1.06E-9 is 1.06E-9simp1.06E-9le s1.06E-9trin1.06E-9g.1.06E-9" --- Iteration 9 -- -string(40) "This0.5 is 0.5simp0.5le s0.5trin0.5g.0.5" --- Iteration 10 -- - -Notice: Array to string conversion in %s on line %d -string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array" --- Iteration 11 -- - -Notice: Array to string conversion in %s on line %d -string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array" --- Iteration 12 -- - -Notice: Array to string conversion in %s on line %d -string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array" --- Iteration 13 -- - -Notice: Array to string conversion in %s on line %d -string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array" --- Iteration 14 -- - -Notice: Array to string conversion in %s on line %d -string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array" --- 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 -- -string(%d) "ThisResource id #%d is Resource id #%dsimpResource id #%dle sResource id #%dtrinResource id #%dg.Resource id #%d" -Done +--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 -- + +Notice: Array to string conversion in %s on line %d +string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array" +-- Iteration 11 -- + +Notice: Array to string conversion in %s on line %d +string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array" +-- Iteration 12 -- + +Notice: Array to string conversion in %s on line %d +string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array" +-- Iteration 13 -- + +Notice: Array to string conversion in %s on line %d +string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array" +-- Iteration 14 -- + +Notice: Array to string conversion in %s on line %d +string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array" +-- 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 -- +string(%d) "ThisResource id #%d is Resource id #%dsimpResource id #%dle sResource id #%dtrinResource id #%dg.Resource id #%d" +Done \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strspn_variation3.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u Index: php-src/ext/standard/tests/strings/strspn_variation3.phpt diff -u php-src/ext/standard/tests/strings/strspn_variation3.phpt:1.1.2.2 php-src/ext/standard/tests/strings/strspn_variation3.phpt:1.1.2.3 --- php-src/ext/standard/tests/strings/strspn_variation3.phpt:1.1.2.2 Sat Sep 22 10:51:38 2007 +++ php-src/ext/standard/tests/strings/strspn_variation3.phpt Fri Nov 9 07:09:52 2007 @@ -9,6 +9,8 @@ * Alias to functions: none */ +error_reporting(E_ALL & ~E_NOTICE); + /* * Testing strspn() : with unexpected values of start argument */ @@ -41,8 +43,8 @@ // float data 10.5, -10.5, - 10.5e10, - 10.6E-10, + 10.1234567e10, + 10.7654321E-10, .5, // array data @@ -99,10 +101,6 @@ --EXPECTF-- *** Testing strspn() : with unexpected values of start argument *** -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - -- Iteration with start value as "10.5" -- int(0) int(0) @@ -111,11 +109,11 @@ int(2) int(2) --- Iteration with start value as "105000000000" -- -bool(false) -bool(false) +-- Iteration with start value as "101234567000" -- +int(2) +int(2) --- Iteration with start value as "1.06E-9" -- +-- Iteration with start value as "1.07654321E-9" -- int(2) int(2) @@ -242,4 +240,4 @@ Warning: strspn() expects parameter 3 to be long, resource given in %s on line %d NULL -Done +Done \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/crc32_variation1.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-src/ext/standard/tests/strings/crc32_variation1.phpt diff -u php-src/ext/standard/tests/strings/crc32_variation1.phpt:1.1.2.1 php-src/ext/standard/tests/strings/crc32_variation1.phpt:1.1.2.2 --- php-src/ext/standard/tests/strings/crc32_variation1.phpt:1.1.2.1 Wed Sep 26 06:03:55 2007 +++ php-src/ext/standard/tests/strings/crc32_variation1.phpt Fri Nov 9 07:09:52 2007 @@ -1,196 +1,197 @@ ---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.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(), - - // 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) ); -}; - -// 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 1 -- -int(-2082672713) - --- Iteration 1 -- -int(-873121252) - --- Iteration 1 -- -int(1860518047) - --- Iteration 1 -- -int(269248583) - --- Iteration 1 -- -int(-834950157) - --- Iteration 1 -- -int(-638440228) - --- Iteration 1 -- -int(-742287383) - --- Iteration 1 -- -int(-2036403827) - --- Iteration 1 -- - -Warning: crc32() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 1 -- - -Warning: crc32() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 1 -- - -Warning: crc32() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 1 -- - -Warning: crc32() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 1 -- - -Warning: crc32() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 1 -- -int(0) - --- Iteration 1 -- -int(0) - --- Iteration 1 -- -int(-2082672713) - --- Iteration 1 -- -int(0) - --- Iteration 1 -- -int(-2082672713) - --- Iteration 1 -- -int(0) - --- Iteration 1 -- -int(0) - --- Iteration 1 -- -int(0) - --- Iteration 1 -- -int(-1465013268) - --- Iteration 1 -- -int(0) - --- Iteration 1 -- -int(0) - --- Iteration 1 -- - -Warning: crc32() expects parameter 1 to be string, resource given in %s on line %d -NULL -Done +--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 \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strcspn_variation2.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-src/ext/standard/tests/strings/strcspn_variation2.phpt diff -u php-src/ext/standard/tests/strings/strcspn_variation2.phpt:1.1.2.1 php-src/ext/standard/tests/strings/strcspn_variation2.phpt:1.1.2.2 --- php-src/ext/standard/tests/strings/strcspn_variation2.phpt:1.1.2.1 Sat Sep 22 10:36:15 2007 +++ php-src/ext/standard/tests/strings/strcspn_variation2.phpt Fri Nov 9 07:09:52 2007 @@ -1,274 +1,272 @@ ---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 -*/ - -/* -* Testing strcspn() : with different unexpected values for mask argument -*/ - -echo "*** Testing strcspn() : with diferent 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.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(), - - // 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 diferent unexpected values of mask argument *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - --- 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 "105000000000" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "1.06E-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 +--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 diferent 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 diferent 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 \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/chunk_split_variation1.phpt?r1=1.1.2.3&r2=1.1.2.4&diff_format=u Index: php-src/ext/standard/tests/strings/chunk_split_variation1.phpt diff -u php-src/ext/standard/tests/strings/chunk_split_variation1.phpt:1.1.2.3 php-src/ext/standard/tests/strings/chunk_split_variation1.phpt:1.1.2.4 --- php-src/ext/standard/tests/strings/chunk_split_variation1.phpt:1.1.2.3 Tue Oct 9 10:56:45 2007 +++ php-src/ext/standard/tests/strings/chunk_split_variation1.phpt Fri Nov 9 07:09:52 2007 @@ -1,167 +1,167 @@ ---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.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 - "", - '', - - // 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 50 00 00 00 00 " --- Iteration 8 -- -string(11) "1. 06 E- 9 " --- Iteration 9 -- -string(5) "0. 5 " --- Iteration 10 -- - -Notice: Array to string conversion in %s on line %d -string(8) "Ar ra y " --- Iteration 11 -- - -Notice: Array to string conversion in %s on line %d -string(8) "Ar ra y " --- Iteration 12 -- - -Notice: Array to string conversion in %s on line %d -string(8) "Ar ra y " --- Iteration 13 -- - -Notice: Array to string conversion in %s on line %d -string(8) "Ar ra y " --- Iteration 14 -- - -Notice: Array to string conversion in %s on line %d -string(8) "Ar ra y " --- 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 -- -string(%d) "Re so ur ce i d #%d " -Done +--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 -- + +Notice: Array to string conversion in %s on line 87 +string(8) "Ar ra y " +-- Iteration 11 -- + +Notice: Array to string conversion in %s on line 87 +string(8) "Ar ra y " +-- Iteration 12 -- + +Notice: Array to string conversion in %s on line 87 +string(8) "Ar ra y " +-- Iteration 13 -- + +Notice: Array to string conversion in %s on line 87 +string(8) "Ar ra y " +-- Iteration 14 -- + +Notice: Array to string conversion in %s on line 87 +string(8) "Ar ra y " +-- 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 -- +string(%d) "Re so ur ce i d #%s " +Done \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strspn_variation2.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u Index: php-src/ext/standard/tests/strings/strspn_variation2.phpt diff -u php-src/ext/standard/tests/strings/strspn_variation2.phpt:1.1.2.2 php-src/ext/standard/tests/strings/strspn_variation2.phpt:1.1.2.3 --- php-src/ext/standard/tests/strings/strspn_variation2.phpt:1.1.2.2 Sat Sep 22 10:51:38 2007 +++ php-src/ext/standard/tests/strings/strspn_variation2.phpt Fri Nov 9 07:09:52 2007 @@ -9,6 +9,8 @@ * Alias to functions: none */ +error_reporting(E_ALL & ~E_NOTICE); + /* * Testing strspn() : with different unexpected values for mask argument */ @@ -47,8 +49,8 @@ // float data 10.5, -10.5, - 10.5e10, - 10.6E-10, + 10.1234567e10, + 10.7654321E-10, .5, // array data @@ -88,7 +90,7 @@ // loop through each element of the array for mask foreach($values as $value) { - echo "\n-- Iteration with mask value as \"$value\" -- \n"; + 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 @@ -102,56 +104,52 @@ --EXPECTF-- *** Testing strspn() : with diferent unexpected values of mask argument *** -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - --- Iteration with mask value as "0" -- +-- Iteration with mask value as "0" -- int(0) int(0) int(0) --- Iteration with mask value as "1" -- +-- Iteration with mask value as "1" -- int(0) int(0) int(0) --- Iteration with mask value as "12345" -- +-- Iteration with mask value as "12345" -- int(0) int(0) int(0) --- Iteration with mask value as "-2345" -- +-- Iteration with mask value as "-2345" -- int(0) int(0) int(0) --- Iteration with mask value as "10.5" -- +-- Iteration with mask value as "10.5" -- int(0) int(0) int(0) --- Iteration with mask value as "-10.5" -- +-- Iteration with mask value as "-10.5" -- int(0) int(0) int(0) --- Iteration with mask value as "105000000000" -- +-- Iteration with mask value as "101234567000" -- int(0) int(0) int(0) --- Iteration with mask value as "1.06E-9" -- +-- Iteration with mask value as "1.07654321E-9" -- int(0) int(0) int(0) --- Iteration with mask value as "0.5" -- +-- Iteration with mask value as "0.5" -- int(0) int(0) int(0) --- Iteration with mask value as "Array" -- +-- Iteration with mask value as "Array" -- Warning: strspn() expects parameter 2 to be string, array given in %s on line %d NULL @@ -162,7 +160,7 @@ Warning: strspn() expects parameter 2 to be string, array given in %s on line %d NULL --- Iteration with mask value as "Array" -- +-- Iteration with mask value as "Array" -- Warning: strspn() expects parameter 2 to be string, array given in %s on line %d NULL @@ -173,7 +171,7 @@ Warning: strspn() expects parameter 2 to be string, array given in %s on line %d NULL --- Iteration with mask value as "Array" -- +-- Iteration with mask value as "Array" -- Warning: strspn() expects parameter 2 to be string, array given in %s on line %d NULL @@ -184,7 +182,7 @@ Warning: strspn() expects parameter 2 to be string, array given in %s on line %d NULL --- Iteration with mask value as "Array" -- +-- Iteration with mask value as "Array" -- Warning: strspn() expects parameter 2 to be string, array given in %s on line %d NULL @@ -195,7 +193,7 @@ Warning: strspn() expects parameter 2 to be string, array given in %s on line %d NULL --- Iteration with mask value as "Array" -- +-- Iteration with mask value as "Array" -- Warning: strspn() expects parameter 2 to be string, array given in %s on line %d NULL @@ -206,62 +204,62 @@ Warning: strspn() expects parameter 2 to be string, array given in %s on line %d NULL --- Iteration with mask value as "" -- +-- Iteration with mask value as "" -- int(0) int(0) int(0) --- Iteration with mask value as "" -- +-- Iteration with mask value as "" -- int(0) int(0) int(0) --- Iteration with mask value as "1" -- +-- Iteration with mask value as "1" -- int(0) int(0) int(0) --- Iteration with mask value as "" -- +-- Iteration with mask value as "" -- int(0) int(0) int(0) --- Iteration with mask value as "1" -- +-- Iteration with mask value as "1" -- int(0) int(0) int(0) --- Iteration with mask value as "" -- +-- Iteration with mask value as "" -- int(0) int(0) int(0) --- Iteration with mask value as "" -- +-- Iteration with mask value as "" -- int(0) int(0) int(0) --- Iteration with mask value as "" -- +-- Iteration with mask value as "" -- int(0) int(0) int(0) --- Iteration with mask value as "object" -- +-- Iteration with mask value as "object" -- int(0) int(1) int(1) --- Iteration with mask value as "" -- +-- Iteration with mask value as "" -- int(0) int(0) int(0) --- Iteration with mask value as "" -- +-- Iteration with mask value as "" -- int(0) int(0) int(0) --- Iteration with mask value as "Resource id #%d" -- +-- Iteration with mask value as "Resource id #%d" -- Warning: strspn() expects parameter 2 to be string, resource given in %s on line %d NULL @@ -271,4 +269,4 @@ Warning: strspn() expects parameter 2 to be string, resource given in %s on line %d NULL -Done +Done \ No newline at end of file