mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
Removing from file dir as it was wrongly committed to this dir
This commit is contained in:
parent
b59c171e23
commit
ec3a713fbb
Binary file not shown.
@ -1,44 +0,0 @@
|
||||
--TEST--
|
||||
Test chop() function : error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string chop ( string $str [, string $charlist] )
|
||||
* Description: Strip whitespace (or other characters) from the end of a string
|
||||
* Source code: ext/standard/string.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Testing chop() : error conditions
|
||||
*/
|
||||
|
||||
echo "*** Testing chop() : error conditions ***\n";
|
||||
|
||||
// Zero argument
|
||||
echo "\n-- Testing chop() function with Zero arguments --\n";
|
||||
var_dump( chop() );
|
||||
|
||||
// More than expected number of arguments
|
||||
echo "\n-- Testing chop() function with more than expected no. of arguments --\n";
|
||||
$str = 'string_val ';
|
||||
$charlist = 'string_val';
|
||||
$extra_arg = 10;
|
||||
|
||||
var_dump( chop($str, $charlist, $extra_arg) );
|
||||
var_dump( $str );
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing chop() : error conditions ***
|
||||
|
||||
-- Testing chop() function with Zero arguments --
|
||||
|
||||
Warning: Wrong parameter count for chop() in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing chop() function with more than expected no. of arguments --
|
||||
|
||||
Warning: Wrong parameter count for chop() in %s on line %d
|
||||
NULL
|
||||
string(11) "string_val "
|
||||
Done
|
@ -1,210 +0,0 @@
|
||||
--TEST--
|
||||
Test chop() function : usage variations - unexpected values for str argument
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string chop ( string $str [, string $charlist] )
|
||||
* Description: Strip whitespace (or other characters) from the end of a string
|
||||
* Source code: ext/standard/string.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Testing chop() : with different unexpected values for $str argument passed to the function
|
||||
*/
|
||||
|
||||
echo "*** Testing chop() : with unexpected values for str argument ***\n";
|
||||
// initialize all required variables
|
||||
|
||||
$charlist = " @#$%1234567890";
|
||||
// get an unset variable
|
||||
$unset_var = 'string_val';
|
||||
unset($unset_var);
|
||||
|
||||
// declaring class
|
||||
class sample {
|
||||
public function __toString() {
|
||||
return " @#$%Object @#$%";
|
||||
}
|
||||
}
|
||||
$sample_obj = new sample;
|
||||
|
||||
// creating a file resource
|
||||
$file_handle = fopen(__FILE__, 'r');
|
||||
|
||||
// array with different values
|
||||
$values = array (
|
||||
|
||||
// integer values
|
||||
0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float values
|
||||
10.5,
|
||||
-10.5,
|
||||
10.5e10,
|
||||
10.6E-10,
|
||||
.5,
|
||||
|
||||
// array values
|
||||
array(),
|
||||
array(0),
|
||||
array(1),
|
||||
array(1, 2),
|
||||
array('color' => 'red', 'item' => 'pen'),
|
||||
|
||||
// boolean values
|
||||
true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty string
|
||||
"",
|
||||
'',
|
||||
|
||||
// null vlaues
|
||||
NULL,
|
||||
null,
|
||||
|
||||
// undefined variable
|
||||
$undefined_var,
|
||||
|
||||
// unset variable
|
||||
$unset_var,
|
||||
|
||||
// object
|
||||
$sample_obj,
|
||||
|
||||
// resource
|
||||
$file_handle
|
||||
);
|
||||
|
||||
|
||||
// loop through each element of the array and check the working of chop()
|
||||
// when $str arugment is supplied with different values
|
||||
|
||||
echo "\n--- Testing chop() by supplying different values for 'str' argument ---\n";
|
||||
$counter = 1;
|
||||
for($index = 0; $index < count($values); $index ++) {
|
||||
echo "-- Iteration $counter --\n";
|
||||
$str = $values [$index];
|
||||
|
||||
var_dump( chop($str) );
|
||||
var_dump( chop($str, $charlist) );
|
||||
|
||||
$counter ++;
|
||||
}
|
||||
|
||||
// closing the resource
|
||||
fclose( $file_handle);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing chop() : with unexpected values for str argument ***
|
||||
|
||||
Notice: Undefined variable: undefined_var in %s on line %d
|
||||
|
||||
Notice: Undefined variable: unset_var in %s on line %d
|
||||
|
||||
--- Testing chop() by supplying different values for 'str' argument ---
|
||||
-- Iteration 1 --
|
||||
string(1) "0"
|
||||
string(0) ""
|
||||
-- Iteration 2 --
|
||||
string(1) "1"
|
||||
string(0) ""
|
||||
-- Iteration 3 --
|
||||
string(5) "12345"
|
||||
string(0) ""
|
||||
-- Iteration 4 --
|
||||
string(5) "-2345"
|
||||
string(1) "-"
|
||||
-- Iteration 5 --
|
||||
string(4) "10.5"
|
||||
string(3) "10."
|
||||
-- Iteration 6 --
|
||||
string(5) "-10.5"
|
||||
string(4) "-10."
|
||||
-- Iteration 7 --
|
||||
string(12) "105000000000"
|
||||
string(0) ""
|
||||
-- Iteration 8 --
|
||||
string(7) "1.06E-9"
|
||||
string(6) "1.06E-"
|
||||
-- Iteration 9 --
|
||||
string(3) "0.5"
|
||||
string(2) "0."
|
||||
-- Iteration 10 --
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
string(5) "Array"
|
||||
|
||||
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"
|
||||
|
||||
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"
|
||||
|
||||
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"
|
||||
|
||||
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"
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
string(5) "Array"
|
||||
-- Iteration 15 --
|
||||
string(1) "1"
|
||||
string(0) ""
|
||||
-- Iteration 16 --
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
-- Iteration 17 --
|
||||
string(1) "1"
|
||||
string(0) ""
|
||||
-- Iteration 18 --
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
-- Iteration 19 --
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
-- Iteration 20 --
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
-- Iteration 21 --
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
-- Iteration 22 --
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
-- Iteration 23 --
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
-- Iteration 24 --
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
-- Iteration 25 --
|
||||
string(16) " @#$%Object @#$%"
|
||||
string(11) " @#$%Object"
|
||||
-- Iteration 26 --
|
||||
string(14) "Resource id #%d"
|
||||
string(11) "Resource id"
|
||||
Done
|
@ -1,173 +0,0 @@
|
||||
--TEST--
|
||||
Test chop() function : usage variations - unexpected values for charlist argument
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string chop ( string $str [, string $charlist] )
|
||||
* Description: Strip whitespace (or other characters) from the end of a string
|
||||
* Source code: ext/standard/string.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Testing chop() : with different unexpected values for charlist argument passes to the function
|
||||
*/
|
||||
|
||||
echo "*** Testing chop() : with different unexpected values for charlist argument ***\n";
|
||||
// initialize all required variables
|
||||
$str = 'hello world12345 ';
|
||||
|
||||
// get an unset variable
|
||||
$unset_var = 'string_val';
|
||||
unset($unset_var);
|
||||
|
||||
// declaring class
|
||||
class sample {
|
||||
public function __toString() {
|
||||
return "@# $%12345";
|
||||
}
|
||||
}
|
||||
|
||||
// defining a resource
|
||||
$file_handle = fopen(__FILE__, 'r');
|
||||
|
||||
// array with different values
|
||||
$values = array (
|
||||
|
||||
// integer values
|
||||
0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float values
|
||||
10.5,
|
||||
-10.5,
|
||||
10.5e10,
|
||||
10.6E-10,
|
||||
.5,
|
||||
|
||||
// array values
|
||||
array(),
|
||||
array(0),
|
||||
array(1),
|
||||
array(1, 2),
|
||||
array('color' => 'red', 'item' => 'pen'),
|
||||
|
||||
// boolean values
|
||||
true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// objects
|
||||
new sample(),
|
||||
|
||||
// empty string
|
||||
"",
|
||||
'',
|
||||
|
||||
// null vlaues
|
||||
NULL,
|
||||
null,
|
||||
|
||||
// resource
|
||||
$file_handle,
|
||||
|
||||
// undefined variable
|
||||
$undefined_var,
|
||||
|
||||
// unset variable
|
||||
$unset_var
|
||||
|
||||
);
|
||||
|
||||
|
||||
// loop through each element of the array and check the working of chop()
|
||||
// when $charlist arugment is supplied with different values
|
||||
|
||||
echo "\n--- Testing chop() by supplying different values for 'charlist' argument ---\n";
|
||||
$counter = 1;
|
||||
for($index = 0; $index < count($values); $index ++) {
|
||||
echo "-- Iteration $counter --\n";
|
||||
$charlist = $values [$index];
|
||||
|
||||
var_dump( chop($str, $charlist) );
|
||||
|
||||
$counter ++;
|
||||
}
|
||||
|
||||
// closing the resource
|
||||
fclose($file_handle);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing chop() : with different unexpected values for charlist argument ***
|
||||
|
||||
Notice: Undefined variable: undefined_var in %s on line %d
|
||||
|
||||
Notice: Undefined variable: unset_var in %s on line %d
|
||||
|
||||
--- Testing chop() by supplying different values for 'charlist' argument ---
|
||||
-- Iteration 1 --
|
||||
string(17) "hello world12345 "
|
||||
-- Iteration 2 --
|
||||
string(17) "hello world12345 "
|
||||
-- Iteration 3 --
|
||||
string(17) "hello world12345 "
|
||||
-- Iteration 4 --
|
||||
string(17) "hello world12345 "
|
||||
-- Iteration 5 --
|
||||
string(17) "hello world12345 "
|
||||
-- Iteration 6 --
|
||||
string(17) "hello world12345 "
|
||||
-- Iteration 7 --
|
||||
string(17) "hello world12345 "
|
||||
-- Iteration 8 --
|
||||
string(17) "hello world12345 "
|
||||
-- Iteration 9 --
|
||||
string(17) "hello world12345 "
|
||||
-- Iteration 10 --
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
string(17) "hello world12345 "
|
||||
-- Iteration 11 --
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
string(17) "hello world12345 "
|
||||
-- Iteration 12 --
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
string(17) "hello world12345 "
|
||||
-- Iteration 13 --
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
string(17) "hello world12345 "
|
||||
-- Iteration 14 --
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
string(17) "hello world12345 "
|
||||
-- Iteration 15 --
|
||||
string(17) "hello world12345 "
|
||||
-- Iteration 16 --
|
||||
string(17) "hello world12345 "
|
||||
-- Iteration 17 --
|
||||
string(17) "hello world12345 "
|
||||
-- Iteration 18 --
|
||||
string(17) "hello world12345 "
|
||||
-- Iteration 19 --
|
||||
string(11) "hello world"
|
||||
-- Iteration 20 --
|
||||
string(17) "hello world12345 "
|
||||
-- Iteration 21 --
|
||||
string(17) "hello world12345 "
|
||||
-- Iteration 22 --
|
||||
string(17) "hello world12345 "
|
||||
-- Iteration 23 --
|
||||
string(17) "hello world12345 "
|
||||
-- Iteration 24 --
|
||||
string(15) "hello world1234"
|
||||
-- Iteration 25 --
|
||||
string(17) "hello world12345 "
|
||||
-- Iteration 26 --
|
||||
string(17) "hello world12345 "
|
||||
Done
|
Binary file not shown.
Binary file not shown.
@ -1,39 +0,0 @@
|
||||
--TEST--
|
||||
Test chop() function : usage variations - miscellaneous arguments
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string chop ( string $str [, string $charlist] )
|
||||
* Description: Strip whitespace (or other characters) from the end of a string
|
||||
* Source code: ext/standard/string.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Testing chop() : with miscellaneous arguments
|
||||
*/
|
||||
|
||||
echo "*** Testing chop() : with miscellaneous arguments ***\n";
|
||||
|
||||
var_dump ( chop("chop test \t\0 ") ); /* without second Argument */
|
||||
var_dump ( chop("chop test " , "") ); /* no characters in second Argument */
|
||||
var_dump ( chop("chop test ", NULL) ); /* with NULL as second Argument */
|
||||
var_dump ( chop("chop test ", true) ); /* with boolean value as second Argument */
|
||||
var_dump ( chop("chop test ", " ") ); /* with single space as second Argument */
|
||||
var_dump ( chop("chop test \t\n\r\0\x0B", "\t\n\r\0\x0B") ); /* with multiple escape sequences as second Argument */
|
||||
var_dump ( chop("chop testABCXYZ", "A..Z") ); /* with characters range as second Argument */
|
||||
var_dump ( chop("chop test0123456789", "0..9") ); /* with numbers range as second Argument */
|
||||
var_dump ( chop("chop test$#@", "#@$") ); /* with some special characters as second Argument */
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing chop() : with miscellaneous arguments ***
|
||||
string(9) "chop test"
|
||||
string(12) "chop test "
|
||||
string(17) "chop test "
|
||||
string(17) "chop test "
|
||||
string(9) "chop test"
|
||||
string(10) "chop test "
|
||||
string(9) "chop test"
|
||||
string(9) "chop test"
|
||||
string(9) "chop test"
|
||||
Done
|
@ -1,46 +0,0 @@
|
||||
--TEST--
|
||||
Test strncasecmp() function : basic functionality
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
|
||||
* Description: Binary safe case-insensitive string comparison of the first n characters
|
||||
* Source code: Zend/zend_builtin_functions.c
|
||||
*/
|
||||
|
||||
echo "*** Testing strncasecmp() function: basic functionality ***\n";
|
||||
|
||||
echo "-- Testing strncasecmp() with single quoted string --\n";
|
||||
var_dump( strncasecmp('Hello', 'Hello', 5) ); //expected: int(0)
|
||||
var_dump( strncasecmp('Hello', 'Hi', 5) ); //expected: value < 0
|
||||
var_dump( strncasecmp('Hi', 'Hello', 5) ); //expected: value > 0
|
||||
|
||||
echo "-- Testing strncasecmp() with double quoted string --\n";
|
||||
var_dump( strncasecmp("Hello", "Hello", 5) ); //expected: int(0)
|
||||
var_dump( strncasecmp("Hello", "Hi", 5) ); //expected: value < 0
|
||||
var_dump( strncasecmp("Hi", "Hello", 5) ); //expected: value > 0
|
||||
|
||||
echo "-- Testing strncasecmp() with here-doc string --\n";
|
||||
$str = <<<HEREDOC
|
||||
Hello
|
||||
HEREDOC;
|
||||
var_dump( strncasecmp($str, "Hello", 5) ); //expected: int(0)
|
||||
var_dump( strncasecmp($str, "Hi", 5) ); //expected: value < 0
|
||||
var_dump( strncasecmp("Hi", $str, 5) ); //expected: value > 0
|
||||
|
||||
echo "*** Done ***";
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
\*\*\* Testing strncasecmp\(\) function: basic functionality \*\*\*
|
||||
-- Testing strncasecmp\(\) with single quoted string --
|
||||
int\(0\)
|
||||
int\(-[1-9][0-9]*\)
|
||||
int\([1-9][0-9]*\)
|
||||
-- Testing strncasecmp\(\) with double quoted string --
|
||||
int\(0\)
|
||||
int\(-[1-9][0-9]*\)
|
||||
int\([1-9][0-9]*\)
|
||||
-- Testing strncasecmp\(\) with here-doc string --
|
||||
int\(0\)
|
||||
int\(-[1-9][0-9]*\)
|
||||
int\([1-9][0-9]*\)
|
||||
\*\*\* Done \*\*\*
|
@ -1,52 +0,0 @@
|
||||
--TEST--
|
||||
Test strncasecmp() function : error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
|
||||
* Description: Binary safe case-insensitive string comparison of the first n characters
|
||||
* Source code: Zend/zend_builtin_functions.c
|
||||
*/
|
||||
|
||||
echo "*** Testing strncasecmp() function: error conditions ***\n";
|
||||
$str1 = 'string_val';
|
||||
$str2 = 'string_val';
|
||||
$len = 10;
|
||||
$extra_arg = 10;
|
||||
|
||||
echo "\n-- Testing strncasecmp() function with Zero arguments --";
|
||||
var_dump( strncasecmp() );
|
||||
|
||||
echo "\n-- Testing strncasecmp() function with less than expected number of arguments --";
|
||||
var_dump( strncasecmp($str1) );
|
||||
var_dump( strncasecmp($str1, $str2) );
|
||||
|
||||
echo "\n-- Testing strncasecmp() function with more than expected number of arguments --";
|
||||
var_dump( strncasecmp($str1, $str2, $len, $extra_arg) );
|
||||
|
||||
echo "\n-- Testing strncasecmp() function with invalid argument --";
|
||||
$len = -10;
|
||||
var_dump( strncasecmp($str1, $str2, $len) );
|
||||
echo "*** Done ***\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing strncasecmp() function: error conditions ***
|
||||
|
||||
-- Testing strncasecmp() function with Zero arguments --
|
||||
Warning: Wrong parameter count for strncasecmp() in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing strncasecmp() function with less than expected number of arguments --
|
||||
Warning: Wrong parameter count for strncasecmp() in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: Wrong parameter count for strncasecmp() in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing strncasecmp() function with more than expected number of arguments --
|
||||
Warning: Wrong parameter count for strncasecmp() in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing strncasecmp() function with invalid argument --
|
||||
Warning: Length must be greater than or equal to 0 in %s on line %d
|
||||
bool(false)
|
||||
*** Done ***
|
@ -1,135 +0,0 @@
|
||||
--TEST--
|
||||
Test strncasecmp() function: usage variations - case-sensitivity
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
|
||||
* Description: Binary safe case-insensitive string comparison of the first n characters
|
||||
* Source code: Zend/zend_builtin_functions.c
|
||||
*/
|
||||
|
||||
/* Test strncasecmp() function with upper-case and lower-case alphabets as inputs for 'str1' and 'str2' */
|
||||
|
||||
echo "*** Test strncasecmp() function: with alphabets ***\n";
|
||||
echo "-- Passing upper-case letters for 'str1' --\n";
|
||||
for($ASCII = 65; $ASCII <= 90; $ASCII++) {
|
||||
var_dump( strncasecmp( chr($ASCII), chr($ASCII), 1 ) ); //comparing uppercase letter with corresponding uppercase letter; exp: int(0)
|
||||
var_dump( strncasecmp( chr($ASCII), chr($ASCII + 32), 1 ) ); //comparing uppercase letter with corresponding lowercase letter; exp: int(0)
|
||||
}
|
||||
|
||||
echo "\n-- Passing lower-case letters for 'str1' --\n";
|
||||
for($ASCII = 97; $ASCII <= 122; $ASCII++) {
|
||||
var_dump( strncasecmp( chr($ASCII), chr($ASCII), 1 ) ); //comparing lowercase letter with corresponding lowercase letter; exp: int(0)
|
||||
var_dump( strncasecmp( chr($ASCII), chr($ASCII - 32), 1 ) ); //comparing lowercase letter with corresponding uppercase letter; exp: int(0)
|
||||
}
|
||||
echo "*** Done ***\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Test strncasecmp() function: with alphabets ***
|
||||
-- Passing upper-case letters for 'str1' --
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
|
||||
-- Passing lower-case letters for 'str1' --
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
*** Done ***
|
@ -1,184 +0,0 @@
|
||||
--TEST--
|
||||
Test strncasecmp() function : usage variations - unexpected values for 'str1'
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
|
||||
* Description: Binary safe case-insensitive string comparison of the first n characters
|
||||
* Source code: Zend/zend_builtin_functions.c
|
||||
*/
|
||||
|
||||
/* Test strncasecmp() function with the unexpected inputs for 'str1' */
|
||||
|
||||
echo "*** Testing strncasecmp() function: with unexpected values for 'str1' ***\n";
|
||||
/* get an unset variable */
|
||||
$unset_var = 'string_val';
|
||||
unset($unset_var);
|
||||
|
||||
/* get resource handle */
|
||||
$file_handle = fopen(__FILE__, "r");
|
||||
|
||||
/* declaring a class */
|
||||
class sample {
|
||||
public function __toString() {
|
||||
return "object";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* array with different values */
|
||||
$values = array (
|
||||
/* integer values */
|
||||
0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
/* float values */
|
||||
10.5,
|
||||
-10.5,
|
||||
10.5e10,
|
||||
10.6E-10,
|
||||
.5,
|
||||
|
||||
/* hexadecimal values */
|
||||
0x12,
|
||||
-0x12,
|
||||
|
||||
/* octal values */
|
||||
012,
|
||||
-012,
|
||||
01.2,
|
||||
|
||||
/* array values */
|
||||
array(),
|
||||
array(0),
|
||||
array(1),
|
||||
array(1, 2),
|
||||
array('color' => 'red', 'item' => 'pen'),
|
||||
|
||||
/* boolean values */
|
||||
true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
/* nulls */
|
||||
NULL,
|
||||
null,
|
||||
|
||||
/* empty string */
|
||||
"",
|
||||
'',
|
||||
|
||||
/* undefined variable */
|
||||
@$undefined_var,
|
||||
|
||||
/* unset variable */
|
||||
@$unset_var,
|
||||
|
||||
/* resource */
|
||||
$file_handle,
|
||||
|
||||
/* object */
|
||||
new sample()
|
||||
);
|
||||
|
||||
/* loop through each element of the array and check the working of strncasecmp() */
|
||||
$counter = 1;
|
||||
for($index = 0; $index < count($values); $index ++) {
|
||||
echo "-- Iteration $counter --\n";
|
||||
$str1 = $values[$index];
|
||||
$len = strlen($values[$index]) + 1;
|
||||
var_dump( strncasecmp($str1, "string", $len) );
|
||||
$counter ++;
|
||||
}
|
||||
|
||||
fclose($file_handle); //closing the file handle
|
||||
|
||||
echo "*** Done ***\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing strncasecmp() function: with unexpected values for 'str1' ***
|
||||
-- Iteration 1 --
|
||||
int(-%d)
|
||||
-- Iteration 2 --
|
||||
int(-%d)
|
||||
-- Iteration 3 --
|
||||
int(-%d)
|
||||
-- Iteration 4 --
|
||||
int(-%d)
|
||||
-- Iteration 5 --
|
||||
int(-%d)
|
||||
-- Iteration 6 --
|
||||
int(-%d)
|
||||
-- Iteration 7 --
|
||||
int(-%d)
|
||||
-- Iteration 8 --
|
||||
int(-%d)
|
||||
-- Iteration 9 --
|
||||
int(-%d)
|
||||
-- Iteration 10 --
|
||||
int(-%d)
|
||||
-- Iteration 11 --
|
||||
int(-%d)
|
||||
-- Iteration 12 --
|
||||
int(-%d)
|
||||
-- Iteration 13 --
|
||||
int(-%d)
|
||||
-- Iteration 14 --
|
||||
int(-%d)
|
||||
-- Iteration 15 --
|
||||
|
||||
Notice: Array to string conversion in %s on line 88
|
||||
|
||||
Notice: Array to string conversion in %s on line 89
|
||||
int(-%d)
|
||||
-- Iteration 16 --
|
||||
|
||||
Notice: Array to string conversion in %s on line 88
|
||||
|
||||
Notice: Array to string conversion in %s on line 89
|
||||
int(-%d)
|
||||
-- Iteration 17 --
|
||||
|
||||
Notice: Array to string conversion in %s on line 88
|
||||
|
||||
Notice: Array to string conversion in %s on line 89
|
||||
int(-%d)
|
||||
-- Iteration 18 --
|
||||
|
||||
Notice: Array to string conversion in %s on line 88
|
||||
|
||||
Notice: Array to string conversion in %s on line 89
|
||||
int(-%d)
|
||||
-- Iteration 19 --
|
||||
|
||||
Notice: Array to string conversion in %s on line 88
|
||||
|
||||
Notice: Array to string conversion in %s on line 89
|
||||
int(-%d)
|
||||
-- Iteration 20 --
|
||||
int(-%d)
|
||||
-- Iteration 21 --
|
||||
int(-%d)
|
||||
-- Iteration 22 --
|
||||
int(-%d)
|
||||
-- Iteration 23 --
|
||||
int(-%d)
|
||||
-- Iteration 24 --
|
||||
int(-%d)
|
||||
-- Iteration 25 --
|
||||
int(-%d)
|
||||
-- Iteration 26 --
|
||||
int(-%d)
|
||||
-- Iteration 27 --
|
||||
int(-%d)
|
||||
-- Iteration 28 --
|
||||
int(-%d)
|
||||
-- Iteration 29 --
|
||||
int(-%d)
|
||||
-- Iteration 30 --
|
||||
int(-%d)
|
||||
-- Iteration 31 --
|
||||
int(-%d)
|
||||
*** Done ***
|
@ -1,185 +0,0 @@
|
||||
--TEST--
|
||||
Test strncasecmp() function : usage variations - unexpected values for 'str2'
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
|
||||
* Description: Binary safe case-insensitive string comparison of the first n characters
|
||||
* Source code: Zend/zend_builtin_functions.c
|
||||
*/
|
||||
|
||||
/* Test strncasecmp() function with the unexpected inputs for 'str2' */
|
||||
|
||||
echo "*** Testing strncasecmp() function: with unexpected values for 'str2' ***\n";
|
||||
/* get an unset variable */
|
||||
$unset_var = 'string_val';
|
||||
unset($unset_var);
|
||||
|
||||
/* get resource handle */
|
||||
$file_handle = fopen(__FILE__, "r");
|
||||
|
||||
/* declaring a class */
|
||||
class sample {
|
||||
public function __toString() {
|
||||
return "object";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* array with different values */
|
||||
$values = array (
|
||||
/* integer values */
|
||||
0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
/* float values */
|
||||
10.5,
|
||||
-10.5,
|
||||
10.5e10,
|
||||
10.6E-10,
|
||||
.5,
|
||||
|
||||
/* hexadecimal values */
|
||||
0x12,
|
||||
-0x12,
|
||||
|
||||
/* octal values */
|
||||
012,
|
||||
-012,
|
||||
01.2,
|
||||
|
||||
/* array values */
|
||||
array(),
|
||||
array(0),
|
||||
array(1),
|
||||
array(1, 2),
|
||||
array('color' => 'red', 'item' => 'pen'),
|
||||
|
||||
/* boolean values */
|
||||
true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
/* nulls */
|
||||
NULL,
|
||||
null,
|
||||
|
||||
/* empty string */
|
||||
"",
|
||||
'',
|
||||
|
||||
/* undefined variable */
|
||||
@$undefined_var,
|
||||
|
||||
/* unset variable */
|
||||
@$unset_var,
|
||||
|
||||
/* resource */
|
||||
$file_handle,
|
||||
|
||||
/* object */
|
||||
new sample()
|
||||
);
|
||||
|
||||
/* loop through each element of the array and check the working of strncasecmp() */
|
||||
$counter = 1;
|
||||
for($index = 0; $index < count($values); $index ++) {
|
||||
echo "-- Iteration $counter --\n";
|
||||
$str1 = $values[$index];
|
||||
$str2 = $values[$index];
|
||||
$len = strlen($values[$index]) + 1;
|
||||
var_dump( strncasecmp("string", $str2, $len) );
|
||||
$counter ++;
|
||||
}
|
||||
|
||||
fclose($file_handle); //closing the file handle
|
||||
|
||||
echo "*** Done ***\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing strncasecmp() function: with unexpected values for 'str2' ***
|
||||
-- Iteration 1 --
|
||||
int(%d)
|
||||
-- Iteration 2 --
|
||||
int(%d)
|
||||
-- Iteration 3 --
|
||||
int(%d)
|
||||
-- Iteration 4 --
|
||||
int(%d)
|
||||
-- Iteration 5 --
|
||||
int(%d)
|
||||
-- Iteration 6 --
|
||||
int(%d)
|
||||
-- Iteration 7 --
|
||||
int(%d)
|
||||
-- Iteration 8 --
|
||||
int(%d)
|
||||
-- Iteration 9 --
|
||||
int(%d)
|
||||
-- Iteration 10 --
|
||||
int(%d)
|
||||
-- Iteration 11 --
|
||||
int(%d)
|
||||
-- Iteration 12 --
|
||||
int(%d)
|
||||
-- Iteration 13 --
|
||||
int(%d)
|
||||
-- Iteration 14 --
|
||||
int(%d)
|
||||
-- Iteration 15 --
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
int(%d)
|
||||
-- Iteration 16 --
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
int(%d)
|
||||
-- Iteration 17 --
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
int(%d)
|
||||
-- Iteration 18 --
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
int(%d)
|
||||
-- Iteration 19 --
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
int(%d)
|
||||
-- Iteration 20 --
|
||||
int(%d)
|
||||
-- Iteration 21 --
|
||||
int(%d)
|
||||
-- Iteration 22 --
|
||||
int(%d)
|
||||
-- Iteration 23 --
|
||||
int(%d)
|
||||
-- Iteration 24 --
|
||||
int(%d)
|
||||
-- Iteration 25 --
|
||||
int(%d)
|
||||
-- Iteration 26 --
|
||||
int(%d)
|
||||
-- Iteration 27 --
|
||||
int(%d)
|
||||
-- Iteration 28 --
|
||||
int(%d)
|
||||
-- Iteration 29 --
|
||||
int(%d)
|
||||
-- Iteration 30 --
|
||||
int(%d)
|
||||
-- Iteration 31 --
|
||||
int(%d)
|
||||
*** Done ***
|
@ -1,63 +0,0 @@
|
||||
--TEST--
|
||||
Test strncasecmp() function: usage variations - double quoted strings
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
|
||||
* Description: Binary safe case-insensitive string comparison of the first n characters
|
||||
* Source code: Zend/zend_builtin_functions.c
|
||||
*/
|
||||
|
||||
/* Test strncasecmp() function with various double quoted strings for 'str1', 'str2' */
|
||||
|
||||
echo "*** Test strncasecmp() function: with double quoted strings ***\n";
|
||||
$strings = array(
|
||||
"Hello, World",
|
||||
"hello, world",
|
||||
"HELLO, WORLD",
|
||||
"Hello, World\n",
|
||||
"Hello".chr(0)."World"
|
||||
);
|
||||
/* loop through to compare each string with the other string */
|
||||
$count = 1;
|
||||
for($index1 = 0; $index1 < count($strings); $index1++) {
|
||||
echo "-- Iteration $count --\n";
|
||||
for($index2 = 0; $index2 < count($strings); $index2++) {
|
||||
var_dump( strncasecmp( $strings[$index1], $strings[$index2], (strlen($strings[$index1]) + 1) ) );
|
||||
}
|
||||
$count ++;
|
||||
}
|
||||
echo "*** Done ***\n";
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
\*\*\* Test strncasecmp\(\) function: with double quoted strings \*\*\*
|
||||
-- Iteration 1 --
|
||||
int\(0\)
|
||||
int\(0\)
|
||||
int\(0\)
|
||||
int\(-[1-9][0-9]*\)
|
||||
int\([1-9][0-9]*\)
|
||||
-- Iteration 2 --
|
||||
int\(0\)
|
||||
int\(0\)
|
||||
int\(0\)
|
||||
int\(-[1-9][0-9]*\)
|
||||
int\([1-9][0-9]*\)
|
||||
-- Iteration 3 --
|
||||
int\(0\)
|
||||
int\(0\)
|
||||
int\(0\)
|
||||
int\(-[1-9][0-9]*\)
|
||||
int\([1-9][0-9]*\)
|
||||
-- Iteration 4 --
|
||||
int\([1-9][0-9]*\)
|
||||
int\([1-9][0-9]*\)
|
||||
int\([1-9][0-9]*\)
|
||||
int\(0\)
|
||||
int\([1-9][0-9]*\)
|
||||
-- Iteration 5 --
|
||||
int\(-[1-9][0-9]*\)
|
||||
int\(-[1-9][0-9]*\)
|
||||
int\(-[1-9][0-9]*\)
|
||||
int\(-[1-9][0-9]*\)
|
||||
int\(0\)
|
||||
\*\*\* Done \*\*\*
|
@ -1,39 +0,0 @@
|
||||
--TEST--
|
||||
Test strncasecmp() function: usage variations - various lengths
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
|
||||
* Description: Binary safe case-insensitive string comparison of the first n characters
|
||||
* Source code: Zend/zend_builtin_functions.c
|
||||
*/
|
||||
|
||||
/* Test strncasecmp() with various lengths */
|
||||
|
||||
echo "*** Test strncasecmp() function: with different lengths ***\n";
|
||||
/* definitions of required variables */
|
||||
$str1 = "Hello, World\n";
|
||||
$str2 = "Hello, world\n";
|
||||
|
||||
/* loop through to compare the strings, for various length values */
|
||||
for($len = strlen($str1); $len >= 0; $len--) {
|
||||
var_dump( strncasecmp($str1, $str2, $len) );
|
||||
}
|
||||
echo "*** Done ***\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Test strncasecmp() function: with different lengths ***
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
*** Done ***
|
@ -1,195 +0,0 @@
|
||||
--TEST--
|
||||
Test strncasecmp() function : usage variations - unexpected values for 'str1' & 'str2'
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
|
||||
* Description: Binary safe case-insensitive string comparison of the first n characters
|
||||
* Source code: Zend/zend_builtin_functions.c
|
||||
*/
|
||||
|
||||
/* Test strncasecmp() function with the unexpected inputs for 'str1' and 'str2' */
|
||||
|
||||
echo "*** Testing strncasecmp() function: with unexpected values for 'str1' and 'str2' ***\n";
|
||||
/* get an unset variable */
|
||||
$unset_var = 'string_val';
|
||||
unset($unset_var);
|
||||
|
||||
/* get resource handle */
|
||||
$file_handle = fopen(__FILE__, "r");
|
||||
|
||||
/* declaring a class */
|
||||
class sample {
|
||||
public function __toString() {
|
||||
return "object";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* array with different values */
|
||||
$values = array (
|
||||
/* integer values */
|
||||
0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
/* float values */
|
||||
10.5,
|
||||
-10.5,
|
||||
10.5e10,
|
||||
10.6E-10,
|
||||
.5,
|
||||
|
||||
/* hexadecimal values */
|
||||
0x12,
|
||||
-0x12,
|
||||
|
||||
/* octal values */
|
||||
012,
|
||||
-012,
|
||||
01.2,
|
||||
|
||||
/* array values */
|
||||
array(),
|
||||
array(0),
|
||||
array(1),
|
||||
array(1, 2),
|
||||
array('color' => 'red', 'item' => 'pen'),
|
||||
|
||||
/* boolean values */
|
||||
true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
/* nulls */
|
||||
NULL,
|
||||
null,
|
||||
|
||||
/* empty string */
|
||||
"",
|
||||
'',
|
||||
|
||||
/* undefined variable */
|
||||
@$undefined_var,
|
||||
|
||||
/* unset variable */
|
||||
@$unset_var,
|
||||
|
||||
/* resource */
|
||||
$file_handle,
|
||||
|
||||
/* object */
|
||||
new sample()
|
||||
);
|
||||
|
||||
/* loop through each element of the array and check the working of strncasecmp() */
|
||||
$counter = 1;
|
||||
for($index = 0; $index < count($values); $index ++) {
|
||||
echo "-- Iteration $counter --\n";
|
||||
$str1 = $values[$index];
|
||||
$str2 = $values[$index];
|
||||
$len = strlen($values[$index]) + 1;
|
||||
var_dump( strncasecmp($str1, $str2, $len) );
|
||||
$counter ++;
|
||||
}
|
||||
|
||||
fclose($file_handle); //closing the file handle
|
||||
|
||||
echo "*** Done ***\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing strncasecmp() function: with unexpected values for 'str1' and 'str2' ***
|
||||
-- Iteration 1 --
|
||||
int(0)
|
||||
-- Iteration 2 --
|
||||
int(0)
|
||||
-- Iteration 3 --
|
||||
int(0)
|
||||
-- Iteration 4 --
|
||||
int(0)
|
||||
-- Iteration 5 --
|
||||
int(0)
|
||||
-- Iteration 6 --
|
||||
int(0)
|
||||
-- Iteration 7 --
|
||||
int(0)
|
||||
-- Iteration 8 --
|
||||
int(0)
|
||||
-- Iteration 9 --
|
||||
int(0)
|
||||
-- Iteration 10 --
|
||||
int(0)
|
||||
-- Iteration 11 --
|
||||
int(0)
|
||||
-- Iteration 12 --
|
||||
int(0)
|
||||
-- Iteration 13 --
|
||||
int(0)
|
||||
-- Iteration 14 --
|
||||
int(0)
|
||||
-- Iteration 15 --
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
int(0)
|
||||
-- Iteration 16 --
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
int(0)
|
||||
-- Iteration 17 --
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
int(0)
|
||||
-- Iteration 18 --
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
int(0)
|
||||
-- Iteration 19 --
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
int(0)
|
||||
-- Iteration 20 --
|
||||
int(0)
|
||||
-- Iteration 21 --
|
||||
int(0)
|
||||
-- Iteration 22 --
|
||||
int(0)
|
||||
-- Iteration 23 --
|
||||
int(0)
|
||||
-- Iteration 24 --
|
||||
int(0)
|
||||
-- Iteration 25 --
|
||||
int(0)
|
||||
-- Iteration 26 --
|
||||
int(0)
|
||||
-- Iteration 27 --
|
||||
int(0)
|
||||
-- Iteration 28 --
|
||||
int(0)
|
||||
-- Iteration 29 --
|
||||
int(0)
|
||||
-- Iteration 30 --
|
||||
int(0)
|
||||
-- Iteration 31 --
|
||||
int(0)
|
||||
*** Done ***
|
@ -1,147 +0,0 @@
|
||||
--TEST--
|
||||
Test strncasecmp() function : usage variations - unexpected values for 'len'
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
|
||||
* Description: Binary safe case-insensitive string comparison of the first n characters
|
||||
* Source code: Zend/zend_builtin_functions.c
|
||||
*/
|
||||
|
||||
/* Test strncasecmp() function with the unexpected values, and giving the same strings for 'str1' and 'str2' */
|
||||
|
||||
echo "*** Test strncasecmp() function: unexpected values for 'len' ***\n";
|
||||
|
||||
/* definition of required variables */
|
||||
$str1 = "Hello, World\n";
|
||||
$str2 = "Hello, World\n";
|
||||
|
||||
/* get an unset variable */
|
||||
$unset_var = 'string_val';
|
||||
unset($unset_var);
|
||||
|
||||
/* get resource handle */
|
||||
$file_handle = fopen(__FILE__, "r");
|
||||
|
||||
/* declaring a class */
|
||||
class sample {
|
||||
public function __toString() {
|
||||
return "object";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* array with different values */
|
||||
$lengths = array (
|
||||
|
||||
/* float values */
|
||||
10.5,
|
||||
10.5e10,
|
||||
10.6E-10,
|
||||
.5,
|
||||
|
||||
/* hexadecimal values */
|
||||
0x12,
|
||||
|
||||
/* octal values */
|
||||
012,
|
||||
01.2,
|
||||
|
||||
/* array values */
|
||||
array(),
|
||||
array(0),
|
||||
array(1),
|
||||
array(1, 2),
|
||||
array('color' => 'red', 'item' => 'pen'),
|
||||
|
||||
/* boolean values */
|
||||
true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
/* nulls */
|
||||
NULL,
|
||||
null,
|
||||
|
||||
/* empty string */
|
||||
"",
|
||||
'',
|
||||
|
||||
/* undefined variable */
|
||||
@$undefined_var,
|
||||
|
||||
/* unset variable */
|
||||
@$unset_var,
|
||||
|
||||
/* resource */
|
||||
$file_handle,
|
||||
|
||||
/* object */
|
||||
new sample()
|
||||
);
|
||||
|
||||
/* loop through each element of the array and check the working of strncasecmp() */
|
||||
$counter = 1;
|
||||
for($index = 0; $index < count($lengths); $index ++) {
|
||||
$len = $lengths[$index];
|
||||
echo "-- Iteration $counter --\n";
|
||||
var_dump( strncasecmp($str1, $str2, $len) );
|
||||
$counter ++;
|
||||
}
|
||||
fclose($file_handle);
|
||||
|
||||
echo "*** Done ***\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Test strncasecmp() function: unexpected values for 'len' ***
|
||||
-- Iteration 1 --
|
||||
int(0)
|
||||
-- Iteration 2 --
|
||||
int(0)
|
||||
-- Iteration 3 --
|
||||
int(0)
|
||||
-- Iteration 4 --
|
||||
int(0)
|
||||
-- Iteration 5 --
|
||||
int(0)
|
||||
-- Iteration 6 --
|
||||
int(0)
|
||||
-- Iteration 7 --
|
||||
int(0)
|
||||
-- Iteration 8 --
|
||||
int(0)
|
||||
-- Iteration 9 --
|
||||
int(0)
|
||||
-- Iteration 10 --
|
||||
int(0)
|
||||
-- Iteration 11 --
|
||||
int(0)
|
||||
-- Iteration 12 --
|
||||
int(0)
|
||||
-- Iteration 13 --
|
||||
int(0)
|
||||
-- Iteration 14 --
|
||||
int(0)
|
||||
-- Iteration 15 --
|
||||
int(0)
|
||||
-- Iteration 16 --
|
||||
int(0)
|
||||
-- Iteration 17 --
|
||||
int(0)
|
||||
-- Iteration 18 --
|
||||
int(0)
|
||||
-- Iteration 19 --
|
||||
int(0)
|
||||
-- Iteration 20 --
|
||||
int(0)
|
||||
-- Iteration 21 --
|
||||
int(0)
|
||||
-- Iteration 22 --
|
||||
int(0)
|
||||
-- Iteration 23 --
|
||||
int(0)
|
||||
-- Iteration 24 --
|
||||
|
||||
Notice: Object of class sample could not be converted to int in %s on line %d
|
||||
int(0)
|
||||
*** Done ***
|
@ -1,810 +0,0 @@
|
||||
--TEST--
|
||||
Test strncasecmp() function : usage variations - binary safe - all ASCII chars
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
|
||||
* Description: Binary safe case-insensitive string comparison of the first n characters
|
||||
* Source code: Zend/zend_builtin_functions.c
|
||||
*/
|
||||
|
||||
/* Test strncasecmp() function with binary values passed to 'str1' & 'str2' */
|
||||
|
||||
echo "*** Test strncasecmp() function: with binary inputs ***\n";
|
||||
|
||||
/* A binary function should work with all 256 characters that a character(8-bit) can take */
|
||||
echo "\n-- Checking with all 256 characters given, in binary format --\n";
|
||||
/* loop through to get all 256 character's equivelent binary value, and check working of strncasecmp() */
|
||||
$count = 1;
|
||||
for($ASCII = 0; $ASCII <= 255; $ASCII++) {
|
||||
$str1 = decbin($ASCII); //ASCII value in binary form
|
||||
$str2 = decbin( ord( chr($ASCII) ) ); //Getting equivelent ASCII value for the character in binary form
|
||||
echo "-- Iteration $count --\n";
|
||||
var_dump( strncasecmp($str1, $str2, 8) ); //comparing all the 8-bits; expected: int(0)
|
||||
var_dump( strncasecmp($str1, $str2, 4) ); //comparing only 4-bits; expected: int(0)
|
||||
$count++;
|
||||
}
|
||||
|
||||
echo "\n-- Checking with out of character's range, given in binary format --\n";
|
||||
$str1 = decbin(256);
|
||||
$str2 = decbin( ord( chr(256) ));
|
||||
var_dump( strncasecmp($str1, $str2, 8) ); //comparing all the 8-bits; expected: int(1)
|
||||
|
||||
echo "\n*** Done ***\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Test strncasecmp() function: with binary inputs ***
|
||||
|
||||
-- Checking with all 256 characters given, in binary format --
|
||||
-- Iteration 1 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 2 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 3 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 4 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 5 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 6 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 7 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 8 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 9 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 10 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 11 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 12 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 13 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 14 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 15 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 16 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 17 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 18 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 19 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 20 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 21 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 22 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 23 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 24 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 25 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 26 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 27 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 28 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 29 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 30 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 31 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 32 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 33 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 34 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 35 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 36 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 37 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 38 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 39 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 40 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 41 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 42 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 43 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 44 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 45 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 46 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 47 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 48 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 49 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 50 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 51 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 52 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 53 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 54 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 55 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 56 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 57 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 58 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 59 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 60 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 61 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 62 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 63 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 64 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 65 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 66 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 67 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 68 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 69 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 70 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 71 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 72 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 73 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 74 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 75 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 76 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 77 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 78 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 79 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 80 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 81 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 82 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 83 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 84 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 85 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 86 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 87 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 88 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 89 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 90 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 91 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 92 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 93 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 94 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 95 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 96 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 97 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 98 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 99 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 100 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 101 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 102 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 103 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 104 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 105 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 106 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 107 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 108 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 109 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 110 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 111 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 112 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 113 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 114 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 115 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 116 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 117 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 118 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 119 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 120 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 121 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 122 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 123 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 124 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 125 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 126 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 127 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 128 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 129 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 130 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 131 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 132 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 133 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 134 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 135 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 136 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 137 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 138 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 139 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 140 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 141 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 142 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 143 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 144 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 145 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 146 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 147 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 148 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 149 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 150 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 151 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 152 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 153 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 154 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 155 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 156 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 157 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 158 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 159 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 160 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 161 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 162 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 163 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 164 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 165 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 166 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 167 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 168 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 169 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 170 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 171 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 172 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 173 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 174 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 175 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 176 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 177 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 178 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 179 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 180 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 181 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 182 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 183 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 184 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 185 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 186 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 187 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 188 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 189 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 190 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 191 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 192 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 193 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 194 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 195 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 196 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 197 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 198 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 199 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 200 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 201 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 202 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 203 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 204 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 205 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 206 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 207 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 208 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 209 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 210 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 211 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 212 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 213 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 214 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 215 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 216 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 217 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 218 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 219 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 220 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 221 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 222 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 223 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 224 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 225 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 226 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 227 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 228 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 229 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 230 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 231 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 232 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 233 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 234 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 235 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 236 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 237 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 238 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 239 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 240 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 241 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 242 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 243 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 244 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 245 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 246 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 247 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 248 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 249 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 250 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 251 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 252 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 253 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 254 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 255 --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Iteration 256 --
|
||||
int(0)
|
||||
int(0)
|
||||
|
||||
-- Checking with out of character's range, given in binary format --
|
||||
int(1)
|
||||
|
||||
*** Done ***
|
@ -1,27 +0,0 @@
|
||||
--TEST--
|
||||
Test strncasecmp() function : usage variations - binary safe
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
|
||||
* Description: Binary safe case-insensitive string comparison of the first n characters
|
||||
* Source code: Zend/zend_builtin_functions.c
|
||||
*/
|
||||
|
||||
/* Test strncasecmp() function with null terminated strings and binary values passed to 'str1' & 'str2' */
|
||||
|
||||
echo "*** Test strncasecmp() function: with null terminated strings and binary inputs ***\n";
|
||||
|
||||
/* A binary function should not expect a null terminated string, and it should treat input as a raw stream of data */
|
||||
$str1 = "Hello\0world";
|
||||
$str2 = "Hello\0";
|
||||
$str3 = "Hello,".chr(0)."world";
|
||||
var_dump( strncasecmp($str1, $str2, 12) );
|
||||
var_dump( strncasecmp($str3, "Hello,world", 12) );
|
||||
|
||||
echo "*** Done ***\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Test strncasecmp() function: with null terminated strings and binary inputs ***
|
||||
int(5)
|
||||
int(-119)
|
||||
*** Done ***
|
@ -1,52 +0,0 @@
|
||||
--TEST--
|
||||
Test strncasecmp() function: usage variations - single quoted strings
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
|
||||
* Description: Binary safe case-insensitive string comparison of the first n characters
|
||||
* Source code: Zend/zend_builtin_functions.c
|
||||
*/
|
||||
|
||||
/* Test strncasecmp() function with various single quoted strings for 'str1', 'str2' */
|
||||
|
||||
echo "*** Test strncasecmp() function: with single quoted strings ***\n";
|
||||
$strings = array(
|
||||
'Hello, World',
|
||||
'hello, world',
|
||||
'HELLO, WORLD',
|
||||
'Hello, World\n'
|
||||
);
|
||||
/* loop through to compare each string with the other string */
|
||||
$count = 1;
|
||||
for($index1 = 0; $index1 < count($strings); $index1++) {
|
||||
echo "-- Iteration $count --\n";
|
||||
for($index2 = 0; $index2 < count($strings); $index2++) {
|
||||
var_dump( strncasecmp( $strings[$index1], $strings[$index2], (strlen($strings[$index1]) + 1) ) );
|
||||
}
|
||||
$count ++;
|
||||
}
|
||||
echo "*** Done ***\n";
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
\*\*\* Test strncasecmp\(\) function: with single quoted strings \*\*\*
|
||||
-- Iteration 1 --
|
||||
int\(0\)
|
||||
int\(0\)
|
||||
int\(0\)
|
||||
int\(-[1-9][0-9]*\)
|
||||
-- Iteration 2 --
|
||||
int\(0\)
|
||||
int\(0\)
|
||||
int\(0\)
|
||||
int\(-[1-9][0-9]*\)
|
||||
-- Iteration 3 --
|
||||
int\(0\)
|
||||
int\(0\)
|
||||
int\(0\)
|
||||
int\(-[1-9][0-9]*\)
|
||||
-- Iteration 4 --
|
||||
int\([1-9][0-9]*\)
|
||||
int\([1-9][0-9]*\)
|
||||
int\([1-9][0-9]*\)
|
||||
int\(0\)
|
||||
\*\*\* Done \*\*\*
|
@ -1,92 +0,0 @@
|
||||
--TEST--
|
||||
Test strncasecmp() function: usage variations - heredoc strings
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
|
||||
* Description: Binary safe case-insensitive string comparison of the first n characters
|
||||
* Source code: Zend/zend_builtin_functions.c
|
||||
*/
|
||||
|
||||
/* Test strncasecmp() function with here-doc strings for 'str1', 'str2' */
|
||||
|
||||
echo "*** Test strncasecmp() function: with here-doc strings ***\n";
|
||||
|
||||
/* multi line heredoc string */
|
||||
$multi_line_str = <<<EOD
|
||||
Example of string
|
||||
spanning multiple lines
|
||||
using heredoc syntax.
|
||||
EOD;
|
||||
|
||||
/* identifier name contains underscore */
|
||||
$identifier_str1 = <<<identifier_str1
|
||||
Example of heredoc
|
||||
string, whose identifier
|
||||
having underscore("_")
|
||||
& numeric value.
|
||||
identifier_str1;
|
||||
|
||||
/* identifier name starts with underscore */
|
||||
$identifier_str2 = <<<_identifier_str2
|
||||
Hello, World
|
||||
hello, world
|
||||
_identifier_str2;
|
||||
|
||||
/* string containing control character */
|
||||
$control_char_str = <<<EOD
|
||||
Hello, World\n
|
||||
Hello\0World
|
||||
EOD;
|
||||
|
||||
/* heredoc string with quote chars & slash */
|
||||
$quote_char_string = <<<EOD
|
||||
it's bright,but i cann't see it.
|
||||
"things in double quote"
|
||||
'things in single quote'
|
||||
this\line is /with\slashs
|
||||
EOD;
|
||||
|
||||
/* heredoc string with blank line */
|
||||
$blank_line = <<<EOD
|
||||
|
||||
EOD;
|
||||
|
||||
/* empty heredoc string */
|
||||
$empty_string = <<<EOD
|
||||
EOD;
|
||||
|
||||
$strings = array(
|
||||
$multi_line_str,
|
||||
$identifier_str1,
|
||||
$identifier_str2,
|
||||
$control_char_str,
|
||||
$quote_char_string,
|
||||
$blank_line,
|
||||
$empty_string
|
||||
);
|
||||
/* loop through to compare the strings */
|
||||
$index2 = count($strings);
|
||||
for($index1 = 0; $index1 < count($strings); $index1++) {
|
||||
$index2--;
|
||||
var_dump( strncasecmp( $strings[$index1], $strings[$index1], strlen($strings[$index1]) ) );
|
||||
var_dump( strncasecmp( $strings[$index1], $strings[$index2], strlen($strings[$index1]) ) );
|
||||
}
|
||||
echo "*** Done ***\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Test strncasecmp() function: with here-doc strings ***
|
||||
int(0)
|
||||
int(63)
|
||||
int(0)
|
||||
int(84)
|
||||
int(0)
|
||||
int(-1)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(1)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
*** Done ***
|
@ -1,47 +0,0 @@
|
||||
--TEST--
|
||||
Test wordwrap() function : basic functionality
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] )
|
||||
* Description: Wraps buffer to selected number of characters using string break char
|
||||
* Source code: ext/standard/string.c
|
||||
*/
|
||||
|
||||
echo "*** Testing wordwrap() : basic functionality ***\n";
|
||||
|
||||
// Initialize all required variables
|
||||
$str = "The quick brown foooooooooox jummmmmmmmmmmmped over the lazzzzzzzzzzzy doooooooooooooooooooooog.";
|
||||
$width = 80;
|
||||
$break = '<br />\n';
|
||||
|
||||
// Calling wordwrap() with default arguments
|
||||
var_dump( wordwrap($str) );
|
||||
|
||||
// Calling wordwrap() with all possible optional arguments
|
||||
// with $width arg
|
||||
var_dump( wordwrap($str, $width) );
|
||||
// with $break arg
|
||||
var_dump( wordwrap($str, $width, $break) );
|
||||
|
||||
// Calling wordwrap() with all arguments
|
||||
// $cut as true
|
||||
$width = 10;
|
||||
$cut = true;
|
||||
var_dump( wordwrap($str, $width, $break, $cut) );
|
||||
|
||||
// $cut as false
|
||||
$width = 10;
|
||||
$cut = false;
|
||||
var_dump( wordwrap($str, $width, $break, $cut) );
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing wordwrap() : basic functionality ***
|
||||
string(96) "The quick brown foooooooooox jummmmmmmmmmmmped over the lazzzzzzzzzzzy
|
||||
doooooooooooooooooooooog."
|
||||
string(96) "The quick brown foooooooooox jummmmmmmmmmmmped over the lazzzzzzzzzzzy
|
||||
doooooooooooooooooooooog."
|
||||
string(103) "The quick brown foooooooooox jummmmmmmmmmmmped over the lazzzzzzzzzzzy<br />\ndoooooooooooooooooooooog."
|
||||
string(178) "The quick<br />\nbrown<br />\nfooooooooo<br />\nox<br />\njummmmmmmm<br />\nmmmmped<br />\nover the<br />\nlazzzzzzzz<br />\nzzzy<br />\ndooooooooo<br />\noooooooooo<br />\nooog."
|
||||
string(138) "The quick<br />\nbrown<br />\nfoooooooooox<br />\njummmmmmmmmmmmped<br />\nover the<br />\nlazzzzzzzzzzzy<br />\ndoooooooooooooooooooooog."
|
||||
Done
|
@ -1,78 +0,0 @@
|
||||
--TEST--
|
||||
Test wordwrap() function : error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] )
|
||||
* Description: Wraps buffer to selected number of characters using string break char
|
||||
* Source code: ext/standard/string.c
|
||||
*/
|
||||
|
||||
echo "*** Testing wordwrap() : error conditions ***\n";
|
||||
|
||||
// Zero argument
|
||||
echo "\n-- Testing wordwrap() function with Zero arguments --\n";
|
||||
var_dump( wordwrap() );
|
||||
|
||||
// More than expected number of arguments
|
||||
echo "\n-- Testing wordwrap() function with more than expected no. of arguments --\n";
|
||||
$str = 'testing wordwrap function';
|
||||
$width = 10;
|
||||
$break = '<br />\n';
|
||||
$cut = true;
|
||||
$extra_arg = "extra_arg";
|
||||
|
||||
var_dump( wordwrap($str, $width, $break, $cut, $extra_arg) );
|
||||
|
||||
// $width arg as negative value
|
||||
echo "\n-- Testing wordwrap() function with negative/zero value for width argument --\n";
|
||||
echo "-- width = 0 & cut = false --\n";
|
||||
// width as zero and cut as false
|
||||
$width = 0;
|
||||
$cut = false;
|
||||
var_dump( wordwrap($str, $width, $break, $cut) );
|
||||
|
||||
echo "-- width = 0 & cut = true --\n";
|
||||
// width as zero and cut as true
|
||||
$width = 0;
|
||||
$cut = true;
|
||||
var_dump( wordwrap($str, $width, $break, $cut) );
|
||||
|
||||
echo "-- width = -10 & cut = false --\n";
|
||||
// width as -ne and cut as false
|
||||
$width = -10;
|
||||
$cut = false;
|
||||
var_dump( wordwrap($str, $width, $break, $cut) );
|
||||
|
||||
echo "-- width = -10 & cut = true --\n";
|
||||
// width as -ne and cut as true
|
||||
$width = -10;
|
||||
$cut = true;
|
||||
var_dump( wordwrap($str, $width, $break, $cut) );
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing wordwrap() : error conditions ***
|
||||
|
||||
-- Testing wordwrap() function with Zero arguments --
|
||||
|
||||
Warning: wordwrap() expects at least 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing wordwrap() function with more than expected no. of arguments --
|
||||
|
||||
Warning: wordwrap() expects at most 4 parameters, 5 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing wordwrap() function with negative/zero value for width argument --
|
||||
-- width = 0 & cut = false --
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
-- width = 0 & cut = true --
|
||||
|
||||
Warning: wordwrap(): Can't force cut when width is zero in %s on line %d
|
||||
bool(false)
|
||||
-- width = -10 & cut = false --
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
-- width = -10 & cut = true --
|
||||
string(223) "<br />\nt<br />\ne<br />\ns<br />\nt<br />\ni<br />\nn<br />\ng<br />\n<br />\nw<br />\no<br />\nr<br />\nd<br />\nw<br />\nr<br />\na<br />\np<br />\n<br />\nf<br />\nu<br />\nn<br />\nc<br />\nt<br />\ni<br />\no<br />\nn"
|
||||
Done
|
@ -1,335 +0,0 @@
|
||||
--TEST--
|
||||
Test wordwrap() function : usage variations - unexpected values for str argument
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] )
|
||||
* Description: Wraps buffer to selected number of characters using string break char
|
||||
* Source code: ext/standard/string.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* testing wordwrap() by providing different values for str argument
|
||||
*/
|
||||
|
||||
echo "*** Testing wordwrap() : usage variations ***\n";
|
||||
// initialize all required variables
|
||||
$width = 3;
|
||||
$break = '<br />\n';
|
||||
$cut = true;
|
||||
|
||||
// resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// get an unset variable
|
||||
$unset_var = 'string_val';
|
||||
unset($unset_var);
|
||||
|
||||
// array with different values
|
||||
$values = array (
|
||||
|
||||
// integer values
|
||||
0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float values
|
||||
10.5,
|
||||
-10.5,
|
||||
10.5e10,
|
||||
10.6E-10,
|
||||
.5,
|
||||
|
||||
// array values
|
||||
array(),
|
||||
array(0),
|
||||
array(1),
|
||||
array(1, 2),
|
||||
array('color' => 'red', 'item' => 'pen'),
|
||||
|
||||
// boolean values
|
||||
true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// objects
|
||||
new stdclass(),
|
||||
|
||||
// Null
|
||||
NULL,
|
||||
null,
|
||||
|
||||
// empty string
|
||||
"",
|
||||
'',
|
||||
|
||||
// resource variable
|
||||
$fp,
|
||||
|
||||
// undefined variable
|
||||
@$undefined_var,
|
||||
|
||||
// unset variable
|
||||
@$unset_var
|
||||
);
|
||||
|
||||
// loop though each element of the array and check the working of wordwrap()
|
||||
// when $str arugment is supplied with different values
|
||||
echo "\n--- Testing wordwrap() by supplying different values for 'str' argument ---\n";
|
||||
$counter = 1;
|
||||
for($index = 0; $index < count($values); $index ++) {
|
||||
echo "-- Iteration $counter --\n";
|
||||
$str = $values [$index];
|
||||
|
||||
var_dump( wordwrap($str) );
|
||||
var_dump( wordwrap($str, $width) );
|
||||
var_dump( wordwrap($str, $width, $break) );
|
||||
|
||||
// $cut as false
|
||||
$cut = false;
|
||||
var_dump( wordwrap($str, $width, $break, $cut) );
|
||||
|
||||
// $cut as true
|
||||
$cut = true;
|
||||
var_dump( wordwrap($str, $width, $break, $cut) );
|
||||
|
||||
$counter ++;
|
||||
}
|
||||
|
||||
// close the resource
|
||||
fclose($fp);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing wordwrap() : usage variations ***
|
||||
|
||||
--- Testing wordwrap() by supplying different values for 'str' argument ---
|
||||
-- Iteration 1 --
|
||||
string(1) "0"
|
||||
string(1) "0"
|
||||
string(1) "0"
|
||||
string(1) "0"
|
||||
string(1) "0"
|
||||
-- Iteration 2 --
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
-- Iteration 3 --
|
||||
string(5) "12345"
|
||||
string(5) "12345"
|
||||
string(5) "12345"
|
||||
string(5) "12345"
|
||||
string(13) "123<br />\n45"
|
||||
-- Iteration 4 --
|
||||
string(5) "-2345"
|
||||
string(5) "-2345"
|
||||
string(5) "-2345"
|
||||
string(5) "-2345"
|
||||
string(13) "-23<br />\n45"
|
||||
-- Iteration 5 --
|
||||
string(4) "10.5"
|
||||
string(4) "10.5"
|
||||
string(4) "10.5"
|
||||
string(4) "10.5"
|
||||
string(12) "10.<br />\n5"
|
||||
-- Iteration 6 --
|
||||
string(5) "-10.5"
|
||||
string(5) "-10.5"
|
||||
string(5) "-10.5"
|
||||
string(5) "-10.5"
|
||||
string(13) "-10<br />\n.5"
|
||||
-- Iteration 7 --
|
||||
string(12) "105000000000"
|
||||
string(12) "105000000000"
|
||||
string(12) "105000000000"
|
||||
string(12) "105000000000"
|
||||
string(36) "105<br />\n000<br />\n000<br />\n000"
|
||||
-- Iteration 8 --
|
||||
string(7) "1.06E-9"
|
||||
string(7) "1.06E-9"
|
||||
string(7) "1.06E-9"
|
||||
string(7) "1.06E-9"
|
||||
string(23) "1.0<br />\n6E-<br />\n9"
|
||||
-- Iteration 9 --
|
||||
string(3) "0.5"
|
||||
string(3) "0.5"
|
||||
string(3) "0.5"
|
||||
string(3) "0.5"
|
||||
string(3) "0.5"
|
||||
-- Iteration 10 --
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 11 --
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 12 --
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 13 --
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 14 --
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 15 --
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
-- Iteration 16 --
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
-- Iteration 17 --
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
-- Iteration 18 --
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
-- Iteration 19 --
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 20 --
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
-- Iteration 21 --
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
-- Iteration 22 --
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
-- Iteration 23 --
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
-- Iteration 24 --
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 25 --
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
-- Iteration 26 --
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
Done
|
@ -1,340 +0,0 @@
|
||||
--TEST--
|
||||
Test wordwrap() function : usage variations - unexpected values for width argument
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] )
|
||||
* Description: Wraps buffer to selected number of characters using string break char
|
||||
* Source code: ext/standard/string.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* test wordwrap by passing different values for width argument
|
||||
*/
|
||||
echo "*** Testing wordwrap() : usage variations ***\n";
|
||||
// initialize all required variables
|
||||
$str = 'testing wordwrap function';
|
||||
$break = '<br />\n';
|
||||
$cut = true;
|
||||
|
||||
// resource var
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// get an unset variable
|
||||
$unset_var = 10;
|
||||
unset($unset_var);
|
||||
|
||||
|
||||
// array with different values as width
|
||||
$values = array (
|
||||
// zerovalue for width
|
||||
0,
|
||||
|
||||
// -ve value for width
|
||||
-1,
|
||||
-10,
|
||||
|
||||
// array values
|
||||
array(),
|
||||
array(0),
|
||||
array(1),
|
||||
array(1, 2),
|
||||
array('color' => 'red', 'item' => 'pen'),
|
||||
|
||||
// boolean values
|
||||
true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// string values
|
||||
"string",
|
||||
'string',
|
||||
|
||||
// objects
|
||||
new stdclass(),
|
||||
|
||||
// Null value
|
||||
NULL,
|
||||
null,
|
||||
|
||||
// empty string
|
||||
"",
|
||||
'',
|
||||
|
||||
// resource variable
|
||||
$fp,
|
||||
|
||||
// undefined variable
|
||||
@$undefined_var,
|
||||
|
||||
// unset variable
|
||||
@$unset_var
|
||||
);
|
||||
|
||||
|
||||
// loop though each element of the array and check the working of wordwrap()
|
||||
// when $width arugment is supplied with different values
|
||||
echo "\n--- Testing wordwrap() by supplying different values for 'width' argument ---\n";
|
||||
$counter = 1;
|
||||
for($index = 0; $index < count($values); $index ++) {
|
||||
echo "-- Iteration $counter --\n";
|
||||
$width = $values [$index];
|
||||
|
||||
var_dump( wordwrap($str, $width) );
|
||||
var_dump( wordwrap($str, $width, $break) );
|
||||
|
||||
// cut as false
|
||||
$cut = false;
|
||||
var_dump( wordwrap($str, $width, $break, $cut) );
|
||||
|
||||
// cut as true
|
||||
$cut = true;
|
||||
var_dump( wordwrap($str, $width, $break, $cut) );
|
||||
|
||||
$counter ++;
|
||||
}
|
||||
|
||||
// close the resource
|
||||
fclose($fp);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing wordwrap() : usage variations ***
|
||||
|
||||
--- Testing wordwrap() by supplying different values for 'width' argument ---
|
||||
-- Iteration 1 --
|
||||
string(25) "testing
|
||||
wordwrap
|
||||
function"
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
|
||||
Warning: wordwrap(): Can't force cut when width is zero in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 2 --
|
||||
string(25) "testing
|
||||
wordwrap
|
||||
function"
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
string(223) "<br />\nt<br />\ne<br />\ns<br />\nt<br />\ni<br />\nn<br />\ng<br />\n<br />\nw<br />\no<br />\nr<br />\nd<br />\nw<br />\nr<br />\na<br />\np<br />\n<br />\nf<br />\nu<br />\nn<br />\nc<br />\nt<br />\ni<br />\no<br />\nn"
|
||||
-- Iteration 3 --
|
||||
string(25) "testing
|
||||
wordwrap
|
||||
function"
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
string(223) "<br />\nt<br />\ne<br />\ns<br />\nt<br />\ni<br />\nn<br />\ng<br />\n<br />\nw<br />\no<br />\nr<br />\nd<br />\nw<br />\nr<br />\na<br />\np<br />\n<br />\nf<br />\nu<br />\nn<br />\nc<br />\nt<br />\ni<br />\no<br />\nn"
|
||||
-- Iteration 4 --
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 5 --
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 6 --
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 7 --
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 8 --
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 9 --
|
||||
string(25) "testing
|
||||
wordwrap
|
||||
function"
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
string(199) "t<br />\ne<br />\ns<br />\nt<br />\ni<br />\nn<br />\ng<br />\nw<br />\no<br />\nr<br />\nd<br />\nw<br />\nr<br />\na<br />\np<br />\nf<br />\nu<br />\nn<br />\nc<br />\nt<br />\ni<br />\no<br />\nn"
|
||||
-- Iteration 10 --
|
||||
string(25) "testing
|
||||
wordwrap
|
||||
function"
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
|
||||
Warning: wordwrap(): Can't force cut when width is zero in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 11 --
|
||||
string(25) "testing
|
||||
wordwrap
|
||||
function"
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
string(199) "t<br />\ne<br />\ns<br />\nt<br />\ni<br />\nn<br />\ng<br />\nw<br />\no<br />\nr<br />\nd<br />\nw<br />\nr<br />\na<br />\np<br />\nf<br />\nu<br />\nn<br />\nc<br />\nt<br />\ni<br />\no<br />\nn"
|
||||
-- Iteration 12 --
|
||||
string(25) "testing
|
||||
wordwrap
|
||||
function"
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
|
||||
Warning: wordwrap(): Can't force cut when width is zero in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 13 --
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 14 --
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 15 --
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, object given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, object given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, object given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, object given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 16 --
|
||||
string(25) "testing
|
||||
wordwrap
|
||||
function"
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
|
||||
Warning: wordwrap(): Can't force cut when width is zero in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 17 --
|
||||
string(25) "testing
|
||||
wordwrap
|
||||
function"
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
|
||||
Warning: wordwrap(): Can't force cut when width is zero in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 18 --
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 19 --
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 20 --
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, resource given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, resource given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, resource given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 2 to be long, resource given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 21 --
|
||||
string(25) "testing
|
||||
wordwrap
|
||||
function"
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
|
||||
Warning: wordwrap(): Can't force cut when width is zero in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 22 --
|
||||
string(25) "testing
|
||||
wordwrap
|
||||
function"
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
|
||||
Warning: wordwrap(): Can't force cut when width is zero in %s on line %d
|
||||
bool(false)
|
||||
Done
|
@ -1,302 +0,0 @@
|
||||
--TEST--
|
||||
Test wordwrap() function : usage variations - unexptected values for break argument
|
||||
--INI--
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] )
|
||||
* Description: Wraps buffer to selected number of characters using string break char
|
||||
* Source code: ext/standard/string.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* test wordwrap by passing different values for break argument
|
||||
*/
|
||||
echo "*** Testing wordwrap() : usage variations ***\n";
|
||||
// initialize all required variables
|
||||
$str = 'testing wordwrap function';
|
||||
$width = 10;
|
||||
$cut = true;
|
||||
|
||||
// resource var
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// get an unset variable
|
||||
$unset_var = 'string_val';
|
||||
unset($unset_var);
|
||||
|
||||
|
||||
// array with different values for break arg
|
||||
$values = array (
|
||||
|
||||
// integer values
|
||||
0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float values
|
||||
10.5,
|
||||
-10.5,
|
||||
10.5e10,
|
||||
10.6E-10,
|
||||
.5,
|
||||
|
||||
// array values
|
||||
array(),
|
||||
array(0),
|
||||
array(1),
|
||||
array(1, 2),
|
||||
array('color' => 'red', 'item' => 'pen'),
|
||||
|
||||
// boolean values
|
||||
true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// objects
|
||||
new stdclass(),
|
||||
|
||||
// empty string
|
||||
"",
|
||||
'',
|
||||
|
||||
//Null
|
||||
NULL,
|
||||
null,
|
||||
|
||||
// resource var
|
||||
$fp,
|
||||
|
||||
// undefined variable
|
||||
@$undefined_var,
|
||||
|
||||
// unset variable
|
||||
@$unset_var
|
||||
);
|
||||
|
||||
// loop though each element of the array and check the working of wordwrap()
|
||||
// when $break arugment is supplied with different values
|
||||
echo "\n--- Testing wordwrap() by supplying different values for 'break' argument ---\n";
|
||||
$counter = 1;
|
||||
for($index = 0; $index < count($values); $index ++) {
|
||||
echo "-- Iteration $counter --\n";
|
||||
$break = $values [$index];
|
||||
|
||||
var_dump( wordwrap($str, $width, $break) );
|
||||
|
||||
// $cut as false
|
||||
$cut = false;
|
||||
var_dump( wordwrap($str, $width, $break, $cut) );
|
||||
|
||||
// $cut as true
|
||||
$cut = true;
|
||||
var_dump( wordwrap($str, $width, $break, $cut) );
|
||||
|
||||
$counter ++;
|
||||
}
|
||||
|
||||
// close the resource used
|
||||
fclose($fp);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing wordwrap() : usage variations ***
|
||||
|
||||
--- Testing wordwrap() by supplying different values for 'break' argument ---
|
||||
-- Iteration 1 --
|
||||
string(25) "testing0wordwrap0function"
|
||||
string(25) "testing0wordwrap0function"
|
||||
string(25) "testing0wordwrap0function"
|
||||
-- Iteration 2 --
|
||||
string(25) "testing1wordwrap1function"
|
||||
string(25) "testing1wordwrap1function"
|
||||
string(25) "testing1wordwrap1function"
|
||||
-- Iteration 3 --
|
||||
string(33) "testing12345wordwrap12345function"
|
||||
string(33) "testing12345wordwrap12345function"
|
||||
string(33) "testing12345wordwrap12345function"
|
||||
-- Iteration 4 --
|
||||
string(33) "testing-2345wordwrap-2345function"
|
||||
string(33) "testing-2345wordwrap-2345function"
|
||||
string(33) "testing-2345wordwrap-2345function"
|
||||
-- Iteration 5 --
|
||||
string(31) "testing10.5wordwrap10.5function"
|
||||
string(31) "testing10.5wordwrap10.5function"
|
||||
string(31) "testing10.5wordwrap10.5function"
|
||||
-- Iteration 6 --
|
||||
string(33) "testing-10.5wordwrap-10.5function"
|
||||
string(33) "testing-10.5wordwrap-10.5function"
|
||||
string(33) "testing-10.5wordwrap-10.5function"
|
||||
-- Iteration 7 --
|
||||
string(47) "testing105000000000wordwrap105000000000function"
|
||||
string(47) "testing105000000000wordwrap105000000000function"
|
||||
string(47) "testing105000000000wordwrap105000000000function"
|
||||
-- Iteration 8 --
|
||||
string(37) "testing1.06E-9wordwrap1.06E-9function"
|
||||
string(37) "testing1.06E-9wordwrap1.06E-9function"
|
||||
string(37) "testing1.06E-9wordwrap1.06E-9function"
|
||||
-- Iteration 9 --
|
||||
string(29) "testing0.5wordwrap0.5function"
|
||||
string(29) "testing0.5wordwrap0.5function"
|
||||
string(29) "testing0.5wordwrap0.5function"
|
||||
-- Iteration 10 --
|
||||
|
||||
Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 11 --
|
||||
|
||||
Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 12 --
|
||||
|
||||
Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 13 --
|
||||
|
||||
Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 14 --
|
||||
|
||||
Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 15 --
|
||||
string(25) "testing1wordwrap1function"
|
||||
string(25) "testing1wordwrap1function"
|
||||
string(25) "testing1wordwrap1function"
|
||||
-- Iteration 16 --
|
||||
|
||||
Warning: wordwrap(): Break string cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: wordwrap(): Break string cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: wordwrap(): Break string cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 17 --
|
||||
string(25) "testing1wordwrap1function"
|
||||
string(25) "testing1wordwrap1function"
|
||||
string(25) "testing1wordwrap1function"
|
||||
-- Iteration 18 --
|
||||
|
||||
Warning: wordwrap(): Break string cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: wordwrap(): Break string cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: wordwrap(): Break string cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 19 --
|
||||
|
||||
Warning: wordwrap() expects parameter 3 to be string, object given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 3 to be string, object given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 3 to be string, object given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 20 --
|
||||
|
||||
Warning: wordwrap(): Break string cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: wordwrap(): Break string cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: wordwrap(): Break string cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 21 --
|
||||
|
||||
Warning: wordwrap(): Break string cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: wordwrap(): Break string cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: wordwrap(): Break string cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 22 --
|
||||
|
||||
Warning: wordwrap(): Break string cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: wordwrap(): Break string cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: wordwrap(): Break string cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 23 --
|
||||
|
||||
Warning: wordwrap(): Break string cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: wordwrap(): Break string cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: wordwrap(): Break string cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 24 --
|
||||
|
||||
Warning: wordwrap() expects parameter 3 to be string, resource given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 3 to be string, resource given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: wordwrap() expects parameter 3 to be string, resource given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 25 --
|
||||
|
||||
Warning: wordwrap(): Break string cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: wordwrap(): Break string cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: wordwrap(): Break string cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 26 --
|
||||
|
||||
Warning: wordwrap(): Break string cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: wordwrap(): Break string cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: wordwrap(): Break string cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
Done
|
@ -1,144 +0,0 @@
|
||||
--TEST--
|
||||
Test wordwrap() function : usage variations - unexptected value for cut argument
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] )
|
||||
* Description: Wraps buffer to selected number of characters using string break char
|
||||
* Source code: ext/standard/string.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* test wordwrap() by supplying different values for cut argument
|
||||
*/
|
||||
|
||||
echo "*** Testing wordwrap() : usage variations ***\n";
|
||||
// initialize all required variables
|
||||
$str = 'testing wordwrap function';
|
||||
$width = 10;
|
||||
$break = '<br />\n';
|
||||
|
||||
// get an unset variable
|
||||
$unset_var = true;
|
||||
unset($unset_var);
|
||||
|
||||
// resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// array with different values
|
||||
$values = array (
|
||||
|
||||
// integer values
|
||||
0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float values
|
||||
10.5,
|
||||
-10.5,
|
||||
10.5e10,
|
||||
10.6E-10,
|
||||
.5,
|
||||
|
||||
// array values
|
||||
array(),
|
||||
array(0),
|
||||
array(1),
|
||||
array(1, 2),
|
||||
array('color' => 'red', 'item' => 'pen'),
|
||||
|
||||
// string values
|
||||
"string",
|
||||
'string',
|
||||
|
||||
// objects
|
||||
new stdclass(),
|
||||
|
||||
// empty string
|
||||
"",
|
||||
'',
|
||||
|
||||
// undefined variable
|
||||
@$undefined_var,
|
||||
|
||||
// unset variable
|
||||
@$unset_var
|
||||
);
|
||||
|
||||
// loop though each element of the array and check the working of wordwrap()
|
||||
// when $cut arugment is supplied with different values
|
||||
echo "\n--- Testing wordwrap() by supplying different values for 'cut' argument ---\n";
|
||||
$counter = 1;
|
||||
for($index = 0; $index < count($values); $index ++) {
|
||||
echo "-- Iteration $counter --\n";
|
||||
$cut = $values [$index];
|
||||
|
||||
var_dump( wordwrap($str, $width, $break, $cut) );
|
||||
|
||||
$counter ++;
|
||||
}
|
||||
|
||||
// close the resource
|
||||
fclose($fp);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing wordwrap() : usage variations ***
|
||||
|
||||
--- Testing wordwrap() by supplying different values for 'cut' argument ---
|
||||
-- Iteration 1 --
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
-- Iteration 2 --
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
-- Iteration 3 --
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
-- Iteration 4 --
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
-- Iteration 5 --
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
-- Iteration 6 --
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
-- Iteration 7 --
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
-- Iteration 8 --
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
-- Iteration 9 --
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
-- Iteration 10 --
|
||||
|
||||
Warning: wordwrap() expects parameter 4 to be boolean, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 11 --
|
||||
|
||||
Warning: wordwrap() expects parameter 4 to be boolean, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 12 --
|
||||
|
||||
Warning: wordwrap() expects parameter 4 to be boolean, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 13 --
|
||||
|
||||
Warning: wordwrap() expects parameter 4 to be boolean, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 14 --
|
||||
|
||||
Warning: wordwrap() expects parameter 4 to be boolean, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 15 --
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
-- Iteration 16 --
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
-- Iteration 17 --
|
||||
|
||||
Warning: wordwrap() expects parameter 4 to be boolean, object given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 18 --
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
-- Iteration 19 --
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
-- Iteration 20 --
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
-- Iteration 21 --
|
||||
string(39) "testing<br />\nwordwrap<br />\nfunction"
|
||||
Done
|
@ -1,60 +0,0 @@
|
||||
--TEST--
|
||||
Test wordwrap() function : usage variations - valid break arguments(spaces)
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] )
|
||||
* Description: Wraps buffer to selected number of characters using string break char
|
||||
* Source code: ext/standard/string.c
|
||||
*/
|
||||
|
||||
/*
|
||||
*test wordwrap() with break arguments as single spaces
|
||||
*/
|
||||
|
||||
echo "*** Testing wordwrap() : usage variations ***\n";
|
||||
|
||||
// Initialize all required variables
|
||||
$str = "Testing wordrap function";
|
||||
$width = 1;
|
||||
$cut = false;
|
||||
|
||||
echo "\n-- Testing wordwrap() with default break value and single space as value --\n";
|
||||
echo "-- with default break and cut value --\n";
|
||||
var_dump( wordwrap($str, $width) ); // default break and cut value
|
||||
|
||||
echo "-- with default cut value --\n";
|
||||
$break = ' ';
|
||||
$break1 = " ";
|
||||
var_dump( wordwrap($str, $width, $break) );
|
||||
var_dump( wordwrap($str, $width, $break1) );
|
||||
|
||||
echo "-- with cut value as false --\n";
|
||||
$cut = false;
|
||||
var_dump( wordwrap($str, $width, $break, $cut) );
|
||||
var_dump( wordwrap($str, $width, $break1, $cut) );
|
||||
|
||||
echo "-- with cut value as true --\n";
|
||||
$cut = true;
|
||||
var_dump( wordwrap($str, $width, $break, $cut) );
|
||||
var_dump( wordwrap($str, $width, $break1, $cut) );
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing wordwrap() : usage variations ***
|
||||
|
||||
-- Testing wordwrap() with default break value and single space as value --
|
||||
-- with default break and cut value --
|
||||
string(24) "Testing
|
||||
wordrap
|
||||
function"
|
||||
-- with default cut value --
|
||||
string(24) "Testing wordrap function"
|
||||
string(26) "Testing wordrap function"
|
||||
-- with cut value as false --
|
||||
string(24) "Testing wordrap function"
|
||||
string(26) "Testing wordrap function"
|
||||
-- with cut value as true --
|
||||
string(43) "T e s t i n g w o r d r a p f u n c t i o n"
|
||||
string(64) "T e s t i n g w o r d r a p f u n c t i o n"
|
||||
Done
|
Loading…
Reference in New Issue
Block a user