mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Remove test dependency on resource/object IDs
This commit is contained in:
parent
3f3ac4de25
commit
2a859abd33
12 changed files with 79 additions and 122 deletions
|
@ -44,7 +44,7 @@ $values = [
|
|||
[],
|
||||
new StdClass,
|
||||
new StringCapable,
|
||||
fopen("data:text/plain,foobar", "r")
|
||||
STDERR,
|
||||
];
|
||||
|
||||
foreach ($functions as $type => $function) {
|
||||
|
@ -92,13 +92,13 @@ int(0)
|
|||
*** Trying array(0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type int, array returned in %s on line %d
|
||||
*** Trying object(stdClass)#6 (0) {
|
||||
*** Trying object(stdClass)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type int, stdClass returned in %s on line %d
|
||||
*** Trying object(StringCapable)#7 (0) {
|
||||
*** Trying object(StringCapable)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type int, StringCapable returned in %s on line %d
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Trying resource(%d) of type (stream)
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type int, resource returned in %s on line %d
|
||||
|
||||
Testing 'float' type:
|
||||
|
@ -129,13 +129,13 @@ float(0)
|
|||
*** Trying array(0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type float, array returned in %s on line %d
|
||||
*** Trying object(stdClass)#6 (0) {
|
||||
*** Trying object(stdClass)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type float, stdClass returned in %s on line %d
|
||||
*** Trying object(StringCapable)#7 (0) {
|
||||
*** Trying object(StringCapable)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type float, StringCapable returned in %s on line %d
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Trying resource(%d) of type (stream)
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type float, resource returned in %s on line %d
|
||||
|
||||
Testing 'string' type:
|
||||
|
@ -166,13 +166,13 @@ string(0) ""
|
|||
*** Trying array(0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type string, array returned in %s on line %d
|
||||
*** Trying object(stdClass)#6 (0) {
|
||||
*** Trying object(stdClass)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type string, stdClass returned in %s on line %d
|
||||
*** Trying object(StringCapable)#7 (0) {
|
||||
*** Trying object(StringCapable)#%d (0) {
|
||||
}
|
||||
string(6) "foobar"
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Trying resource(%d) of type (stream)
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type string, resource returned in %s on line %d
|
||||
|
||||
Testing 'bool' type:
|
||||
|
@ -203,13 +203,13 @@ bool(false)
|
|||
*** Trying array(0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type bool, array returned in %s on line %d
|
||||
*** Trying object(stdClass)#6 (0) {
|
||||
*** Trying object(stdClass)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type bool, stdClass returned in %s on line %d
|
||||
*** Trying object(StringCapable)#7 (0) {
|
||||
*** Trying object(StringCapable)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type bool, StringCapable returned in %s on line %d
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Trying resource(%d) of type (stream)
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type bool, resource returned in %s on line %d
|
||||
|
||||
Done
|
||||
|
|
|
@ -44,7 +44,7 @@ $values = [
|
|||
[],
|
||||
new StdClass,
|
||||
new StringCapable,
|
||||
fopen("data:text/plain,foobar", "r")
|
||||
STDERR,
|
||||
];
|
||||
|
||||
foreach ($functions as $type => $function) {
|
||||
|
@ -92,13 +92,13 @@ int(0)
|
|||
*** Trying array(0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type int, array returned in %s on line %d
|
||||
*** Trying object(stdClass)#6 (0) {
|
||||
*** Trying object(stdClass)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type int, stdClass returned in %s on line %d
|
||||
*** Trying object(StringCapable)#7 (0) {
|
||||
*** Trying object(StringCapable)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type int, StringCapable returned in %s on line %d
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Trying resource(%d) of type (stream)
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type int, resource returned in %s on line %d
|
||||
|
||||
Testing 'float' type:
|
||||
|
@ -129,13 +129,13 @@ float(0)
|
|||
*** Trying array(0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type float, array returned in %s on line %d
|
||||
*** Trying object(stdClass)#6 (0) {
|
||||
*** Trying object(stdClass)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type float, stdClass returned in %s on line %d
|
||||
*** Trying object(StringCapable)#7 (0) {
|
||||
*** Trying object(StringCapable)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type float, StringCapable returned in %s on line %d
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Trying resource(%d) of type (stream)
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type float, resource returned in %s on line %d
|
||||
|
||||
Testing 'string' type:
|
||||
|
@ -166,13 +166,13 @@ string(0) ""
|
|||
*** Trying array(0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type string, array returned in %s on line %d
|
||||
*** Trying object(stdClass)#6 (0) {
|
||||
*** Trying object(stdClass)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type string, stdClass returned in %s on line %d
|
||||
*** Trying object(StringCapable)#7 (0) {
|
||||
*** Trying object(StringCapable)#%d (0) {
|
||||
}
|
||||
string(6) "foobar"
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Trying resource(%d) of type (stream)
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type string, resource returned in %s on line %d
|
||||
|
||||
Testing 'bool' type:
|
||||
|
@ -203,13 +203,13 @@ bool(false)
|
|||
*** Trying array(0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type bool, array returned in %s on line %d
|
||||
*** Trying object(stdClass)#6 (0) {
|
||||
*** Trying object(stdClass)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type bool, stdClass returned in %s on line %d
|
||||
*** Trying object(StringCapable)#7 (0) {
|
||||
*** Trying object(StringCapable)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type bool, StringCapable returned in %s on line %d
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Trying resource(%d) of type (stream)
|
||||
*** Caught {closure:%s:%d}(): Return value must be of type bool, resource returned in %s on line %d
|
||||
|
||||
Done
|
||||
|
|
|
@ -96,15 +96,15 @@ int(2147483647)
|
|||
}
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d
|
||||
|
||||
*** Trying object(stdClass)#5 (0) {
|
||||
*** Trying object(stdClass)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d
|
||||
|
||||
*** Trying object(StringCapable)#6 (0) {
|
||||
*** Trying object(StringCapable)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, StringCapable given, called in %s on line %d
|
||||
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Trying resource(%d) of type (stream)
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d
|
||||
|
||||
Testing 'float' type:
|
||||
|
@ -149,15 +149,15 @@ float(NAN)
|
|||
}
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d
|
||||
|
||||
*** Trying object(stdClass)#5 (0) {
|
||||
*** Trying object(stdClass)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d
|
||||
|
||||
*** Trying object(StringCapable)#6 (0) {
|
||||
*** Trying object(StringCapable)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, StringCapable given, called in %s on line %d
|
||||
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Trying resource(%d) of type (stream)
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d
|
||||
|
||||
Testing 'string' type:
|
||||
|
@ -202,15 +202,15 @@ string(0) ""
|
|||
}
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d
|
||||
|
||||
*** Trying object(stdClass)#5 (0) {
|
||||
*** Trying object(stdClass)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d
|
||||
|
||||
*** Trying object(StringCapable)#6 (0) {
|
||||
*** Trying object(StringCapable)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, StringCapable given, called in %s on line %d
|
||||
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Trying resource(%d) of type (stream)
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d
|
||||
|
||||
Testing 'bool' type:
|
||||
|
@ -255,15 +255,15 @@ bool(false)
|
|||
}
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d
|
||||
|
||||
*** Trying object(stdClass)#5 (0) {
|
||||
*** Trying object(stdClass)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d
|
||||
|
||||
*** Trying object(StringCapable)#6 (0) {
|
||||
*** Trying object(StringCapable)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, StringCapable given, called in %s on line %d
|
||||
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Trying resource(%d) of type (stream)
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d
|
||||
|
||||
Done
|
||||
|
|
|
@ -35,7 +35,7 @@ $values = [
|
|||
[],
|
||||
new StdClass,
|
||||
new StringCapable,
|
||||
fopen("data:text/plain,foobar", "r")
|
||||
STDERR,
|
||||
];
|
||||
|
||||
foreach ($functions as $type => $function) {
|
||||
|
@ -96,15 +96,15 @@ int(9223372036854775807)
|
|||
}
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d
|
||||
|
||||
*** Trying object(stdClass)#5 (0) {
|
||||
*** Trying object(stdClass)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d
|
||||
|
||||
*** Trying object(StringCapable)#6 (0) {
|
||||
*** Trying object(StringCapable)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, StringCapable given, called in %s on line %d
|
||||
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Trying resource(%d) of type (stream)
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d
|
||||
|
||||
Testing 'float' type:
|
||||
|
@ -149,15 +149,15 @@ float(NAN)
|
|||
}
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d
|
||||
|
||||
*** Trying object(stdClass)#5 (0) {
|
||||
*** Trying object(stdClass)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d
|
||||
|
||||
*** Trying object(StringCapable)#6 (0) {
|
||||
*** Trying object(StringCapable)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, StringCapable given, called in %s on line %d
|
||||
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Trying resource(%d) of type (stream)
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d
|
||||
|
||||
Testing 'string' type:
|
||||
|
@ -202,15 +202,15 @@ string(0) ""
|
|||
}
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d
|
||||
|
||||
*** Trying object(stdClass)#5 (0) {
|
||||
*** Trying object(stdClass)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d
|
||||
|
||||
*** Trying object(StringCapable)#6 (0) {
|
||||
*** Trying object(StringCapable)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, StringCapable given, called in %s on line %d
|
||||
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Trying resource(%d) of type (stream)
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d
|
||||
|
||||
Testing 'bool' type:
|
||||
|
@ -255,15 +255,15 @@ bool(false)
|
|||
}
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d
|
||||
|
||||
*** Trying object(stdClass)#5 (0) {
|
||||
*** Trying object(stdClass)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d
|
||||
|
||||
*** Trying object(StringCapable)#6 (0) {
|
||||
*** Trying object(StringCapable)#%d (0) {
|
||||
}
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, StringCapable given, called in %s on line %d
|
||||
|
||||
*** Trying resource(5) of type (stream)
|
||||
*** Trying resource(%d) of type (stream)
|
||||
*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d
|
||||
|
||||
Done
|
||||
|
|
|
@ -96,7 +96,7 @@ object(stdClass)#%d (2) {
|
|||
}
|
||||
object(stdClass)#%d (2) {
|
||||
["a"]=>
|
||||
&resource(5) of type (stream)
|
||||
&resource(%d) of type (stream)
|
||||
["b"]=>
|
||||
array(0) {
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ object(stdClass)#%d (2) {
|
|||
}
|
||||
object(stdClass)#%d (2) {
|
||||
["a"]=>
|
||||
&resource(6) of type (stream)
|
||||
&resource(%d) of type (stream)
|
||||
["b"]=>
|
||||
array(0) {
|
||||
}
|
||||
|
|
|
@ -17,9 +17,6 @@ function callback($a)
|
|||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// get a class
|
||||
class classA{
|
||||
public function __toString(){
|
||||
|
@ -49,11 +46,11 @@ $arrays = array (
|
|||
array("hello", $heredoc => "string"), // heredoc
|
||||
|
||||
// array with object, unset variable and resource variable
|
||||
array(@$unset_var => "hello", $fp => 'resource'),
|
||||
array(@$unset_var => "hello", STDERR => 'resource'),
|
||||
|
||||
// array with mixed values
|
||||
/*11*/ array('hello' => 1, "fruit" => 2.2,
|
||||
$fp => 'resource', 133 => "int",
|
||||
STDERR => 'resource', 133 => "int",
|
||||
@$unset_var => "unset", $heredoc => "heredoc")
|
||||
);
|
||||
|
||||
|
@ -70,9 +67,9 @@ echo "Done";
|
|||
--EXPECTF--
|
||||
*** Testing array_map() : associative array with diff. keys for 'arr1' argument ***
|
||||
|
||||
Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
|
||||
Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line %d
|
||||
|
||||
Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
|
||||
Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line %d
|
||||
-- Iteration 1 --
|
||||
array(0) {
|
||||
}
|
||||
|
@ -131,7 +128,7 @@ array(2) {
|
|||
array(2) {
|
||||
[""]=>
|
||||
string(5) "hello"
|
||||
[5]=>
|
||||
[3]=>
|
||||
string(8) "resource"
|
||||
}
|
||||
-- Iteration 9 --
|
||||
|
@ -140,7 +137,7 @@ array(6) {
|
|||
int(1)
|
||||
["fruit"]=>
|
||||
float(2.2)
|
||||
[5]=>
|
||||
[3]=>
|
||||
string(8) "resource"
|
||||
[133]=>
|
||||
string(3) "int"
|
||||
|
|
|
@ -13,9 +13,6 @@ echo "*** Testing array_reverse() : usage variations ***\n";
|
|||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
//get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
//get a class
|
||||
class classA{
|
||||
public function __toString(){
|
||||
|
@ -45,10 +42,10 @@ $arrays = array (
|
|||
array("hello", $heredoc => "string"), // heredoc
|
||||
|
||||
// array with object, unset variable and resource variable
|
||||
array(@$unset_var => "hello", $fp => 'resource'),
|
||||
array(@$unset_var => "hello", STDERR => 'resource'),
|
||||
|
||||
// array with mixed values
|
||||
/*11*/ array('hello' => 1, "fruit" => 2.2, $fp => 'resource', 133 => "int", @$unset_var => "unset", $heredoc => "heredoc")
|
||||
/*11*/ array('hello' => 1, "fruit" => 2.2, STDERR => 'resource', 133 => "int", @$unset_var => "unset", $heredoc => "heredoc")
|
||||
);
|
||||
|
||||
// loop through the various elements of $arrays to test array_reverse()
|
||||
|
@ -66,17 +63,14 @@ foreach($arrays as $array) {
|
|||
$iterator++;
|
||||
};
|
||||
|
||||
// close the file resource used
|
||||
fclose($fp);
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing array_reverse() : usage variations ***
|
||||
|
||||
Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
|
||||
Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line %d
|
||||
|
||||
Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
|
||||
Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line %d
|
||||
-- Iteration 1 --
|
||||
- default argument -
|
||||
array(0) {
|
||||
|
@ -259,7 +253,7 @@ array(2) {
|
|||
}
|
||||
- $preserve keys = true -
|
||||
array(2) {
|
||||
[5]=>
|
||||
[3]=>
|
||||
string(8) "resource"
|
||||
[""]=>
|
||||
string(5) "hello"
|
||||
|
@ -295,7 +289,7 @@ array(6) {
|
|||
string(5) "unset"
|
||||
[133]=>
|
||||
string(3) "int"
|
||||
[5]=>
|
||||
[3]=>
|
||||
string(8) "resource"
|
||||
["fruit"]=>
|
||||
float(2.2)
|
||||
|
|
|
@ -13,9 +13,6 @@ echo "*** Testing array_unique() : assoc. array with diff. keys passed to \$inpu
|
|||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
|
@ -41,7 +38,7 @@ $inputs = array (
|
|||
array("hello", $heredoc => "string", "string"),
|
||||
|
||||
// array with object, unset variable and resource variable
|
||||
/*8*/ array(@$unset_var => "hello", $fp => 'resource', 11, "hello"),
|
||||
/*8*/ array(@$unset_var => "hello", STDERR => 'resource', 11, "hello"),
|
||||
);
|
||||
|
||||
// loop through each sub-array of $inputs to check the behavior of array_unique()
|
||||
|
@ -52,14 +49,12 @@ foreach($inputs as $input) {
|
|||
$iterator++;
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing array_unique() : assoc. array with diff. keys passed to $input argument ***
|
||||
|
||||
Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
|
||||
Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line %d
|
||||
-- Iteration 1 --
|
||||
array(1) {
|
||||
[0]=>
|
||||
|
@ -103,9 +98,9 @@ array(2) {
|
|||
array(3) {
|
||||
[""]=>
|
||||
string(5) "hello"
|
||||
[5]=>
|
||||
[3]=>
|
||||
string(8) "resource"
|
||||
[6]=>
|
||||
[4]=>
|
||||
int(11)
|
||||
}
|
||||
Done
|
||||
|
|
|
@ -22,5 +22,5 @@ fwrite($fd, "foo");
|
|||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: fclose(): 5 is not a valid stream resource in %s on line %d
|
||||
Warning: fclose(): %d is not a valid stream resource in %s on line %d
|
||||
fclose(): supplied resource is not a valid stream resource
|
||||
|
|
|
@ -6,4 +6,4 @@ define('myerr', fopen('php://stderr', 'w'));
|
|||
debug_zval_dump(myerr);
|
||||
?>
|
||||
--EXPECTF--
|
||||
resource(5) of type (stream) refcount(%d)
|
||||
resource(%d) of type (stream) refcount(%d)
|
||||
|
|
|
@ -47,18 +47,11 @@ foreach ($valid_floats as $value ) {
|
|||
|
||||
echo "\n*** Testing floatval() on non floating types ***\n";
|
||||
|
||||
// get a resource type variable
|
||||
$fp = fopen (__FILE__, "r");
|
||||
fclose($fp);
|
||||
$dfp = opendir ( __DIR__ );
|
||||
closedir($dfp);
|
||||
|
||||
// other types in an array
|
||||
$not_float_types = array (
|
||||
-2147483648, // max negative integer value
|
||||
2147483648, // max positive integer value
|
||||
$fp, // resource
|
||||
$dfp,
|
||||
STDERR, // resource
|
||||
"0.0", // string
|
||||
"1.0",
|
||||
"-1.3e3",
|
||||
|
@ -89,7 +82,6 @@ foreach ($not_float_types as $type ) {
|
|||
|
||||
echo "\nDone\n";
|
||||
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing floatval() with valid float values ***
|
||||
|
@ -145,8 +137,7 @@ Warning: A non-numeric value encountered in %s on line %d
|
|||
Warning: A non-numeric value encountered in %s on line %d
|
||||
float(-2147483648)
|
||||
float(2147483648)
|
||||
float(5)
|
||||
float(6)
|
||||
float(3)
|
||||
float(0)
|
||||
float(1)
|
||||
float(-1300)
|
||||
|
@ -163,8 +154,7 @@ float(0)
|
|||
*** Testing doubleval() on non floating types ***
|
||||
float(-2147483648)
|
||||
float(2147483648)
|
||||
float(5)
|
||||
float(6)
|
||||
float(3)
|
||||
float(0)
|
||||
float(1)
|
||||
float(-1300)
|
||||
|
|
|
@ -2,18 +2,12 @@
|
|||
Testing floatval() and its alias doubleval() functions : usage variations - different data types as $y arg
|
||||
--FILE--
|
||||
<?php
|
||||
// get a resource type variable
|
||||
$fp = fopen (__FILE__, "r");
|
||||
fclose($fp);
|
||||
$dfp = opendir ( __DIR__ );
|
||||
closedir($dfp);
|
||||
|
||||
// other types in an array
|
||||
$not_float_types = array (
|
||||
"-2147483648" => -2147483648, // max negative integer value
|
||||
"2147483647" => 2147483648, // max positive integer value
|
||||
"file resoruce" => $fp,
|
||||
"directory resource" => $dfp,
|
||||
"stream resource" => STDERR,
|
||||
"\"0.0\"" => "0.0", // string
|
||||
"\"1.0\"" => "1.0",
|
||||
"\"-1.3e3\"" => "-1.3e3",
|
||||
|
@ -24,7 +18,6 @@ $not_float_types = array (
|
|||
"\"10.0 dollar\" + 1.0" => "10.0 dollar" + 1.0,
|
||||
"\"\"" => "",
|
||||
"true" => true,
|
||||
"NULL" => NULL,
|
||||
"null" => null,
|
||||
);
|
||||
/* loop through the $not_float_types to see working of
|
||||
|
@ -57,11 +50,8 @@ float(-2147483648)
|
|||
-- Iteration : 2147483647 --
|
||||
float(2147483648)
|
||||
|
||||
-- Iteration : file resoruce --
|
||||
float(5)
|
||||
|
||||
-- Iteration : directory resource --
|
||||
float(6)
|
||||
-- Iteration : stream resource --
|
||||
float(3)
|
||||
|
||||
-- Iteration : "0.0" --
|
||||
float(0)
|
||||
|
@ -93,9 +83,6 @@ float(0)
|
|||
-- Iteration : true --
|
||||
float(1)
|
||||
|
||||
-- Iteration : NULL --
|
||||
float(0)
|
||||
|
||||
-- Iteration : null --
|
||||
float(0)
|
||||
|
||||
|
@ -107,11 +94,8 @@ float(-2147483648)
|
|||
-- Iteration : 2147483647 --
|
||||
float(2147483648)
|
||||
|
||||
-- Iteration : file resoruce --
|
||||
float(5)
|
||||
|
||||
-- Iteration : directory resource --
|
||||
float(6)
|
||||
-- Iteration : stream resource --
|
||||
float(3)
|
||||
|
||||
-- Iteration : "0.0" --
|
||||
float(0)
|
||||
|
@ -143,8 +127,5 @@ float(0)
|
|||
-- Iteration : true --
|
||||
float(1)
|
||||
|
||||
-- Iteration : NULL --
|
||||
float(0)
|
||||
|
||||
-- Iteration : null --
|
||||
float(0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue