diff --git a/Zend/tests/type_declarations/scalar_return_basic.phpt b/Zend/tests/type_declarations/scalar_return_basic.phpt index 1fd3d26db6d8a..8f827600328ed 100644 --- a/Zend/tests/type_declarations/scalar_return_basic.phpt +++ b/Zend/tests/type_declarations/scalar_return_basic.phpt @@ -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 diff --git a/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt b/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt index da930b98d9b65..0a32dd3f16f23 100644 --- a/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt +++ b/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt @@ -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 diff --git a/Zend/tests/type_declarations/scalar_strict.phpt b/Zend/tests/type_declarations/scalar_strict.phpt index e89d18b2c86b3..626f322d8701f 100644 --- a/Zend/tests/type_declarations/scalar_strict.phpt +++ b/Zend/tests/type_declarations/scalar_strict.phpt @@ -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 diff --git a/Zend/tests/type_declarations/scalar_strict_64bit.phpt b/Zend/tests/type_declarations/scalar_strict_64bit.phpt index 6335e2d1acee4..b7f2ce0de4396 100644 --- a/Zend/tests/type_declarations/scalar_strict_64bit.phpt +++ b/Zend/tests/type_declarations/scalar_strict_64bit.phpt @@ -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 diff --git a/ext/opcache/tests/jit/fetch_obj_001.phpt b/ext/opcache/tests/jit/fetch_obj_001.phpt index 0f68c1aae0991..ddc8dfafba648 100644 --- a/ext/opcache/tests/jit/fetch_obj_001.phpt +++ b/ext/opcache/tests/jit/fetch_obj_001.phpt @@ -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) { } diff --git a/ext/standard/tests/array/array_map_variation4.phpt b/ext/standard/tests/array/array_map_variation4.phpt index 4d6269b3617db..d75a0bcf26108 100644 --- a/ext/standard/tests/array/array_map_variation4.phpt +++ b/ext/standard/tests/array/array_map_variation4.phpt @@ -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" diff --git a/ext/standard/tests/array/array_reverse_variation4.phpt b/ext/standard/tests/array/array_reverse_variation4.phpt index 07454f5a1f261..4967f6e4dacb0 100644 --- a/ext/standard/tests/array/array_reverse_variation4.phpt +++ b/ext/standard/tests/array/array_reverse_variation4.phpt @@ -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) diff --git a/ext/standard/tests/array/array_unique_variation3.phpt b/ext/standard/tests/array/array_unique_variation3.phpt index b412a19a422e5..91b551bb60402 100644 --- a/ext/standard/tests/array/array_unique_variation3.phpt +++ b/ext/standard/tests/array/array_unique_variation3.phpt @@ -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 diff --git a/ext/standard/tests/file/file_get_contents_basic.phpt b/ext/standard/tests/file/file_get_contents_basic.phpt index 96f74c7611917..cf5e4ba6165d8 100644 --- a/ext/standard/tests/file/file_get_contents_basic.phpt +++ b/ext/standard/tests/file/file_get_contents_basic.phpt @@ -29,6 +29,7 @@ echo "\n*** Done ***"; $file_path = __DIR__; include($file_path."/file.inc"); delete_files($file_path, 1); +@unlink($file_path."/file_get_contents_basic1.tmp"); ?> --EXPECT-- *** Testing the basic functionality of the file_get_contents() function *** diff --git a/ext/standard/tests/filters/bug54350.phpt b/ext/standard/tests/filters/bug54350.phpt index a017893eed7bb..ae00762890857 100644 --- a/ext/standard/tests/filters/bug54350.phpt +++ b/ext/standard/tests/filters/bug54350.phpt @@ -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 diff --git a/ext/standard/tests/general_functions/bug73973.phpt b/ext/standard/tests/general_functions/bug73973.phpt index 8bb4daaab094d..fccd8b5af9457 100644 --- a/ext/standard/tests/general_functions/bug73973.phpt +++ b/ext/standard/tests/general_functions/bug73973.phpt @@ -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) diff --git a/ext/standard/tests/general_functions/floatval.phpt b/ext/standard/tests/general_functions/floatval.phpt index f9aa74e342d56..9ff49bb01084e 100644 --- a/ext/standard/tests/general_functions/floatval.phpt +++ b/ext/standard/tests/general_functions/floatval.phpt @@ -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) diff --git a/ext/standard/tests/general_functions/floatval_variation1.phpt b/ext/standard/tests/general_functions/floatval_variation1.phpt index 856e4e31ebb0d..032d089b01c49 100644 --- a/ext/standard/tests/general_functions/floatval_variation1.phpt +++ b/ext/standard/tests/general_functions/floatval_variation1.phpt @@ -2,18 +2,12 @@ Testing floatval() and its alias doubleval() functions : usage variations - different data types as $y arg --FILE-- -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) diff --git a/ext/standard/tests/general_functions/print_r.phpt b/ext/standard/tests/general_functions/print_r.phpt deleted file mode 100644 index 0ea60658aed7a..0000000000000 --- a/ext/standard/tests/general_functions/print_r.phpt +++ /dev/null @@ -1,1696 +0,0 @@ ---TEST-- -Test print_r() function ---INI-- -precision=14 ---FILE-- - 'One'), - array("test" => "is_array"), - array(0), - array(-1), - array(10.5, 5.6), - array("string", "test"), - array('string', 'test'), -); -/* calling check_printr() to display contents of $arrays */ -check_printr($arrays); - -echo "\n*** Testing print_r() on object variables ***\n"; -#[AllowDynamicProperties] -class object_class -{ - var $value; - public $public_var1 = 10; - private $private_var1 = 20; - private $private_var2; - protected $protected_var1 = "string_1"; - protected $protected_var2; - - function __construct() { - $this->value = 50; - $this->public_var2 = 11; - $this->private_var2 = 21; - $this->protected_var2 = "string_2"; - } - - public function foo1() { - echo "foo1() is called\n"; - } - protected function foo2() { - echo "foo2() is called\n"; - } - private function foo3() { - echo "foo3() is called\n"; - } -} -/* class with no member */ -class no_member_class { - // no members -} - -/* class with member as object of other class */ -#[AllowDynamicProperties] -class contains_object_class -{ - var $p = 30; - var $class_object1; - public $class_object2; - private $class_object3; - protected $class_object4; - var $no_member_class_object; - - public function func() { - echo "func() is called \n"; - } - - function __construct() { - $this->class_object1 = new object_class(); - $this->class_object2 = new object_class(); - $this->class_object3 = $this->class_object1; - $this->class_object4 = $this->class_object2; - $this->no_member_class_object = new no_member_class(); - $this->class_object5 = $this; //recursive reference - } -} - -/* objects of different classes */ -$obj = new contains_object_class; -$temp_class_obj = new object_class(); - -/* object which is unset */ -$unset_obj = new object_class(); -unset($unset_obj); - -$objects = array ( - new object_class, - new no_member_class, - new contains_object_class, - $obj, - $obj->class_object1, - $obj->class_object2, - $obj->no_member_class_object, - $temp_class_obj, - @$unset_obj -); -/* calling check_printr() to display contents of the objects using print_r() */ -check_printr($objects); - -echo "\n** Testing print_r() on objects having circular reference **\n"; -$recursion_obj1 = new object_class(); -$recursion_obj2 = new object_class(); -$recursion_obj1->obj = &$recursion_obj2; //circular reference -$recursion_obj2->obj = &$recursion_obj1; //circular reference -print_r($recursion_obj2); - -echo "\n*** Testing print_r() on resources ***\n"; -/* file type resource */ -$file_handle = fopen(__FILE__, "r"); - -/* directory type resource */ -$dir_handle = opendir( __DIR__ ); - -$resources = array ( - $file_handle, - $dir_handle -); -/* calling check_printr() to display the resource content type - using print_r() */ -check_printr($resources); - -echo "\n*** Testing print_r() on different combinations of scalar - and non-scalar variables ***\n"; -/* a variable which is unset */ -$unset_var = 10.5; -unset($unset_var); - -/* unset file type resource */ -unset($file_handle); - -$variations = array ( - array( 123, -1.2345, "a" ), - array( "d", array(1, 3, 5), true, null), - array( new no_member_class, array(), false, 0 ), - array( -0.00, "Where am I?", array(7,8,9), TRUE, 'A', 987654321 ), - array( @$unset_var, 2.E+10, 100-20.9, 000004.599998 ), //unusual data - array( "array(1,2,3,4)1.0000002TRUE", @$file_handle, 111333.00+45e5, '/00\7') -); -/* calling check_printr() to display combinations of scalar and - non-scalar variables using print_r() */ -check_printr($variations); - -echo "\n*** Testing print_r() on miscellaneous input arguments ***\n"; -$misc_values = array ( - @$unset_var, - NULL, // NULL argument - @$undef_variable, //undefined variable - null -); -/* calling check_printr() to display miscellaneous data using print_r() */ -check_printr($misc_values); - -/* closing resource handle used */ -closedir($dir_handle); - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing print_r() on integer variables *** - --- Iteration 1 -- -0 -0 -0 --- Iteration 2 -- -83 -83 -83 --- Iteration 3 -- -123000000 -123000000 -123000000 --- Iteration 4 -- --83 --83 --83 --- Iteration 5 -- --12300000 --12300000 --12300000 --- Iteration 6 -- -Array -( - [0] => 1 - [1] => 2 - [2] => 3 - [3] => 4 - [4] => 5 - [5] => 6 - [6] => 7 - [7] => 8 - [8] => 9 - [9] => 10 -) - -Array -( - [0] => 1 - [1] => 2 - [2] => 3 - [3] => 4 - [4] => 5 - [5] => 6 - [6] => 7 - [7] => 8 - [8] => 9 - [9] => 10 -) - -Array -( - [0] => 1 - [1] => 2 - [2] => 3 - [3] => 4 - [4] => 5 - [5] => 6 - [6] => 7 - [7] => 8 - [8] => 9 - [9] => 10 -) - --- Iteration 7 -- -Array -( - [0] => -1 - [1] => -2 - [2] => -3 - [3] => -4 - [4] => -5 - [5] => -6 - [6] => -7 - [7] => -8 - [8] => -9 - [9] => -10 -) - -Array -( - [0] => -1 - [1] => -2 - [2] => -3 - [3] => -4 - [4] => -5 - [5] => -6 - [6] => -7 - [7] => -8 - [8] => -9 - [9] => -10 -) - -Array -( - [0] => -1 - [1] => -2 - [2] => -3 - [3] => -4 - [4] => -5 - [5] => -6 - [6] => -7 - [7] => -8 - [8] => -9 - [9] => -10 -) - --- Iteration 8 -- -2147483647 -2147483647 -2147483647 --- Iteration 9 -- -2147483648 -2147483648 -2147483648 --- Iteration 10 -- --2147483648 --2147483648 --2147483648 --- Iteration 11 -- --2147483647 --2147483647 --2147483647 --- Iteration 12 -- -2147483647 -2147483647 -2147483647 --- Iteration 13 -- --2147483648 --2147483648 --2147483648 --- Iteration 14 -- -2147483647 -2147483647 -2147483647 --- Iteration 15 -- --2147483648 --2147483648 --2147483648 -*** Testing print_r() on float variables *** - --- Iteration 1 -- --0 --0 --0 --- Iteration 2 -- -0 -0 -0 --- Iteration 3 -- -1.234 -1.234 -1.234 --- Iteration 4 -- --1.234 --1.234 --1.234 --- Iteration 5 -- --2 --2 --2 --- Iteration 6 -- -2 -2 -2 --- Iteration 7 -- --0.5 --0.5 --0.5 --- Iteration 8 -- -0.567 -0.567 -0.567 --- Iteration 9 -- --0.00067 --0.00067 --0.00067 --- Iteration 10 -- --670 --670 --670 --- Iteration 11 -- -670 -670 -670 --- Iteration 12 -- -670 -670 -670 --- Iteration 13 -- --0.00410003 --0.00410003 --0.00410003 --- Iteration 14 -- --4100.03 --4100.03 --4100.03 --- Iteration 15 -- -0.004100003 -0.004100003 -0.004100003 --- Iteration 16 -- -4100.003 -4100.003 -4100.003 --- Iteration 17 -- -100000 -100000 -100000 --- Iteration 18 -- --100000 --100000 --100000 --- Iteration 19 -- -1.0E-5 -1.0E-5 -1.0E-5 --- Iteration 20 -- --1.0E-5 --1.0E-5 --1.0E-5 --- Iteration 21 -- -100000 -100000 -100000 --- Iteration 22 -- --100000 --100000 --100000 --- Iteration 23 -- -100000 -100000 -100000 --- Iteration 24 -- --100000 --100000 --100000 --- Iteration 25 -- -100000 -100000 -100000 --- Iteration 26 -- --100000 --100000 --100000 --- Iteration 27 -- -1.0E-5 -1.0E-5 -1.0E-5 --- Iteration 28 -- --1.0E-5 --1.0E-5 --1.0E-5 --- Iteration 29 -- --2147483649 --2147483649 --2147483649 --- Iteration 30 -- -2147483649 -2147483649 -2147483649 --- Iteration 31 -- -2147483649 -2147483649 -2147483649 --- Iteration 32 -- --2147483649 --2147483649 --2147483649 -*** Testing print_r() on string variables *** - --- Iteration 1 -- - - - --- Iteration 2 -- - - - --- Iteration 3 -- - - - --- Iteration 4 -- - - - --- Iteration 5 -- -0 -0 -0 --- Iteration 6 -- -%0 -%0 -%0 --- Iteration 7 -- -\0 -\0 -\0 --- Iteration 8 -- - - - --- Iteration 9 -- -\t -\t -\t --- Iteration 10 -- -PHP -PHP -PHP --- Iteration 11 -- -PHP -PHP -PHP --- Iteration 12 -- -abcd%0n1234%005678%000efgh\xijkl -abcd%0n1234%005678%000efgh\xijkl -abcd%0n1234%005678%000efgh\xijkl --- Iteration 13 -- -abcd%0efgh%0ijkl%0mnop%00qrst%0uvwx%00yz -abcd%0efgh%0ijkl%0mnop%00qrst%0uvwx%00yz -abcd%0efgh%0ijkl%0mnop%00qrst%0uvwx%00yz --- Iteration 14 -- -1234 -5678 - 9100"abcda -1234 -5678 - 9100"abcda -1234 -5678 - 9100"abcda -*** Testing print_r() on boolean variables *** - --- Iteration 1 -- -1 -1 -1 --- Iteration 2 -- - - - --- Iteration 3 -- -1 -1 -1 --- Iteration 4 -- - - -bool(true) - -bool(true) - -*** Testing print_r() on array variables *** - --- Iteration 1 -- -Array -( -) - -Array -( -) - -Array -( -) - --- Iteration 2 -- -Array -( - [0] => -) - -Array -( - [0] => -) - -Array -( - [0] => -) - --- Iteration 3 -- -Array -( - [0] => -) - -Array -( - [0] => -) - -Array -( - [0] => -) - --- Iteration 4 -- -Array -( - [0] => 1 -) - -Array -( - [0] => 1 -) - -Array -( - [0] => 1 -) - --- Iteration 5 -- -Array -( - [0] => -) - -Array -( - [0] => -) - -Array -( - [0] => -) - --- Iteration 6 -- -Array -( - [0] => -) - -Array -( - [0] => -) - -Array -( - [0] => -) - --- Iteration 7 -- -Array -( - [0] => Array - ( - ) - - [1] => Array - ( - ) - -) - -Array -( - [0] => Array - ( - ) - - [1] => Array - ( - ) - -) - -Array -( - [0] => Array - ( - ) - - [1] => Array - ( - ) - -) - --- Iteration 8 -- -Array -( - [0] => Array - ( - [0] => 1 - [1] => 2 - ) - - [1] => Array - ( - [0] => a - [1] => b - ) - -) - -Array -( - [0] => Array - ( - [0] => 1 - [1] => 2 - ) - - [1] => Array - ( - [0] => a - [1] => b - ) - -) - -Array -( - [0] => Array - ( - [0] => 1 - [1] => 2 - ) - - [1] => Array - ( - [0] => a - [1] => b - ) - -) - --- Iteration 9 -- -Array -( - [1] => One -) - -Array -( - [1] => One -) - -Array -( - [1] => One -) - --- Iteration 10 -- -Array -( - [test] => is_array -) - -Array -( - [test] => is_array -) - -Array -( - [test] => is_array -) - --- Iteration 11 -- -Array -( - [0] => 0 -) - -Array -( - [0] => 0 -) - -Array -( - [0] => 0 -) - --- Iteration 12 -- -Array -( - [0] => -1 -) - -Array -( - [0] => -1 -) - -Array -( - [0] => -1 -) - --- Iteration 13 -- -Array -( - [0] => 10.5 - [1] => 5.6 -) - -Array -( - [0] => 10.5 - [1] => 5.6 -) - -Array -( - [0] => 10.5 - [1] => 5.6 -) - --- Iteration 14 -- -Array -( - [0] => string - [1] => test -) - -Array -( - [0] => string - [1] => test -) - -Array -( - [0] => string - [1] => test -) - --- Iteration 15 -- -Array -( - [0] => string - [1] => test -) - -Array -( - [0] => string - [1] => test -) - -Array -( - [0] => string - [1] => test -) - -*** Testing print_r() on object variables *** - --- Iteration 1 -- -object_class Object -( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 -) - -object_class Object -( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 -) - -object_class Object -( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 -) - --- Iteration 2 -- -no_member_class Object -( -) - -no_member_class Object -( -) - -no_member_class Object -( -) - --- Iteration 3 -- -contains_object_class Object -( - [p] => 30 - [class_object1] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object2] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object3:contains_object_class:private] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object4:protected] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [no_member_class_object] => no_member_class Object - ( - ) - - [class_object5] => contains_object_class Object - *RECURSION* -) - -contains_object_class Object -( - [p] => 30 - [class_object1] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object2] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object3:contains_object_class:private] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object4:protected] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [no_member_class_object] => no_member_class Object - ( - ) - - [class_object5] => contains_object_class Object - *RECURSION* -) - -contains_object_class Object -( - [p] => 30 - [class_object1] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object2] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object3:contains_object_class:private] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object4:protected] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [no_member_class_object] => no_member_class Object - ( - ) - - [class_object5] => contains_object_class Object - *RECURSION* -) - --- Iteration 4 -- -contains_object_class Object -( - [p] => 30 - [class_object1] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object2] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object3:contains_object_class:private] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object4:protected] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [no_member_class_object] => no_member_class Object - ( - ) - - [class_object5] => contains_object_class Object - *RECURSION* -) - -contains_object_class Object -( - [p] => 30 - [class_object1] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object2] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object3:contains_object_class:private] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object4:protected] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [no_member_class_object] => no_member_class Object - ( - ) - - [class_object5] => contains_object_class Object - *RECURSION* -) - -contains_object_class Object -( - [p] => 30 - [class_object1] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object2] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object3:contains_object_class:private] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object4:protected] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [no_member_class_object] => no_member_class Object - ( - ) - - [class_object5] => contains_object_class Object - *RECURSION* -) - --- Iteration 5 -- -object_class Object -( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 -) - -object_class Object -( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 -) - -object_class Object -( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 -) - --- Iteration 6 -- -object_class Object -( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 -) - -object_class Object -( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 -) - -object_class Object -( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 -) - --- Iteration 7 -- -no_member_class Object -( -) - -no_member_class Object -( -) - -no_member_class Object -( -) - --- Iteration 8 -- -object_class Object -( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 -) - -object_class Object -( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 -) - -object_class Object -( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 -) - --- Iteration 9 -- - - - -** Testing print_r() on objects having circular reference ** -object_class Object -( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - [obj] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - [obj] => object_class Object - *RECURSION* - ) - -) - -*** Testing print_r() on resources *** - --- Iteration 1 -- -Resource id #5 -Resource id #5 -Resource id #5 --- Iteration 2 -- -Resource id #6 -Resource id #6 -Resource id #6 -*** Testing print_r() on different combinations of scalar - and non-scalar variables *** - --- Iteration 1 -- -Array -( - [0] => 123 - [1] => -1.2345 - [2] => a -) - -Array -( - [0] => 123 - [1] => -1.2345 - [2] => a -) - -Array -( - [0] => 123 - [1] => -1.2345 - [2] => a -) - --- Iteration 2 -- -Array -( - [0] => d - [1] => Array - ( - [0] => 1 - [1] => 3 - [2] => 5 - ) - - [2] => 1 - [3] => -) - -Array -( - [0] => d - [1] => Array - ( - [0] => 1 - [1] => 3 - [2] => 5 - ) - - [2] => 1 - [3] => -) - -Array -( - [0] => d - [1] => Array - ( - [0] => 1 - [1] => 3 - [2] => 5 - ) - - [2] => 1 - [3] => -) - --- Iteration 3 -- -Array -( - [0] => no_member_class Object - ( - ) - - [1] => Array - ( - ) - - [2] => - [3] => 0 -) - -Array -( - [0] => no_member_class Object - ( - ) - - [1] => Array - ( - ) - - [2] => - [3] => 0 -) - -Array -( - [0] => no_member_class Object - ( - ) - - [1] => Array - ( - ) - - [2] => - [3] => 0 -) - --- Iteration 4 -- -Array -( - [0] => -0 - [1] => Where am I? - [2] => Array - ( - [0] => 7 - [1] => 8 - [2] => 9 - ) - - [3] => 1 - [4] => A - [5] => 987654321 -) - -Array -( - [0] => -0 - [1] => Where am I? - [2] => Array - ( - [0] => 7 - [1] => 8 - [2] => 9 - ) - - [3] => 1 - [4] => A - [5] => 987654321 -) - -Array -( - [0] => -0 - [1] => Where am I? - [2] => Array - ( - [0] => 7 - [1] => 8 - [2] => 9 - ) - - [3] => 1 - [4] => A - [5] => 987654321 -) - --- Iteration 5 -- -Array -( - [0] => - [1] => 20000000000 - [2] => 79.1 - [3] => 4.599998 -) - -Array -( - [0] => - [1] => 20000000000 - [2] => 79.1 - [3] => 4.599998 -) - -Array -( - [0] => - [1] => 20000000000 - [2] => 79.1 - [3] => 4.599998 -) - --- Iteration 6 -- -Array -( - [0] => array(1,2,3,4)1.0000002TRUE - [1] => - [2] => 4611333 - [3] => /00\7 -) - -Array -( - [0] => array(1,2,3,4)1.0000002TRUE - [1] => - [2] => 4611333 - [3] => /00\7 -) - -Array -( - [0] => array(1,2,3,4)1.0000002TRUE - [1] => - [2] => 4611333 - [3] => /00\7 -) - -*** Testing print_r() on miscellaneous input arguments *** - --- Iteration 1 -- - - - --- Iteration 2 -- - - - --- Iteration 3 -- - - - --- Iteration 4 -- - - -Done diff --git a/ext/standard/tests/general_functions/print_r_64bit.phpt b/ext/standard/tests/general_functions/print_r_64bit.phpt deleted file mode 100644 index 6026b959d7c4c..0000000000000 --- a/ext/standard/tests/general_functions/print_r_64bit.phpt +++ /dev/null @@ -1,1700 +0,0 @@ ---TEST-- -Test print_r() function ---SKIPIF-- - ---INI-- -precision=14 ---FILE-- - 'One'), - array("test" => "is_array"), - array(0), - array(-1), - array(10.5, 5.6), - array("string", "test"), - array('string', 'test'), -); -/* calling check_printr() to display contents of $arrays */ -check_printr($arrays); - -echo "\n*** Testing print_r() on object variables ***\n"; -#[AllowDynamicProperties] -class object_class -{ - var $value; - public $public_var1 = 10; - private $private_var1 = 20; - private $private_var2; - protected $protected_var1 = "string_1"; - protected $protected_var2; - - function __construct ( ) { - $this->value = 50; - $this->public_var2 = 11; - $this->private_var2 = 21; - $this->protected_var2 = "string_2"; - } - - public function foo1() { - echo "foo1() is called\n"; - } - protected function foo2() { - echo "foo2() is called\n"; - } - private function foo3() { - echo "foo3() is called\n"; - } -} -/* class with no member */ -class no_member_class { - // no members -} - -/* class with member as object of other class */ -#[AllowDynamicProperties] -class contains_object_class -{ - var $p = 30; - var $class_object1; - public $class_object2; - private $class_object3; - protected $class_object4; - var $no_member_class_object; - - public function func() { - echo "func() is called \n"; - } - - function __construct () { - $this->class_object1 = new object_class(); - $this->class_object2 = new object_class(); - $this->class_object3 = $this->class_object1; - $this->class_object4 = $this->class_object2; - $this->no_member_class_object = new no_member_class(); - $this->class_object5 = $this; //recursive reference - } -} - -/* objects of different classes */ -$obj = new contains_object_class; -$temp_class_obj = new object_class(); - -/* object which is unset */ -$unset_obj = new object_class(); -unset($unset_obj); - -$objects = array ( - new object_class, - new no_member_class, - new contains_object_class, - $obj, - $obj->class_object1, - $obj->class_object2, - $obj->no_member_class_object, - $temp_class_obj, - @$unset_obj -); -/* calling check_printr() to display contents of the objects using print_r() */ -check_printr($objects); - -echo "\n** Testing print_r() on objects having circular reference **\n"; -$recursion_obj1 = new object_class(); -$recursion_obj2 = new object_class(); -$recursion_obj1->obj = &$recursion_obj2; //circular reference -$recursion_obj2->obj = &$recursion_obj1; //circular reference -print_r($recursion_obj2); - -echo "\n*** Testing print_r() on resources ***\n"; -/* file type resource */ -$file_handle = fopen(__FILE__, "r"); - -/* directory type resource */ -$dir_handle = opendir( __DIR__ ); - -$resources = array ( - $file_handle, - $dir_handle -); -/* calling check_printr() to display the resource content type - using print_r() */ -check_printr($resources); - -echo "\n*** Testing print_r() on different combinations of scalar - and non-scalar variables ***\n"; -/* a variable which is unset */ -$unset_var = 10.5; -unset($unset_var); - -/* unset file type resource */ -unset($file_handle); - -$variations = array ( - array( 123, -1.2345, "a" ), - array( "d", array(1, 3, 5), true, null), - array( new no_member_class, array(), false, 0 ), - array( -0.00, "Where am I?", array(7,8,9), TRUE, 'A', 987654321 ), - array( @$unset_var, 2.E+10, 100-20.9, 000004.599998 ), //unusual data - array( "array(1,2,3,4)1.0000002TRUE", @$file_handle, 111333.00+45e5, '/00\7') -); -/* calling check_printr() to display combinations of scalar and - non-scalar variables using print_r() */ -check_printr($variations); - -echo "\n*** Testing print_r() on miscellaneous input arguments ***\n"; -$misc_values = array ( - @$unset_var, - NULL, // NULL argument - @$undef_variable, //undefined variable - null -); -/* calling check_printr() to display miscellaneous data using print_r() */ -check_printr($misc_values); - -/* closing resource handle used */ -closedir($dir_handle); - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing print_r() on integer variables *** - --- Iteration 1 -- -0 -0 -0 --- Iteration 2 -- -83 -83 -83 --- Iteration 3 -- -123000000 -123000000 -123000000 --- Iteration 4 -- --83 --83 --83 --- Iteration 5 -- --12300000 --12300000 --12300000 --- Iteration 6 -- -Array -( - [0] => 1 - [1] => 2 - [2] => 3 - [3] => 4 - [4] => 5 - [5] => 6 - [6] => 7 - [7] => 8 - [8] => 9 - [9] => 10 -) - -Array -( - [0] => 1 - [1] => 2 - [2] => 3 - [3] => 4 - [4] => 5 - [5] => 6 - [6] => 7 - [7] => 8 - [8] => 9 - [9] => 10 -) - -Array -( - [0] => 1 - [1] => 2 - [2] => 3 - [3] => 4 - [4] => 5 - [5] => 6 - [6] => 7 - [7] => 8 - [8] => 9 - [9] => 10 -) - --- Iteration 7 -- -Array -( - [0] => -1 - [1] => -2 - [2] => -3 - [3] => -4 - [4] => -5 - [5] => -6 - [6] => -7 - [7] => -8 - [8] => -9 - [9] => -10 -) - -Array -( - [0] => -1 - [1] => -2 - [2] => -3 - [3] => -4 - [4] => -5 - [5] => -6 - [6] => -7 - [7] => -8 - [8] => -9 - [9] => -10 -) - -Array -( - [0] => -1 - [1] => -2 - [2] => -3 - [3] => -4 - [4] => -5 - [5] => -6 - [6] => -7 - [7] => -8 - [8] => -9 - [9] => -10 -) - --- Iteration 8 -- -2147483647 -2147483647 -2147483647 --- Iteration 9 -- -2147483648 -2147483648 -2147483648 --- Iteration 10 -- --2147483648 --2147483648 --2147483648 --- Iteration 11 -- --2147483647 --2147483647 --2147483647 --- Iteration 12 -- -2147483647 -2147483647 -2147483647 --- Iteration 13 -- --2147483648 --2147483648 --2147483648 --- Iteration 14 -- -2147483647 -2147483647 -2147483647 --- Iteration 15 -- --2147483648 --2147483648 --2147483648 -*** Testing print_r() on float variables *** - --- Iteration 1 -- --0 --0 --0 --- Iteration 2 -- -0 -0 -0 --- Iteration 3 -- -1.234 -1.234 -1.234 --- Iteration 4 -- --1.234 --1.234 --1.234 --- Iteration 5 -- --2 --2 --2 --- Iteration 6 -- -2 -2 -2 --- Iteration 7 -- --0.5 --0.5 --0.5 --- Iteration 8 -- -0.567 -0.567 -0.567 --- Iteration 9 -- --0.00067 --0.00067 --0.00067 --- Iteration 10 -- --670 --670 --670 --- Iteration 11 -- -670 -670 -670 --- Iteration 12 -- -670 -670 -670 --- Iteration 13 -- --0.00410003 --0.00410003 --0.00410003 --- Iteration 14 -- --4100.03 --4100.03 --4100.03 --- Iteration 15 -- -0.004100003 -0.004100003 -0.004100003 --- Iteration 16 -- -4100.003 -4100.003 -4100.003 --- Iteration 17 -- -100000 -100000 -100000 --- Iteration 18 -- --100000 --100000 --100000 --- Iteration 19 -- -1.0E-5 -1.0E-5 -1.0E-5 --- Iteration 20 -- --1.0E-5 --1.0E-5 --1.0E-5 --- Iteration 21 -- -100000 -100000 -100000 --- Iteration 22 -- --100000 --100000 --100000 --- Iteration 23 -- -100000 -100000 -100000 --- Iteration 24 -- --100000 --100000 --100000 --- Iteration 25 -- -100000 -100000 -100000 --- Iteration 26 -- --100000 --100000 --100000 --- Iteration 27 -- -1.0E-5 -1.0E-5 -1.0E-5 --- Iteration 28 -- --1.0E-5 --1.0E-5 --1.0E-5 --- Iteration 29 -- --2147483649 --2147483649 --2147483649 --- Iteration 30 -- -2147483649 -2147483649 -2147483649 --- Iteration 31 -- -2147483649 -2147483649 -2147483649 --- Iteration 32 -- --2147483649 --2147483649 --2147483649 -*** Testing print_r() on string variables *** - --- Iteration 1 -- - - - --- Iteration 2 -- - - - --- Iteration 3 -- - - - --- Iteration 4 -- - - - --- Iteration 5 -- -0 -0 -0 --- Iteration 6 -- -%0 -%0 -%0 --- Iteration 7 -- -\0 -\0 -\0 --- Iteration 8 -- - - - --- Iteration 9 -- -\t -\t -\t --- Iteration 10 -- -PHP -PHP -PHP --- Iteration 11 -- -PHP -PHP -PHP --- Iteration 12 -- -abcd%0n1234%005678%000efgh\xijkl -abcd%0n1234%005678%000efgh\xijkl -abcd%0n1234%005678%000efgh\xijkl --- Iteration 13 -- -abcd%0efgh%0ijkl%0mnop%00qrst%0uvwx%00yz -abcd%0efgh%0ijkl%0mnop%00qrst%0uvwx%00yz -abcd%0efgh%0ijkl%0mnop%00qrst%0uvwx%00yz --- Iteration 14 -- -1234 -5678 - 9100"abcda -1234 -5678 - 9100"abcda -1234 -5678 - 9100"abcda -*** Testing print_r() on boolean variables *** - --- Iteration 1 -- -1 -1 -1 --- Iteration 2 -- - - - --- Iteration 3 -- -1 -1 -1 --- Iteration 4 -- - - -bool(true) - -bool(true) - -*** Testing print_r() on array variables *** - --- Iteration 1 -- -Array -( -) - -Array -( -) - -Array -( -) - --- Iteration 2 -- -Array -( - [0] => -) - -Array -( - [0] => -) - -Array -( - [0] => -) - --- Iteration 3 -- -Array -( - [0] => -) - -Array -( - [0] => -) - -Array -( - [0] => -) - --- Iteration 4 -- -Array -( - [0] => 1 -) - -Array -( - [0] => 1 -) - -Array -( - [0] => 1 -) - --- Iteration 5 -- -Array -( - [0] => -) - -Array -( - [0] => -) - -Array -( - [0] => -) - --- Iteration 6 -- -Array -( - [0] => -) - -Array -( - [0] => -) - -Array -( - [0] => -) - --- Iteration 7 -- -Array -( - [0] => Array - ( - ) - - [1] => Array - ( - ) - -) - -Array -( - [0] => Array - ( - ) - - [1] => Array - ( - ) - -) - -Array -( - [0] => Array - ( - ) - - [1] => Array - ( - ) - -) - --- Iteration 8 -- -Array -( - [0] => Array - ( - [0] => 1 - [1] => 2 - ) - - [1] => Array - ( - [0] => a - [1] => b - ) - -) - -Array -( - [0] => Array - ( - [0] => 1 - [1] => 2 - ) - - [1] => Array - ( - [0] => a - [1] => b - ) - -) - -Array -( - [0] => Array - ( - [0] => 1 - [1] => 2 - ) - - [1] => Array - ( - [0] => a - [1] => b - ) - -) - --- Iteration 9 -- -Array -( - [1] => One -) - -Array -( - [1] => One -) - -Array -( - [1] => One -) - --- Iteration 10 -- -Array -( - [test] => is_array -) - -Array -( - [test] => is_array -) - -Array -( - [test] => is_array -) - --- Iteration 11 -- -Array -( - [0] => 0 -) - -Array -( - [0] => 0 -) - -Array -( - [0] => 0 -) - --- Iteration 12 -- -Array -( - [0] => -1 -) - -Array -( - [0] => -1 -) - -Array -( - [0] => -1 -) - --- Iteration 13 -- -Array -( - [0] => 10.5 - [1] => 5.6 -) - -Array -( - [0] => 10.5 - [1] => 5.6 -) - -Array -( - [0] => 10.5 - [1] => 5.6 -) - --- Iteration 14 -- -Array -( - [0] => string - [1] => test -) - -Array -( - [0] => string - [1] => test -) - -Array -( - [0] => string - [1] => test -) - --- Iteration 15 -- -Array -( - [0] => string - [1] => test -) - -Array -( - [0] => string - [1] => test -) - -Array -( - [0] => string - [1] => test -) - -*** Testing print_r() on object variables *** - --- Iteration 1 -- -object_class Object -( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 -) - -object_class Object -( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 -) - -object_class Object -( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 -) - --- Iteration 2 -- -no_member_class Object -( -) - -no_member_class Object -( -) - -no_member_class Object -( -) - --- Iteration 3 -- -contains_object_class Object -( - [p] => 30 - [class_object1] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object2] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object3:contains_object_class:private] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object4:protected] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [no_member_class_object] => no_member_class Object - ( - ) - - [class_object5] => contains_object_class Object - *RECURSION* -) - -contains_object_class Object -( - [p] => 30 - [class_object1] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object2] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object3:contains_object_class:private] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object4:protected] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [no_member_class_object] => no_member_class Object - ( - ) - - [class_object5] => contains_object_class Object - *RECURSION* -) - -contains_object_class Object -( - [p] => 30 - [class_object1] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object2] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object3:contains_object_class:private] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object4:protected] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [no_member_class_object] => no_member_class Object - ( - ) - - [class_object5] => contains_object_class Object - *RECURSION* -) - --- Iteration 4 -- -contains_object_class Object -( - [p] => 30 - [class_object1] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object2] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object3:contains_object_class:private] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object4:protected] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [no_member_class_object] => no_member_class Object - ( - ) - - [class_object5] => contains_object_class Object - *RECURSION* -) - -contains_object_class Object -( - [p] => 30 - [class_object1] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object2] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object3:contains_object_class:private] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object4:protected] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [no_member_class_object] => no_member_class Object - ( - ) - - [class_object5] => contains_object_class Object - *RECURSION* -) - -contains_object_class Object -( - [p] => 30 - [class_object1] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object2] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object3:contains_object_class:private] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [class_object4:protected] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - ) - - [no_member_class_object] => no_member_class Object - ( - ) - - [class_object5] => contains_object_class Object - *RECURSION* -) - --- Iteration 5 -- -object_class Object -( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 -) - -object_class Object -( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 -) - -object_class Object -( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 -) - --- Iteration 6 -- -object_class Object -( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 -) - -object_class Object -( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 -) - -object_class Object -( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 -) - --- Iteration 7 -- -no_member_class Object -( -) - -no_member_class Object -( -) - -no_member_class Object -( -) - --- Iteration 8 -- -object_class Object -( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 -) - -object_class Object -( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 -) - -object_class Object -( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 -) - --- Iteration 9 -- - - - -** Testing print_r() on objects having circular reference ** -object_class Object -( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - [obj] => object_class Object - ( - [value] => 50 - [public_var1] => 10 - [private_var1:object_class:private] => 20 - [private_var2:object_class:private] => 21 - [protected_var1:protected] => string_1 - [protected_var2:protected] => string_2 - [public_var2] => 11 - [obj] => object_class Object - *RECURSION* - ) - -) - -*** Testing print_r() on resources *** - --- Iteration 1 -- -Resource id #5 -Resource id #5 -Resource id #5 --- Iteration 2 -- -Resource id #6 -Resource id #6 -Resource id #6 -*** Testing print_r() on different combinations of scalar - and non-scalar variables *** - --- Iteration 1 -- -Array -( - [0] => 123 - [1] => -1.2345 - [2] => a -) - -Array -( - [0] => 123 - [1] => -1.2345 - [2] => a -) - -Array -( - [0] => 123 - [1] => -1.2345 - [2] => a -) - --- Iteration 2 -- -Array -( - [0] => d - [1] => Array - ( - [0] => 1 - [1] => 3 - [2] => 5 - ) - - [2] => 1 - [3] => -) - -Array -( - [0] => d - [1] => Array - ( - [0] => 1 - [1] => 3 - [2] => 5 - ) - - [2] => 1 - [3] => -) - -Array -( - [0] => d - [1] => Array - ( - [0] => 1 - [1] => 3 - [2] => 5 - ) - - [2] => 1 - [3] => -) - --- Iteration 3 -- -Array -( - [0] => no_member_class Object - ( - ) - - [1] => Array - ( - ) - - [2] => - [3] => 0 -) - -Array -( - [0] => no_member_class Object - ( - ) - - [1] => Array - ( - ) - - [2] => - [3] => 0 -) - -Array -( - [0] => no_member_class Object - ( - ) - - [1] => Array - ( - ) - - [2] => - [3] => 0 -) - --- Iteration 4 -- -Array -( - [0] => -0 - [1] => Where am I? - [2] => Array - ( - [0] => 7 - [1] => 8 - [2] => 9 - ) - - [3] => 1 - [4] => A - [5] => 987654321 -) - -Array -( - [0] => -0 - [1] => Where am I? - [2] => Array - ( - [0] => 7 - [1] => 8 - [2] => 9 - ) - - [3] => 1 - [4] => A - [5] => 987654321 -) - -Array -( - [0] => -0 - [1] => Where am I? - [2] => Array - ( - [0] => 7 - [1] => 8 - [2] => 9 - ) - - [3] => 1 - [4] => A - [5] => 987654321 -) - --- Iteration 5 -- -Array -( - [0] => - [1] => 20000000000 - [2] => 79.1 - [3] => 4.599998 -) - -Array -( - [0] => - [1] => 20000000000 - [2] => 79.1 - [3] => 4.599998 -) - -Array -( - [0] => - [1] => 20000000000 - [2] => 79.1 - [3] => 4.599998 -) - --- Iteration 6 -- -Array -( - [0] => array(1,2,3,4)1.0000002TRUE - [1] => - [2] => 4611333 - [3] => /00\7 -) - -Array -( - [0] => array(1,2,3,4)1.0000002TRUE - [1] => - [2] => 4611333 - [3] => /00\7 -) - -Array -( - [0] => array(1,2,3,4)1.0000002TRUE - [1] => - [2] => 4611333 - [3] => /00\7 -) - -*** Testing print_r() on miscellaneous input arguments *** - --- Iteration 1 -- - - - --- Iteration 2 -- - - - --- Iteration 3 -- - - - --- Iteration 4 -- - - -Done diff --git a/ext/standard/tests/general_functions/print_r_array_circular.phpt b/ext/standard/tests/general_functions/print_r_array_circular.phpt new file mode 100644 index 0000000000000..a8ee05d778853 --- /dev/null +++ b/ext/standard/tests/general_functions/print_r_array_circular.phpt @@ -0,0 +1,22 @@ +--TEST-- +Test print_r() function with circular array +--FILE-- + +--EXPECT-- +Array +( + [0] => Array + ( + [0] => Array + *RECURSION* + ) + +) diff --git a/ext/standard/tests/general_functions/print_r_arrays.phpt b/ext/standard/tests/general_functions/print_r_arrays.phpt new file mode 100644 index 0000000000000..edb4aee84291a --- /dev/null +++ b/ext/standard/tests/general_functions/print_r_arrays.phpt @@ -0,0 +1,166 @@ +--TEST-- +Test print_r() function with arrays +--INI-- +precision=14 +--FILE-- + 'One'], + ["test" => "is_array"], + [0], + [-1], + [10.5, 5.6], + ['string', 'test'], +]; + +foreach ($values as $value) { + print_r($value, false); + // $ret_string captures the output + $ret_string = print_r($value, true); + echo "\n$ret_string\n"; +} + +?> +--EXPECT-- +Array +( +) + +Array +( +) + +Array +( + [0] => 1 +) + +Array +( + [0] => 1 +) + +Array +( + [0] => Array + ( + ) + + [1] => Array + ( + ) + +) + +Array +( + [0] => Array + ( + ) + + [1] => Array + ( + ) + +) + +Array +( + [0] => Array + ( + [0] => 1 + [1] => 2 + ) + + [1] => Array + ( + [0] => a + [1] => b + ) + +) + +Array +( + [0] => Array + ( + [0] => 1 + [1] => 2 + ) + + [1] => Array + ( + [0] => a + [1] => b + ) + +) + +Array +( + [1] => One +) + +Array +( + [1] => One +) + +Array +( + [test] => is_array +) + +Array +( + [test] => is_array +) + +Array +( + [0] => 0 +) + +Array +( + [0] => 0 +) + +Array +( + [0] => -1 +) + +Array +( + [0] => -1 +) + +Array +( + [0] => 10.5 + [1] => 5.6 +) + +Array +( + [0] => 10.5 + [1] => 5.6 +) + +Array +( + [0] => string + [1] => test +) + +Array +( + [0] => string + [1] => test +) diff --git a/ext/standard/tests/general_functions/print_r_arrays_whitespace_sensitive.phpt b/ext/standard/tests/general_functions/print_r_arrays_whitespace_sensitive.phpt new file mode 100644 index 0000000000000..87137712064d1 --- /dev/null +++ b/ext/standard/tests/general_functions/print_r_arrays_whitespace_sensitive.phpt @@ -0,0 +1,50 @@ +--TEST-- +Test print_r() function with arrays, output has trailing whitespaces +--WHITESPACE_SENSITIVE-- +--FILE-- + null], + ['false' => false], + ['empty' => ''], +]; + +foreach ($values as $value) { + print_r($value, false); + // $ret_string captures the output + $ret_string = print_r($value, true); + echo "\n$ret_string\n"; +} + +?> +--EXPECT-- +Array +( + [null] => +) + +Array +( + [null] => +) + +Array +( + [false] => +) + +Array +( + [false] => +) + +Array +( + [empty] => +) + +Array +( + [empty] => +) diff --git a/ext/standard/tests/general_functions/print_r_bools.phpt b/ext/standard/tests/general_functions/print_r_bools.phpt new file mode 100644 index 0000000000000..f96060ac36eb0 --- /dev/null +++ b/ext/standard/tests/general_functions/print_r_bools.phpt @@ -0,0 +1,28 @@ +--TEST-- +Test print_r() function with booleans +--FILE-- + true, + 'false' => false, +]; + +foreach ($values as $key => $value) { + echo "$key:\n"; + print_r($value, false); + // $ret_string captures the output + $ret_string = print_r($value, true); + echo "\n$ret_string\n"; +} + +?> +DONE +--EXPECT-- +true: +1 +1 +false: + + +DONE diff --git a/ext/standard/tests/general_functions/print_r_floats.phpt b/ext/standard/tests/general_functions/print_r_floats.phpt new file mode 100644 index 0000000000000..5da055ce2cb7a --- /dev/null +++ b/ext/standard/tests/general_functions/print_r_floats.phpt @@ -0,0 +1,183 @@ +--TEST-- +Test print_r() function with floats +--INI-- +precision=14 +--FILE-- + +--EXPECT-- +-- Iteration 1 -- +-0 +-0 + +-- Iteration 2 -- +0 +0 + +-- Iteration 3 -- +1.234 +1.234 + +-- Iteration 4 -- +-1.234 +-1.234 + +-- Iteration 5 -- +-2 +-2 + +-- Iteration 6 -- +2 +2 + +-- Iteration 7 -- +-0.5 +-0.5 + +-- Iteration 8 -- +0.567 +0.567 + +-- Iteration 9 -- +-0.00067 +-0.00067 + +-- Iteration 10 -- +-670 +-670 + +-- Iteration 11 -- +670 +670 + +-- Iteration 12 -- +670 +670 + +-- Iteration 13 -- +-0.00410003 +-0.00410003 + +-- Iteration 14 -- +-4100.03 +-4100.03 + +-- Iteration 15 -- +0.004100003 +0.004100003 + +-- Iteration 16 -- +4100.003 +4100.003 + +-- Iteration 17 -- +100000 +100000 + +-- Iteration 18 -- +-100000 +-100000 + +-- Iteration 19 -- +1.0E-5 +1.0E-5 + +-- Iteration 20 -- +-1.0E-5 +-1.0E-5 + +-- Iteration 21 -- +100000 +100000 + +-- Iteration 22 -- +-100000 +-100000 + +-- Iteration 23 -- +100000 +100000 + +-- Iteration 24 -- +-100000 +-100000 + +-- Iteration 25 -- +100000 +100000 + +-- Iteration 26 -- +-100000 +-100000 + +-- Iteration 27 -- +1.0E-5 +1.0E-5 + +-- Iteration 28 -- +-1.0E-5 +-1.0E-5 + +-- Iteration 29 -- +-2147483649 +-2147483649 + +-- Iteration 30 -- +2147483649 +2147483649 + +-- Iteration 31 -- +2147483649 +2147483649 + +-- Iteration 32 -- +-2147483649 +-2147483649 diff --git a/ext/standard/tests/general_functions/print_r_ints.phpt b/ext/standard/tests/general_functions/print_r_ints.phpt new file mode 100644 index 0000000000000..ba1eb9d96be24 --- /dev/null +++ b/ext/standard/tests/general_functions/print_r_ints.phpt @@ -0,0 +1,131 @@ +--TEST-- +Test print_r() function with integers +--INI-- +precision=14 +--FILE-- + +--EXPECT-- +-- Iteration 1 -- +0 +0 + +-- Iteration 2 -- +83 +83 + +-- Iteration 3 -- +123000000 +123000000 + +-- Iteration 4 -- +-83 +-83 + +-- Iteration 5 -- +-12300000 +-12300000 + +-- Iteration 6 -- +Array +( + [0] => 1 + [1] => 2 + [2] => 3 + [3] => 4 + [4] => 5 + [5] => 6 + [6] => 7 + [7] => 8 + [8] => 9 + [9] => 10 +) + +Array +( + [0] => 1 + [1] => 2 + [2] => 3 + [3] => 4 + [4] => 5 + [5] => 6 + [6] => 7 + [7] => 8 + [8] => 9 + [9] => 10 +) + + +-- Iteration 7 -- +Array +( + [0] => -1 + [1] => -2 + [2] => -3 + [3] => -4 + [4] => -5 + [5] => -6 + [6] => -7 + [7] => -8 + [8] => -9 + [9] => -10 +) + +Array +( + [0] => -1 + [1] => -2 + [2] => -3 + [3] => -4 + [4] => -5 + [5] => -6 + [6] => -7 + [7] => -8 + [8] => -9 + [9] => -10 +) + + +-- Iteration 8 -- +2147483647 +2147483647 + +-- Iteration 9 -- +2147483648 +2147483648 + +-- Iteration 10 -- +-2147483648 +-2147483648 + +-- Iteration 11 -- +-2147483647 +-2147483647 diff --git a/ext/standard/tests/general_functions/print_r_ints_64bit.phpt b/ext/standard/tests/general_functions/print_r_ints_64bit.phpt new file mode 100644 index 0000000000000..f6f8a56d60782 --- /dev/null +++ b/ext/standard/tests/general_functions/print_r_ints_64bit.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test print_r() function with 64 bit integers +--INI-- +precision=14 +--SKIPIF-- + +--FILE-- + +--EXPECT-- +-- Iteration 1 -- +2147483647 +2147483647 +-- Iteration 2 -- +-2147483648 +-2147483648 +-- Iteration 3 -- +2147483647 +2147483647 +-- Iteration 4 -- +-2147483648 +-2147483648 diff --git a/ext/standard/tests/general_functions/print_r_null.phpt b/ext/standard/tests/general_functions/print_r_null.phpt new file mode 100644 index 0000000000000..14a31b1bd8d8d --- /dev/null +++ b/ext/standard/tests/general_functions/print_r_null.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test print_r() function with null +--FILE-- + +DONE +--EXPECT-- +null: + + +DONE diff --git a/ext/standard/tests/general_functions/print_r_object.phpt b/ext/standard/tests/general_functions/print_r_object.phpt new file mode 100644 index 0000000000000..3fe40bc22cfa0 --- /dev/null +++ b/ext/standard/tests/general_functions/print_r_object.phpt @@ -0,0 +1,228 @@ +--TEST-- +Test print_r() function +--FILE-- +value = 50; + $this->public_var2 = 11; + $this->private_var2 = 21; + $this->protected_var2 = "string_2"; + } + + public function foo1() { + echo "foo1() is called\n"; + } + protected function foo2() { + echo "foo2() is called\n"; + } + private function foo3() { + echo "foo3() is called\n"; + } +} + +class no_member_class {} + +/* class with member as object of other class */ +#[AllowDynamicProperties] +class contains_object_class +{ + var $p = 30; + var $class_object1; + public $class_object2; + private $class_object3; + protected $class_object4; + var $no_member_class_object; + + public function func() { + echo "func() is called \n"; + } + + function __construct() { + $this->class_object1 = new object_class(); + $this->class_object2 = new object_class(); + $this->class_object3 = $this->class_object1; + $this->class_object4 = $this->class_object2; + $this->no_member_class_object = new no_member_class(); + $this->class_object5 = $this; //recursive reference + } +} + +$objects = [ + new object_class, + new no_member_class, + new contains_object_class, +]; +check_printr($objects); + +?> +--EXPECT-- +*** Testing print_r() on object variables *** + +-- Iteration 1 -- +object_class Object +( + [value] => 50 + [public_var1] => 10 + [private_var1:object_class:private] => 20 + [private_var2:object_class:private] => 21 + [protected_var1:protected] => string_1 + [protected_var2:protected] => string_2 + [public_var2] => 11 +) + +object_class Object +( + [value] => 50 + [public_var1] => 10 + [private_var1:object_class:private] => 20 + [private_var2:object_class:private] => 21 + [protected_var1:protected] => string_1 + [protected_var2:protected] => string_2 + [public_var2] => 11 +) + + +-- Iteration 2 -- +no_member_class Object +( +) + +no_member_class Object +( +) + + +-- Iteration 3 -- +contains_object_class Object +( + [p] => 30 + [class_object1] => object_class Object + ( + [value] => 50 + [public_var1] => 10 + [private_var1:object_class:private] => 20 + [private_var2:object_class:private] => 21 + [protected_var1:protected] => string_1 + [protected_var2:protected] => string_2 + [public_var2] => 11 + ) + + [class_object2] => object_class Object + ( + [value] => 50 + [public_var1] => 10 + [private_var1:object_class:private] => 20 + [private_var2:object_class:private] => 21 + [protected_var1:protected] => string_1 + [protected_var2:protected] => string_2 + [public_var2] => 11 + ) + + [class_object3:contains_object_class:private] => object_class Object + ( + [value] => 50 + [public_var1] => 10 + [private_var1:object_class:private] => 20 + [private_var2:object_class:private] => 21 + [protected_var1:protected] => string_1 + [protected_var2:protected] => string_2 + [public_var2] => 11 + ) + + [class_object4:protected] => object_class Object + ( + [value] => 50 + [public_var1] => 10 + [private_var1:object_class:private] => 20 + [private_var2:object_class:private] => 21 + [protected_var1:protected] => string_1 + [protected_var2:protected] => string_2 + [public_var2] => 11 + ) + + [no_member_class_object] => no_member_class Object + ( + ) + + [class_object5] => contains_object_class Object + *RECURSION* +) + +contains_object_class Object +( + [p] => 30 + [class_object1] => object_class Object + ( + [value] => 50 + [public_var1] => 10 + [private_var1:object_class:private] => 20 + [private_var2:object_class:private] => 21 + [protected_var1:protected] => string_1 + [protected_var2:protected] => string_2 + [public_var2] => 11 + ) + + [class_object2] => object_class Object + ( + [value] => 50 + [public_var1] => 10 + [private_var1:object_class:private] => 20 + [private_var2:object_class:private] => 21 + [protected_var1:protected] => string_1 + [protected_var2:protected] => string_2 + [public_var2] => 11 + ) + + [class_object3:contains_object_class:private] => object_class Object + ( + [value] => 50 + [public_var1] => 10 + [private_var1:object_class:private] => 20 + [private_var2:object_class:private] => 21 + [protected_var1:protected] => string_1 + [protected_var2:protected] => string_2 + [public_var2] => 11 + ) + + [class_object4:protected] => object_class Object + ( + [value] => 50 + [public_var1] => 10 + [private_var1:object_class:private] => 20 + [private_var2:object_class:private] => 21 + [protected_var1:protected] => string_1 + [protected_var2:protected] => string_2 + [public_var2] => 11 + ) + + [no_member_class_object] => no_member_class Object + ( + ) + + [class_object5] => contains_object_class Object + *RECURSION* +) diff --git a/ext/standard/tests/general_functions/print_r_object_circular.phpt b/ext/standard/tests/general_functions/print_r_object_circular.phpt new file mode 100644 index 0000000000000..2930f341ae76c --- /dev/null +++ b/ext/standard/tests/general_functions/print_r_object_circular.phpt @@ -0,0 +1,26 @@ +--TEST-- +Test print_r() function function with circular objects +--FILE-- +obj = $recursion_obj2; +$recursion_obj2->obj = $recursion_obj1; +print_r($recursion_obj2); + +?> +--EXPECT-- +Circular Object +( + [obj] => Circular Object + ( + [obj] => Circular Object + *RECURSION* + ) + +) diff --git a/ext/standard/tests/general_functions/print_r_resources.phpt b/ext/standard/tests/general_functions/print_r_resources.phpt new file mode 100644 index 0000000000000..7a8ea357ac40a --- /dev/null +++ b/ext/standard/tests/general_functions/print_r_resources.phpt @@ -0,0 +1,23 @@ +--TEST-- +Test print_r() function with resources +--FILE-- + +--EXPECT-- +Resource id #1 +Resource id #1 +Resource id #3 +Resource id #3 diff --git a/ext/standard/tests/general_functions/print_r_strings.phpt b/ext/standard/tests/general_functions/print_r_strings.phpt new file mode 100644 index 0000000000000..b01737978cd39 --- /dev/null +++ b/ext/standard/tests/general_functions/print_r_strings.phpt @@ -0,0 +1,61 @@ +--TEST-- +Test print_r() function with strings +--WHITESPACE_SENSITIVE-- +--FILE-- + +--EXPECT-- +-- Iteration 1 -- + + +-- Iteration 2 -- + + +-- Iteration 3 -- +0 +0 +-- Iteration 4 -- +\0 +\0 +-- Iteration 5 -- + + +-- Iteration 6 -- +\t +\t +-- Iteration 7 -- +PHP +PHP +-- Iteration 8 -- +1234 +5678 + 9100"abcda +1234 +5678 + 9100"abcda diff --git a/ext/standard/tests/general_functions/print_r_strings_nul_bytes.phpt b/ext/standard/tests/general_functions/print_r_strings_nul_bytes.phpt new file mode 100644 index 0000000000000..626e88e613b10 Binary files /dev/null and b/ext/standard/tests/general_functions/print_r_strings_nul_bytes.phpt differ diff --git a/ext/standard/tests/general_functions/proc_open-mb0.phpt b/ext/standard/tests/general_functions/proc_open-mb0.phpt index 545f087574edb..90ad5533f8240 100644 --- a/ext/standard/tests/general_functions/proc_open-mb0.phpt +++ b/ext/standard/tests/general_functions/proc_open-mb0.phpt @@ -38,6 +38,10 @@ proc_close($p); echo $out; +?> +--CLEAN-- + --EXPECTF-- array(4) { diff --git a/ext/standard/tests/general_functions/proc_open-mb1.phpt b/ext/standard/tests/general_functions/proc_open-mb1.phpt index 057979e604c76..bb220a024804b 100644 --- a/ext/standard/tests/general_functions/proc_open-mb1.phpt +++ b/ext/standard/tests/general_functions/proc_open-mb1.phpt @@ -35,6 +35,10 @@ proc_close($p); echo $out; +?> +--CLEAN-- + --EXPECTF-- array(4) { diff --git a/ext/standard/tests/general_functions/var_dump.phpt b/ext/standard/tests/general_functions/var_dump.phpt deleted file mode 100644 index 0cbd1fce9c66c..0000000000000 --- a/ext/standard/tests/general_functions/var_dump.phpt +++ /dev/null @@ -1,1549 +0,0 @@ ---TEST-- -Test var_dump() function ---SKIPIF-- - ---INI-- -precision=14 ---FILE-- - 'One'), - array("test" => "is_array"), - array(0), - array(-1), - array(10.5, 5.6), - array("string", "test"), - array('string', 'test'), -); -/* calling check_vardump() to display contents of an array - using var_dump() */ -check_vardump($arrays); - -echo "\n*** Testing var_dump() on object variables ***\n"; -#[AllowDynamicProperties] -class object_class -{ - var $value; - public $public_var1 = 10; - private $private_var1 = 20; - private $private_var2; - protected $protected_var1 = "string_1"; - protected $protected_var2; - - function __construct() { - $this->value = 50; - $this->public_var2 = 11; - $this->private_var2 = 21; - $this->protected_var2 = "string_2"; - } - - public function foo1() { - echo "foo1() is called\n"; - } - protected function foo2() { - echo "foo2() is called\n"; - } - private function foo3() { - echo "foo3() is called\n"; - } -} -/* class with no member */ -class no_member_class { - // no members -} - -/* class with member as object of other class */ -#[AllowDynamicProperties] -class contains_object_class -{ - var $p = 30; - var $class_object1; - public $class_object2; - private $class_object3; - protected $class_object4; - var $no_member_class_object; - - public function func() { - echo "func() is called \n"; - } - - function __construct() { - $this->class_object1 = new object_class(); - $this->class_object2 = new object_class(); - $this->class_object3 = $this->class_object1; - $this->class_object4 = $this->class_object2; - $this->no_member_class_object = new no_member_class(); - $this->class_object5 = $this; //recursive reference - } -} - -/* objects of different classes */ -$obj = new contains_object_class; -$temp_class_obj = new object_class(); - -/* object which is unset */ -$unset_obj = new object_class(); -unset($unset_obj); - -$objects = array ( - new object_class, - new no_member_class, - new contains_object_class, - $obj, - $obj->class_object1, - $obj->class_object2, - $obj->no_member_class_object, - $temp_class_obj, - @$unset_obj -); -/* calling check_vardump() to display contents of the objects - using var_dump() */ -check_vardump($objects); - -echo "\n** Testing var_dump() on objects having circular reference **\n"; -$recursion_obj1 = new object_class(); -$recursion_obj2 = new object_class(); -$recursion_obj1->obj = &$recursion_obj2; //circular reference -$recursion_obj2->obj = &$recursion_obj1; //circular reference -var_dump($recursion_obj2); - -echo "\n*** Testing var_dump() on resources ***\n"; -/* file type resource */ -$file_handle = fopen(__FILE__, "r"); - -/* directory type resource */ -$dir_handle = opendir( __DIR__ ); - -$resources = array ( - $file_handle, - $dir_handle -); -/* calling check_vardump() to display the resource content type - using var_dump() */ -check_vardump($resources); - -echo "\n*** Testing var_dump() on different combinations of scalar - and non-scalar variables ***\n"; -/* a variable which is unset */ -$unset_var = 10.5; -unset($unset_var); - -/* unset file type resource */ -unset($file_handle); - -$variations = array ( - array( 123, -1.2345, "a" ), - array( "d", array(1, 3, 5), true, null), - array( new no_member_class, array(), false, 0 ), - array( -0.00, "Where am I?", array(7,8,9), TRUE, 'A', 987654321 ), - array( @$unset_var, 2.E+10, 100-20.9, 000004.599998 ), //unusual data - array( "array(1,2,3,4)1.0000002TRUE", @$file_handle, 111333.00+45e5, '/00\7') -); -/* calling check_vardump() to display combinations of scalar and - non-scalar variables using var_dump() */ -check_vardump($variations); - -echo "\n*** Testing var_dump() on miscellaneous input arguments ***\n"; -$misc_values = array ( - @$unset_var, - NULL, // NULL argument - @$undef_variable, //undefined variable - null -); -/* calling check_vardump() to display miscellaneous data using var_dump() */ -check_vardump($misc_values); - -echo "\n*** Testing var_dump() on multiple arguments ***\n"; -var_dump( $integers, $floats, $strings, $arrays, $booleans, $resources, - $objects, $misc_values, $variations ); - -/* closing resource handle used */ -closedir($dir_handle); - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing var_dump() on integer variables *** --- Iteration 1 -- -int(0) --- Iteration 2 -- -int(83) --- Iteration 3 -- -int(123000000) --- Iteration 4 -- -int(-83) --- Iteration 5 -- -int(-12300000) --- Iteration 6 -- -array(10) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) - [3]=> - int(4) - [4]=> - int(5) - [5]=> - int(6) - [6]=> - int(7) - [7]=> - int(8) - [8]=> - int(9) - [9]=> - int(10) -} --- Iteration 7 -- -array(10) { - [0]=> - int(-1) - [1]=> - int(-2) - [2]=> - int(-3) - [3]=> - int(-4) - [4]=> - int(-5) - [5]=> - int(-6) - [6]=> - int(-7) - [7]=> - int(-8) - [8]=> - int(-9) - [9]=> - int(-10) -} --- Iteration 8 -- -int(2147483647) --- Iteration 9 -- -float(2147483648) --- Iteration 10 -- -float(-2147483648) --- Iteration 11 -- -int(-2147483647) --- Iteration 12 -- -int(2147483647) --- Iteration 13 -- -float(-2147483648) --- Iteration 14 -- -int(2147483647) --- Iteration 15 -- -float(-2147483648) - -*** Testing var_dump() on float variables *** --- Iteration 1 -- -float(-0) --- Iteration 2 -- -float(0) --- Iteration 3 -- -float(1.234) --- Iteration 4 -- -float(-1.234) --- Iteration 5 -- -float(-2) --- Iteration 6 -- -float(2) --- Iteration 7 -- -float(-0.5) --- Iteration 8 -- -float(0.567) --- Iteration 9 -- -float(-0.00067) --- Iteration 10 -- -float(-670) --- Iteration 11 -- -float(670) --- Iteration 12 -- -float(670) --- Iteration 13 -- -float(-0.00410003) --- Iteration 14 -- -float(-4100.03) --- Iteration 15 -- -float(0.004100003) --- Iteration 16 -- -float(4100.003) --- Iteration 17 -- -float(100000) --- Iteration 18 -- -float(-100000) --- Iteration 19 -- -float(1.0E-5) --- Iteration 20 -- -float(-1.0E-5) --- Iteration 21 -- -float(100000) --- Iteration 22 -- -float(-100000) --- Iteration 23 -- -float(100000) --- Iteration 24 -- -float(-100000) --- Iteration 25 -- -float(100000) --- Iteration 26 -- -float(-100000) --- Iteration 27 -- -float(1.0E-5) --- Iteration 28 -- -float(-1.0E-5) --- Iteration 29 -- -float(-2147483649) --- Iteration 30 -- -float(2147483649) --- Iteration 31 -- -float(2147483649) --- Iteration 32 -- -float(-2147483649) - -*** Testing var_dump() on string variables *** --- Iteration 1 -- -string(0) "" --- Iteration 2 -- -string(0) "" --- Iteration 3 -- -string(1) " " --- Iteration 4 -- -string(1) " " --- Iteration 5 -- -string(1) "0" --- Iteration 6 -- -string(1) "%0" --- Iteration 7 -- -string(2) "\0" --- Iteration 8 -- -string(1) " " --- Iteration 9 -- -string(2) "\t" --- Iteration 10 -- -string(3) "PHP" --- Iteration 11 -- -string(3) "PHP" --- Iteration 12 -- -string(29) "abcd%0n1234%005678%000efgh\xijkl" --- Iteration 13 -- -string(34) "abcd%0efgh%0ijkl%0mnop%00qrst%0uvwx%00yz" --- Iteration 14 -- -string(22) "1234 -5678 - 9100"abcda" - -*** Testing var_dump() on boolean variables *** --- Iteration 1 -- -bool(true) --- Iteration 2 -- -bool(false) --- Iteration 3 -- -bool(true) --- Iteration 4 -- -bool(false) - -*** Testing var_dump() on array variables *** --- Iteration 1 -- -array(0) { -} --- Iteration 2 -- -array(1) { - [0]=> - NULL -} --- Iteration 3 -- -array(1) { - [0]=> - NULL -} --- Iteration 4 -- -array(1) { - [0]=> - bool(true) -} --- Iteration 5 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 6 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 7 -- -array(2) { - [0]=> - array(0) { - } - [1]=> - array(0) { - } -} --- Iteration 8 -- -array(2) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } - [1]=> - array(2) { - [0]=> - string(1) "a" - [1]=> - string(1) "b" - } -} --- Iteration 9 -- -array(1) { - [1]=> - string(3) "One" -} --- Iteration 10 -- -array(1) { - ["test"]=> - string(8) "is_array" -} --- Iteration 11 -- -array(1) { - [0]=> - int(0) -} --- Iteration 12 -- -array(1) { - [0]=> - int(-1) -} --- Iteration 13 -- -array(2) { - [0]=> - float(10.5) - [1]=> - float(5.6) -} --- Iteration 14 -- -array(2) { - [0]=> - string(6) "string" - [1]=> - string(4) "test" -} --- Iteration 15 -- -array(2) { - [0]=> - string(6) "string" - [1]=> - string(4) "test" -} - -*** Testing var_dump() on object variables *** --- Iteration 1 -- -object(object_class)#6 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) -} --- Iteration 2 -- -object(no_member_class)#7 (0) { -} --- Iteration 3 -- -object(contains_object_class)#8 (7) { - ["p"]=> - int(30) - ["class_object1"]=> - object(object_class)#9 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object2"]=> - object(object_class)#10 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object3":"contains_object_class":private]=> - object(object_class)#9 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object4":protected]=> - object(object_class)#10 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["no_member_class_object"]=> - object(no_member_class)#11 (0) { - } - ["class_object5"]=> - *RECURSION* -} --- Iteration 4 -- -object(contains_object_class)#1 (7) { - ["p"]=> - int(30) - ["class_object1"]=> - object(object_class)#2 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object2"]=> - object(object_class)#3 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object3":"contains_object_class":private]=> - object(object_class)#2 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object4":protected]=> - object(object_class)#3 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["no_member_class_object"]=> - object(no_member_class)#4 (0) { - } - ["class_object5"]=> - *RECURSION* -} --- Iteration 5 -- -object(object_class)#2 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) -} --- Iteration 6 -- -object(object_class)#3 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) -} --- Iteration 7 -- -object(no_member_class)#4 (0) { -} --- Iteration 8 -- -object(object_class)#5 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) -} --- Iteration 9 -- -NULL - -** Testing var_dump() on objects having circular reference ** -object(object_class)#13 (8) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - ["obj"]=> - &object(object_class)#12 (8) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - ["obj"]=> - *RECURSION* - } -} - -*** Testing var_dump() on resources *** --- Iteration 1 -- -resource(%d) of type (stream) --- Iteration 2 -- -resource(%d) of type (stream) - -*** Testing var_dump() on different combinations of scalar - and non-scalar variables *** --- Iteration 1 -- -array(3) { - [0]=> - int(123) - [1]=> - float(-1.2345) - [2]=> - string(1) "a" -} --- Iteration 2 -- -array(4) { - [0]=> - string(1) "d" - [1]=> - array(3) { - [0]=> - int(1) - [1]=> - int(3) - [2]=> - int(5) - } - [2]=> - bool(true) - [3]=> - NULL -} --- Iteration 3 -- -array(4) { - [0]=> - object(no_member_class)#14 (0) { - } - [1]=> - array(0) { - } - [2]=> - bool(false) - [3]=> - int(0) -} --- Iteration 4 -- -array(6) { - [0]=> - float(-0) - [1]=> - string(11) "Where am I?" - [2]=> - array(3) { - [0]=> - int(7) - [1]=> - int(8) - [2]=> - int(9) - } - [3]=> - bool(true) - [4]=> - string(1) "A" - [5]=> - int(987654321) -} --- Iteration 5 -- -array(4) { - [0]=> - NULL - [1]=> - float(20000000000) - [2]=> - float(79.1) - [3]=> - float(4.599998) -} --- Iteration 6 -- -array(4) { - [0]=> - string(27) "array(1,2,3,4)1.0000002TRUE" - [1]=> - NULL - [2]=> - float(4611333) - [3]=> - string(5) "/00\7" -} - -*** Testing var_dump() on miscellaneous input arguments *** --- Iteration 1 -- -NULL --- Iteration 2 -- -NULL --- Iteration 3 -- -NULL --- Iteration 4 -- -NULL - -*** Testing var_dump() on multiple arguments *** -array(15) { - [0]=> - int(0) - [1]=> - int(83) - [2]=> - int(123000000) - [3]=> - int(-83) - [4]=> - int(-12300000) - [5]=> - array(10) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) - [3]=> - int(4) - [4]=> - int(5) - [5]=> - int(6) - [6]=> - int(7) - [7]=> - int(8) - [8]=> - int(9) - [9]=> - int(10) - } - [6]=> - array(10) { - [0]=> - int(-1) - [1]=> - int(-2) - [2]=> - int(-3) - [3]=> - int(-4) - [4]=> - int(-5) - [5]=> - int(-6) - [6]=> - int(-7) - [7]=> - int(-8) - [8]=> - int(-9) - [9]=> - int(-10) - } - [7]=> - int(2147483647) - [8]=> - float(2147483648) - [9]=> - float(-2147483648) - [10]=> - int(-2147483647) - [11]=> - int(2147483647) - [12]=> - float(-2147483648) - [13]=> - int(2147483647) - [14]=> - float(-2147483648) -} -array(32) { - [0]=> - float(-0) - [1]=> - float(0) - [2]=> - float(1.234) - [3]=> - float(-1.234) - [4]=> - float(-2) - [5]=> - float(2) - [6]=> - float(-0.5) - [7]=> - float(0.567) - [8]=> - float(-0.00067) - [9]=> - float(-670) - [10]=> - float(670) - [11]=> - float(670) - [12]=> - float(-0.00410003) - [13]=> - float(-4100.03) - [14]=> - float(0.004100003) - [15]=> - float(4100.003) - [16]=> - float(100000) - [17]=> - float(-100000) - [18]=> - float(1.0E-5) - [19]=> - float(-1.0E-5) - [20]=> - float(100000) - [21]=> - float(-100000) - [22]=> - float(100000) - [23]=> - float(-100000) - [24]=> - float(100000) - [25]=> - float(-100000) - [26]=> - float(1.0E-5) - [27]=> - float(-1.0E-5) - [28]=> - float(-2147483649) - [29]=> - float(2147483649) - [30]=> - float(2147483649) - [31]=> - float(-2147483649) -} -array(14) { - [0]=> - string(0) "" - [1]=> - string(0) "" - [2]=> - string(1) " " - [3]=> - string(1) " " - [4]=> - string(1) "0" - [5]=> - string(1) "%0" - [6]=> - string(2) "\0" - [7]=> - string(1) " " - [8]=> - string(2) "\t" - [9]=> - string(3) "PHP" - [10]=> - string(3) "PHP" - [11]=> - string(29) "abcd%0n1234%005678%000efgh\xijkl" - [12]=> - string(34) "abcd%0efgh%0ijkl%0mnop%00qrst%0uvwx%00yz" - [13]=> - string(22) "1234 -5678 - 9100"abcda" -} -array(15) { - [0]=> - array(0) { - } - [1]=> - array(1) { - [0]=> - NULL - } - [2]=> - array(1) { - [0]=> - NULL - } - [3]=> - array(1) { - [0]=> - bool(true) - } - [4]=> - array(1) { - [0]=> - string(0) "" - } - [5]=> - array(1) { - [0]=> - string(0) "" - } - [6]=> - array(2) { - [0]=> - array(0) { - } - [1]=> - array(0) { - } - } - [7]=> - array(2) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } - [1]=> - array(2) { - [0]=> - string(1) "a" - [1]=> - string(1) "b" - } - } - [8]=> - array(1) { - [1]=> - string(3) "One" - } - [9]=> - array(1) { - ["test"]=> - string(8) "is_array" - } - [10]=> - array(1) { - [0]=> - int(0) - } - [11]=> - array(1) { - [0]=> - int(-1) - } - [12]=> - array(2) { - [0]=> - float(10.5) - [1]=> - float(5.6) - } - [13]=> - array(2) { - [0]=> - string(6) "string" - [1]=> - string(4) "test" - } - [14]=> - array(2) { - [0]=> - string(6) "string" - [1]=> - string(4) "test" - } -} -array(4) { - [0]=> - bool(true) - [1]=> - bool(false) - [2]=> - bool(true) - [3]=> - bool(false) -} -array(2) { - [0]=> - resource(%d) of type (stream) - [1]=> - resource(%d) of type (stream) -} -array(9) { - [0]=> - object(object_class)#6 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - [1]=> - object(no_member_class)#7 (0) { - } - [2]=> - object(contains_object_class)#8 (7) { - ["p"]=> - int(30) - ["class_object1"]=> - object(object_class)#9 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object2"]=> - object(object_class)#10 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object3":"contains_object_class":private]=> - object(object_class)#9 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object4":protected]=> - object(object_class)#10 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["no_member_class_object"]=> - object(no_member_class)#11 (0) { - } - ["class_object5"]=> - *RECURSION* - } - [3]=> - object(contains_object_class)#1 (7) { - ["p"]=> - int(30) - ["class_object1"]=> - object(object_class)#2 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object2"]=> - object(object_class)#3 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object3":"contains_object_class":private]=> - object(object_class)#2 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object4":protected]=> - object(object_class)#3 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["no_member_class_object"]=> - object(no_member_class)#4 (0) { - } - ["class_object5"]=> - *RECURSION* - } - [4]=> - object(object_class)#2 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - [5]=> - object(object_class)#3 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - [6]=> - object(no_member_class)#4 (0) { - } - [7]=> - object(object_class)#5 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - [8]=> - NULL -} -array(4) { - [0]=> - NULL - [1]=> - NULL - [2]=> - NULL - [3]=> - NULL -} -array(6) { - [0]=> - array(3) { - [0]=> - int(123) - [1]=> - float(-1.2345) - [2]=> - string(1) "a" - } - [1]=> - array(4) { - [0]=> - string(1) "d" - [1]=> - array(3) { - [0]=> - int(1) - [1]=> - int(3) - [2]=> - int(5) - } - [2]=> - bool(true) - [3]=> - NULL - } - [2]=> - array(4) { - [0]=> - object(no_member_class)#14 (0) { - } - [1]=> - array(0) { - } - [2]=> - bool(false) - [3]=> - int(0) - } - [3]=> - array(6) { - [0]=> - float(-0) - [1]=> - string(11) "Where am I?" - [2]=> - array(3) { - [0]=> - int(7) - [1]=> - int(8) - [2]=> - int(9) - } - [3]=> - bool(true) - [4]=> - string(1) "A" - [5]=> - int(987654321) - } - [4]=> - array(4) { - [0]=> - NULL - [1]=> - float(20000000000) - [2]=> - float(79.1) - [3]=> - float(4.599998) - } - [5]=> - array(4) { - [0]=> - string(27) "array(1,2,3,4)1.0000002TRUE" - [1]=> - NULL - [2]=> - float(4611333) - [3]=> - string(5) "/00\7" - } -} -Done diff --git a/ext/standard/tests/general_functions/var_dump_64bit.phpt b/ext/standard/tests/general_functions/var_dump_64bit.phpt deleted file mode 100644 index cbf9c003bdb92..0000000000000 --- a/ext/standard/tests/general_functions/var_dump_64bit.phpt +++ /dev/null @@ -1,1549 +0,0 @@ ---TEST-- -Test var_dump() function ---SKIPIF-- - ---INI-- -precision=14 ---FILE-- - 'One'), - array("test" => "is_array"), - array(0), - array(-1), - array(10.5, 5.6), - array("string", "test"), - array('string', 'test'), -); -/* calling check_vardump() to display contents of an array - using var_dump() */ -check_vardump($arrays); - -echo "\n*** Testing var_dump() on object variables ***\n"; -#[AllowDynamicProperties] -class object_class -{ - var $value; - public $public_var1 = 10; - private $private_var1 = 20; - private $private_var2; - protected $protected_var1 = "string_1"; - protected $protected_var2; - - function __construct ( ) { - $this->value = 50; - $this->public_var2 = 11; - $this->private_var2 = 21; - $this->protected_var2 = "string_2"; - } - - public function foo1() { - echo "foo1() is called\n"; - } - protected function foo2() { - echo "foo2() is called\n"; - } - private function foo3() { - echo "foo3() is called\n"; - } -} -/* class with no member */ -class no_member_class { - // no members -} - -/* class with member as object of other class */ -#[AllowDynamicProperties] -class contains_object_class -{ - var $p = 30; - var $class_object1; - public $class_object2; - private $class_object3; - protected $class_object4; - var $no_member_class_object; - - public function func() { - echo "func() is called \n"; - } - - function __construct () { - $this->class_object1 = new object_class(); - $this->class_object2 = new object_class(); - $this->class_object3 = $this->class_object1; - $this->class_object4 = $this->class_object2; - $this->no_member_class_object = new no_member_class(); - $this->class_object5 = $this; //recursive reference - } -} - -/* objects of different classes */ -$obj = new contains_object_class; -$temp_class_obj = new object_class(); - -/* object which is unset */ -$unset_obj = new object_class(); -unset($unset_obj); - -$objects = array ( - new object_class, - new no_member_class, - new contains_object_class, - $obj, - $obj->class_object1, - $obj->class_object2, - $obj->no_member_class_object, - $temp_class_obj, - @$unset_obj -); -/* calling check_vardump() to display contents of the objects - using var_dump() */ -check_vardump($objects); - -echo "\n** Testing var_dump() on objects having circular reference **\n"; -$recursion_obj1 = new object_class(); -$recursion_obj2 = new object_class(); -$recursion_obj1->obj = &$recursion_obj2; //circular reference -$recursion_obj2->obj = &$recursion_obj1; //circular reference -var_dump($recursion_obj2); - -echo "\n*** Testing var_dump() on resources ***\n"; -/* file type resource */ -$file_handle = fopen(__FILE__, "r"); - -/* directory type resource */ -$dir_handle = opendir( __DIR__ ); - -$resources = array ( - $file_handle, - $dir_handle -); -/* calling check_vardump() to display the resource content type - using var_dump() */ -check_vardump($resources); - -echo "\n*** Testing var_dump() on different combinations of scalar - and non-scalar variables ***\n"; -/* a variable which is unset */ -$unset_var = 10.5; -unset($unset_var); - -/* unset file type resource */ -unset($file_handle); - -$variations = array ( - array( 123, -1.2345, "a" ), - array( "d", array(1, 3, 5), true, null), - array( new no_member_class, array(), false, 0 ), - array( -0.00, "Where am I?", array(7,8,9), TRUE, 'A', 987654321 ), - array( @$unset_var, 2.E+10, 100-20.9, 000004.599998 ), //unusual data - array( "array(1,2,3,4)1.0000002TRUE", @$file_handle, 111333.00+45e5, '/00\7') -); -/* calling check_vardump() to display combinations of scalar and - non-scalar variables using var_dump() */ -check_vardump($variations); - -echo "\n*** Testing var_dump() on miscellaneous input arguments ***\n"; -$misc_values = array ( - @$unset_var, - NULL, // NULL argument - @$undef_variable, //undefined variable - null -); -/* calling check_vardump() to display miscellaneous data using var_dump() */ -check_vardump($misc_values); - -echo "\n*** Testing var_dump() on multiple arguments ***\n"; -var_dump( $integers, $floats, $strings, $arrays, $booleans, $resources, - $objects, $misc_values, $variations ); - -/* closing resource handle used */ -closedir($dir_handle); - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing var_dump() on integer variables *** --- Iteration 1 -- -int(0) --- Iteration 2 -- -int(83) --- Iteration 3 -- -int(123000000) --- Iteration 4 -- -int(-83) --- Iteration 5 -- -int(-12300000) --- Iteration 6 -- -array(10) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) - [3]=> - int(4) - [4]=> - int(5) - [5]=> - int(6) - [6]=> - int(7) - [7]=> - int(8) - [8]=> - int(9) - [9]=> - int(10) -} --- Iteration 7 -- -array(10) { - [0]=> - int(-1) - [1]=> - int(-2) - [2]=> - int(-3) - [3]=> - int(-4) - [4]=> - int(-5) - [5]=> - int(-6) - [6]=> - int(-7) - [7]=> - int(-8) - [8]=> - int(-9) - [9]=> - int(-10) -} --- Iteration 8 -- -int(2147483647) --- Iteration 9 -- -int(2147483648) --- Iteration 10 -- -int(-2147483648) --- Iteration 11 -- -int(-2147483647) --- Iteration 12 -- -int(2147483647) --- Iteration 13 -- -int(-2147483648) --- Iteration 14 -- -int(2147483647) --- Iteration 15 -- -int(-2147483648) - -*** Testing var_dump() on float variables *** --- Iteration 1 -- -float(-0) --- Iteration 2 -- -float(0) --- Iteration 3 -- -float(1.234) --- Iteration 4 -- -float(-1.234) --- Iteration 5 -- -float(-2) --- Iteration 6 -- -float(2) --- Iteration 7 -- -float(-0.5) --- Iteration 8 -- -float(0.567) --- Iteration 9 -- -float(-0.00067) --- Iteration 10 -- -float(-670) --- Iteration 11 -- -float(670) --- Iteration 12 -- -float(670) --- Iteration 13 -- -float(-0.00410003) --- Iteration 14 -- -float(-4100.03) --- Iteration 15 -- -float(0.004100003) --- Iteration 16 -- -float(4100.003) --- Iteration 17 -- -float(100000) --- Iteration 18 -- -float(-100000) --- Iteration 19 -- -float(1.0E-5) --- Iteration 20 -- -float(-1.0E-5) --- Iteration 21 -- -float(100000) --- Iteration 22 -- -float(-100000) --- Iteration 23 -- -float(100000) --- Iteration 24 -- -float(-100000) --- Iteration 25 -- -float(100000) --- Iteration 26 -- -float(-100000) --- Iteration 27 -- -float(1.0E-5) --- Iteration 28 -- -float(-1.0E-5) --- Iteration 29 -- -int(-2147483649) --- Iteration 30 -- -int(2147483649) --- Iteration 31 -- -int(2147483649) --- Iteration 32 -- -int(-2147483649) - -*** Testing var_dump() on string variables *** --- Iteration 1 -- -string(0) "" --- Iteration 2 -- -string(0) "" --- Iteration 3 -- -string(1) " " --- Iteration 4 -- -string(1) " " --- Iteration 5 -- -string(1) "0" --- Iteration 6 -- -string(1) "%0" --- Iteration 7 -- -string(2) "\0" --- Iteration 8 -- -string(1) " " --- Iteration 9 -- -string(2) "\t" --- Iteration 10 -- -string(3) "PHP" --- Iteration 11 -- -string(3) "PHP" --- Iteration 12 -- -string(29) "abcd%0n1234%005678%000efgh\xijkl" --- Iteration 13 -- -string(34) "abcd%0efgh%0ijkl%0mnop%00qrst%0uvwx%00yz" --- Iteration 14 -- -string(22) "1234 -5678 - 9100"abcda" - -*** Testing var_dump() on boolean variables *** --- Iteration 1 -- -bool(true) --- Iteration 2 -- -bool(false) --- Iteration 3 -- -bool(true) --- Iteration 4 -- -bool(false) - -*** Testing var_dump() on array variables *** --- Iteration 1 -- -array(0) { -} --- Iteration 2 -- -array(1) { - [0]=> - NULL -} --- Iteration 3 -- -array(1) { - [0]=> - NULL -} --- Iteration 4 -- -array(1) { - [0]=> - bool(true) -} --- Iteration 5 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 6 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 7 -- -array(2) { - [0]=> - array(0) { - } - [1]=> - array(0) { - } -} --- Iteration 8 -- -array(2) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } - [1]=> - array(2) { - [0]=> - string(1) "a" - [1]=> - string(1) "b" - } -} --- Iteration 9 -- -array(1) { - [1]=> - string(3) "One" -} --- Iteration 10 -- -array(1) { - ["test"]=> - string(8) "is_array" -} --- Iteration 11 -- -array(1) { - [0]=> - int(0) -} --- Iteration 12 -- -array(1) { - [0]=> - int(-1) -} --- Iteration 13 -- -array(2) { - [0]=> - float(10.5) - [1]=> - float(5.6) -} --- Iteration 14 -- -array(2) { - [0]=> - string(6) "string" - [1]=> - string(4) "test" -} --- Iteration 15 -- -array(2) { - [0]=> - string(6) "string" - [1]=> - string(4) "test" -} - -*** Testing var_dump() on object variables *** --- Iteration 1 -- -object(object_class)#6 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) -} --- Iteration 2 -- -object(no_member_class)#7 (0) { -} --- Iteration 3 -- -object(contains_object_class)#8 (7) { - ["p"]=> - int(30) - ["class_object1"]=> - object(object_class)#9 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object2"]=> - object(object_class)#10 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object3":"contains_object_class":private]=> - object(object_class)#9 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object4":protected]=> - object(object_class)#10 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["no_member_class_object"]=> - object(no_member_class)#11 (0) { - } - ["class_object5"]=> - *RECURSION* -} --- Iteration 4 -- -object(contains_object_class)#1 (7) { - ["p"]=> - int(30) - ["class_object1"]=> - object(object_class)#2 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object2"]=> - object(object_class)#3 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object3":"contains_object_class":private]=> - object(object_class)#2 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object4":protected]=> - object(object_class)#3 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["no_member_class_object"]=> - object(no_member_class)#4 (0) { - } - ["class_object5"]=> - *RECURSION* -} --- Iteration 5 -- -object(object_class)#2 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) -} --- Iteration 6 -- -object(object_class)#3 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) -} --- Iteration 7 -- -object(no_member_class)#4 (0) { -} --- Iteration 8 -- -object(object_class)#5 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) -} --- Iteration 9 -- -NULL - -** Testing var_dump() on objects having circular reference ** -object(object_class)#13 (8) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - ["obj"]=> - &object(object_class)#12 (8) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - ["obj"]=> - *RECURSION* - } -} - -*** Testing var_dump() on resources *** --- Iteration 1 -- -resource(5) of type (stream) --- Iteration 2 -- -resource(6) of type (stream) - -*** Testing var_dump() on different combinations of scalar - and non-scalar variables *** --- Iteration 1 -- -array(3) { - [0]=> - int(123) - [1]=> - float(-1.2345) - [2]=> - string(1) "a" -} --- Iteration 2 -- -array(4) { - [0]=> - string(1) "d" - [1]=> - array(3) { - [0]=> - int(1) - [1]=> - int(3) - [2]=> - int(5) - } - [2]=> - bool(true) - [3]=> - NULL -} --- Iteration 3 -- -array(4) { - [0]=> - object(no_member_class)#14 (0) { - } - [1]=> - array(0) { - } - [2]=> - bool(false) - [3]=> - int(0) -} --- Iteration 4 -- -array(6) { - [0]=> - float(-0) - [1]=> - string(11) "Where am I?" - [2]=> - array(3) { - [0]=> - int(7) - [1]=> - int(8) - [2]=> - int(9) - } - [3]=> - bool(true) - [4]=> - string(1) "A" - [5]=> - int(987654321) -} --- Iteration 5 -- -array(4) { - [0]=> - NULL - [1]=> - float(20000000000) - [2]=> - float(79.1) - [3]=> - float(4.599998) -} --- Iteration 6 -- -array(4) { - [0]=> - string(27) "array(1,2,3,4)1.0000002TRUE" - [1]=> - NULL - [2]=> - float(4611333) - [3]=> - string(5) "/00\7" -} - -*** Testing var_dump() on miscellaneous input arguments *** --- Iteration 1 -- -NULL --- Iteration 2 -- -NULL --- Iteration 3 -- -NULL --- Iteration 4 -- -NULL - -*** Testing var_dump() on multiple arguments *** -array(15) { - [0]=> - int(0) - [1]=> - int(83) - [2]=> - int(123000000) - [3]=> - int(-83) - [4]=> - int(-12300000) - [5]=> - array(10) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) - [3]=> - int(4) - [4]=> - int(5) - [5]=> - int(6) - [6]=> - int(7) - [7]=> - int(8) - [8]=> - int(9) - [9]=> - int(10) - } - [6]=> - array(10) { - [0]=> - int(-1) - [1]=> - int(-2) - [2]=> - int(-3) - [3]=> - int(-4) - [4]=> - int(-5) - [5]=> - int(-6) - [6]=> - int(-7) - [7]=> - int(-8) - [8]=> - int(-9) - [9]=> - int(-10) - } - [7]=> - int(2147483647) - [8]=> - int(2147483648) - [9]=> - int(-2147483648) - [10]=> - int(-2147483647) - [11]=> - int(2147483647) - [12]=> - int(-2147483648) - [13]=> - int(2147483647) - [14]=> - int(-2147483648) -} -array(32) { - [0]=> - float(-0) - [1]=> - float(0) - [2]=> - float(1.234) - [3]=> - float(-1.234) - [4]=> - float(-2) - [5]=> - float(2) - [6]=> - float(-0.5) - [7]=> - float(0.567) - [8]=> - float(-0.00067) - [9]=> - float(-670) - [10]=> - float(670) - [11]=> - float(670) - [12]=> - float(-0.00410003) - [13]=> - float(-4100.03) - [14]=> - float(0.004100003) - [15]=> - float(4100.003) - [16]=> - float(100000) - [17]=> - float(-100000) - [18]=> - float(1.0E-5) - [19]=> - float(-1.0E-5) - [20]=> - float(100000) - [21]=> - float(-100000) - [22]=> - float(100000) - [23]=> - float(-100000) - [24]=> - float(100000) - [25]=> - float(-100000) - [26]=> - float(1.0E-5) - [27]=> - float(-1.0E-5) - [28]=> - int(-2147483649) - [29]=> - int(2147483649) - [30]=> - int(2147483649) - [31]=> - int(-2147483649) -} -array(14) { - [0]=> - string(0) "" - [1]=> - string(0) "" - [2]=> - string(1) " " - [3]=> - string(1) " " - [4]=> - string(1) "0" - [5]=> - string(1) "%0" - [6]=> - string(2) "\0" - [7]=> - string(1) " " - [8]=> - string(2) "\t" - [9]=> - string(3) "PHP" - [10]=> - string(3) "PHP" - [11]=> - string(29) "abcd%0n1234%005678%000efgh\xijkl" - [12]=> - string(34) "abcd%0efgh%0ijkl%0mnop%00qrst%0uvwx%00yz" - [13]=> - string(22) "1234 -5678 - 9100"abcda" -} -array(15) { - [0]=> - array(0) { - } - [1]=> - array(1) { - [0]=> - NULL - } - [2]=> - array(1) { - [0]=> - NULL - } - [3]=> - array(1) { - [0]=> - bool(true) - } - [4]=> - array(1) { - [0]=> - string(0) "" - } - [5]=> - array(1) { - [0]=> - string(0) "" - } - [6]=> - array(2) { - [0]=> - array(0) { - } - [1]=> - array(0) { - } - } - [7]=> - array(2) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } - [1]=> - array(2) { - [0]=> - string(1) "a" - [1]=> - string(1) "b" - } - } - [8]=> - array(1) { - [1]=> - string(3) "One" - } - [9]=> - array(1) { - ["test"]=> - string(8) "is_array" - } - [10]=> - array(1) { - [0]=> - int(0) - } - [11]=> - array(1) { - [0]=> - int(-1) - } - [12]=> - array(2) { - [0]=> - float(10.5) - [1]=> - float(5.6) - } - [13]=> - array(2) { - [0]=> - string(6) "string" - [1]=> - string(4) "test" - } - [14]=> - array(2) { - [0]=> - string(6) "string" - [1]=> - string(4) "test" - } -} -array(4) { - [0]=> - bool(true) - [1]=> - bool(false) - [2]=> - bool(true) - [3]=> - bool(false) -} -array(2) { - [0]=> - resource(5) of type (stream) - [1]=> - resource(6) of type (stream) -} -array(9) { - [0]=> - object(object_class)#6 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - [1]=> - object(no_member_class)#7 (0) { - } - [2]=> - object(contains_object_class)#8 (7) { - ["p"]=> - int(30) - ["class_object1"]=> - object(object_class)#9 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object2"]=> - object(object_class)#10 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object3":"contains_object_class":private]=> - object(object_class)#9 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object4":protected]=> - object(object_class)#10 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["no_member_class_object"]=> - object(no_member_class)#11 (0) { - } - ["class_object5"]=> - *RECURSION* - } - [3]=> - object(contains_object_class)#1 (7) { - ["p"]=> - int(30) - ["class_object1"]=> - object(object_class)#2 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object2"]=> - object(object_class)#3 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object3":"contains_object_class":private]=> - object(object_class)#2 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["class_object4":protected]=> - object(object_class)#3 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - ["no_member_class_object"]=> - object(no_member_class)#4 (0) { - } - ["class_object5"]=> - *RECURSION* - } - [4]=> - object(object_class)#2 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - [5]=> - object(object_class)#3 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - [6]=> - object(no_member_class)#4 (0) { - } - [7]=> - object(object_class)#5 (7) { - ["value"]=> - int(50) - ["public_var1"]=> - int(10) - ["private_var1":"object_class":private]=> - int(20) - ["private_var2":"object_class":private]=> - int(21) - ["protected_var1":protected]=> - string(8) "string_1" - ["protected_var2":protected]=> - string(8) "string_2" - ["public_var2"]=> - int(11) - } - [8]=> - NULL -} -array(4) { - [0]=> - NULL - [1]=> - NULL - [2]=> - NULL - [3]=> - NULL -} -array(6) { - [0]=> - array(3) { - [0]=> - int(123) - [1]=> - float(-1.2345) - [2]=> - string(1) "a" - } - [1]=> - array(4) { - [0]=> - string(1) "d" - [1]=> - array(3) { - [0]=> - int(1) - [1]=> - int(3) - [2]=> - int(5) - } - [2]=> - bool(true) - [3]=> - NULL - } - [2]=> - array(4) { - [0]=> - object(no_member_class)#14 (0) { - } - [1]=> - array(0) { - } - [2]=> - bool(false) - [3]=> - int(0) - } - [3]=> - array(6) { - [0]=> - float(-0) - [1]=> - string(11) "Where am I?" - [2]=> - array(3) { - [0]=> - int(7) - [1]=> - int(8) - [2]=> - int(9) - } - [3]=> - bool(true) - [4]=> - string(1) "A" - [5]=> - int(987654321) - } - [4]=> - array(4) { - [0]=> - NULL - [1]=> - float(20000000000) - [2]=> - float(79.1) - [3]=> - float(4.599998) - } - [5]=> - array(4) { - [0]=> - string(27) "array(1,2,3,4)1.0000002TRUE" - [1]=> - NULL - [2]=> - float(4611333) - [3]=> - string(5) "/00\7" - } -} -Done diff --git a/ext/standard/tests/general_functions/var_dump_array_circular.phpt b/ext/standard/tests/general_functions/var_dump_array_circular.phpt new file mode 100644 index 0000000000000..5bee8eb481358 --- /dev/null +++ b/ext/standard/tests/general_functions/var_dump_array_circular.phpt @@ -0,0 +1,20 @@ +--TEST-- +Test var_dump() function with circular array +--FILE-- + +--EXPECT-- +array(1) { + [0]=> + &array(1) { + [0]=> + *RECURSION* + } +} diff --git a/ext/standard/tests/general_functions/var_dump_arrays.phpt b/ext/standard/tests/general_functions/var_dump_arrays.phpt new file mode 100644 index 0000000000000..7b75e75e07cca --- /dev/null +++ b/ext/standard/tests/general_functions/var_dump_arrays.phpt @@ -0,0 +1,99 @@ +--TEST-- +Test var_dump() function with arrays +--INI-- +precision=14 +--FILE-- + 'One'], + ["test" => "is_array"], + [0], + [-1], + [10.5, 5.6], + ['string', 'test'], +]; + +foreach ($values as $value) { + var_dump($value); +} + +?> +--EXPECT-- +array(0) { +} +array(1) { + [0]=> + NULL +} +array(1) { + [0]=> + bool(false) +} +array(1) { + [0]=> + bool(true) +} +array(1) { + [0]=> + string(0) "" +} +array(2) { + [0]=> + array(0) { + } + [1]=> + array(0) { + } +} +array(2) { + [0]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } + [1]=> + array(2) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + } +} +array(1) { + [1]=> + string(3) "One" +} +array(1) { + ["test"]=> + string(8) "is_array" +} +array(1) { + [0]=> + int(0) +} +array(1) { + [0]=> + int(-1) +} +array(2) { + [0]=> + float(10.5) + [1]=> + float(5.6) +} +array(2) { + [0]=> + string(6) "string" + [1]=> + string(4) "test" +} diff --git a/ext/standard/tests/general_functions/var_dump_bools.phpt b/ext/standard/tests/general_functions/var_dump_bools.phpt new file mode 100644 index 0000000000000..034a8d7a2af48 --- /dev/null +++ b/ext/standard/tests/general_functions/var_dump_bools.phpt @@ -0,0 +1,23 @@ +--TEST-- +Test var_dump() function with booleans +--FILE-- + true, + 'false' => false, +]; + +foreach ($values as $key => $value) { + echo "$key:\n"; + var_dump($value); +} + +?> +DONE +--EXPECT-- +true: +bool(true) +false: +bool(false) +DONE diff --git a/ext/standard/tests/general_functions/var_dump_floats.phpt b/ext/standard/tests/general_functions/var_dump_floats.phpt new file mode 100644 index 0000000000000..9ded48b1d3b17 --- /dev/null +++ b/ext/standard/tests/general_functions/var_dump_floats.phpt @@ -0,0 +1,76 @@ +--TEST-- +Test var_dump() function with floats +--INI-- +precision=14 +--FILE-- + +--EXPECT-- +-- Iteration 1 -- +float(-0) +-- Iteration 2 -- +float(0) +-- Iteration 3 -- +float(1.234) +-- Iteration 4 -- +float(-1.234) +-- Iteration 5 -- +float(-2) +-- Iteration 6 -- +float(2) +-- Iteration 7 -- +float(-0.5) +-- Iteration 8 -- +float(0.567) +-- Iteration 9 -- +float(-0.00067) +-- Iteration 10 -- +float(670) +-- Iteration 11 -- +float(-0.00410003) +-- Iteration 12 -- +float(0.004100003) +-- Iteration 13 -- +float(100000) +-- Iteration 14 -- +float(-100000) +-- Iteration 15 -- +float(1.0E-5) +-- Iteration 16 -- +float(-1.0E-5) +-- Iteration 17 -- +float(100000) +-- Iteration 18 -- +float(-100000) diff --git a/ext/standard/tests/general_functions/var_dump_ints.phpt b/ext/standard/tests/general_functions/var_dump_ints.phpt new file mode 100644 index 0000000000000..b9146c10b2aa0 --- /dev/null +++ b/ext/standard/tests/general_functions/var_dump_ints.phpt @@ -0,0 +1,92 @@ +--TEST-- +Test var_dump() function with integers +--INI-- +precision=14 +--FILE-- + +--EXPECT-- +-- Iteration 1 -- +int(0) +-- Iteration 2 -- +int(83) +-- Iteration 3 -- +int(123000000) +-- Iteration 4 -- +int(-83) +-- Iteration 5 -- +int(-12300000) +-- Iteration 6 -- +array(10) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + [6]=> + int(7) + [7]=> + int(8) + [8]=> + int(9) + [9]=> + int(10) +} +-- Iteration 7 -- +array(10) { + [0]=> + int(-1) + [1]=> + int(-2) + [2]=> + int(-3) + [3]=> + int(-4) + [4]=> + int(-5) + [5]=> + int(-6) + [6]=> + int(-7) + [7]=> + int(-8) + [8]=> + int(-9) + [9]=> + int(-10) +} +-- Iteration 8 -- +int(2147483647) +-- Iteration 9 -- +int(-2147483647) diff --git a/ext/standard/tests/general_functions/var_dump_ints_32bit.phpt b/ext/standard/tests/general_functions/var_dump_ints_32bit.phpt new file mode 100644 index 0000000000000..7cc818cfb22eb --- /dev/null +++ b/ext/standard/tests/general_functions/var_dump_ints_32bit.phpt @@ -0,0 +1,33 @@ +--TEST-- +Test var_dump() function with 32 bit integers +--INI-- +precision=14 +--SKIPIF-- + +--FILE-- + +--EXPECT-- +-- Iteration 1 -- +float(2147483648) +-- Iteration 2 -- +float(-2147483648) diff --git a/ext/standard/tests/general_functions/var_dump_ints_64bit.phpt b/ext/standard/tests/general_functions/var_dump_ints_64bit.phpt new file mode 100644 index 0000000000000..cb01803c163bc --- /dev/null +++ b/ext/standard/tests/general_functions/var_dump_ints_64bit.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test var_dump() function with 64 bit integers +--INI-- +precision=14 +--SKIPIF-- + +--FILE-- + +--EXPECT-- +-- Iteration 1 -- +int(2147483647) +-- Iteration 2 -- +int(-2147483648) +-- Iteration 3 -- +int(2147483647) +-- Iteration 4 -- +int(-2147483648) +-- Iteration 5 -- +int(2147483648) +-- Iteration 6 -- +int(-2147483648) diff --git a/ext/standard/tests/general_functions/var_dump_null.phpt b/ext/standard/tests/general_functions/var_dump_null.phpt new file mode 100644 index 0000000000000..e98b74eca930b --- /dev/null +++ b/ext/standard/tests/general_functions/var_dump_null.phpt @@ -0,0 +1,12 @@ +--TEST-- +Test var_dump() function with null +--FILE-- + +DONE +--EXPECT-- +NULL +DONE diff --git a/ext/standard/tests/general_functions/var_dump_object.phpt b/ext/standard/tests/general_functions/var_dump_object.phpt new file mode 100644 index 0000000000000..467272574de26 --- /dev/null +++ b/ext/standard/tests/general_functions/var_dump_object.phpt @@ -0,0 +1,181 @@ +--TEST-- +Test var_dump() function +--FILE-- +value = 50; + $this->public_var2 = 11; + $this->private_var2 = 21; + $this->protected_var2 = "string_2"; + } + + public function foo1() { + echo "foo1() is called\n"; + } + protected function foo2() { + echo "foo2() is called\n"; + } + private function foo3() { + echo "foo3() is called\n"; + } +} + +class no_member_class {} + +/* class with member as object of other class */ +#[AllowDynamicProperties] +class contains_object_class +{ + var $p = 30; + var $class_object1; + public $class_object2; + private $class_object3; + protected $class_object4; + var $no_member_class_object; + + public function func() { + echo "func() is called \n"; + } + + function __construct() { + $this->class_object1 = new object_class(); + $this->class_object2 = new object_class(); + $this->class_object3 = $this->class_object1; + $this->class_object4 = $this->class_object2; + $this->no_member_class_object = new no_member_class(); + $this->class_object5 = $this; //recursive reference + } +} + +$objects = [ + new object_class, + new no_member_class, + new contains_object_class, +]; +check_var_dump($objects); + +?> +--EXPECT-- +*** Testing var_dump() on object variables *** + +-- Iteration 1 -- +object(object_class)#1 (7) { + ["value"]=> + int(50) + ["public_var1"]=> + int(10) + ["private_var1":"object_class":private]=> + int(20) + ["private_var2":"object_class":private]=> + int(21) + ["protected_var1":protected]=> + string(8) "string_1" + ["protected_var2":protected]=> + string(8) "string_2" + ["public_var2"]=> + int(11) +} + +-- Iteration 2 -- +object(no_member_class)#2 (0) { +} + +-- Iteration 3 -- +object(contains_object_class)#3 (7) { + ["p"]=> + int(30) + ["class_object1"]=> + object(object_class)#4 (7) { + ["value"]=> + int(50) + ["public_var1"]=> + int(10) + ["private_var1":"object_class":private]=> + int(20) + ["private_var2":"object_class":private]=> + int(21) + ["protected_var1":protected]=> + string(8) "string_1" + ["protected_var2":protected]=> + string(8) "string_2" + ["public_var2"]=> + int(11) + } + ["class_object2"]=> + object(object_class)#5 (7) { + ["value"]=> + int(50) + ["public_var1"]=> + int(10) + ["private_var1":"object_class":private]=> + int(20) + ["private_var2":"object_class":private]=> + int(21) + ["protected_var1":protected]=> + string(8) "string_1" + ["protected_var2":protected]=> + string(8) "string_2" + ["public_var2"]=> + int(11) + } + ["class_object3":"contains_object_class":private]=> + object(object_class)#4 (7) { + ["value"]=> + int(50) + ["public_var1"]=> + int(10) + ["private_var1":"object_class":private]=> + int(20) + ["private_var2":"object_class":private]=> + int(21) + ["protected_var1":protected]=> + string(8) "string_1" + ["protected_var2":protected]=> + string(8) "string_2" + ["public_var2"]=> + int(11) + } + ["class_object4":protected]=> + object(object_class)#5 (7) { + ["value"]=> + int(50) + ["public_var1"]=> + int(10) + ["private_var1":"object_class":private]=> + int(20) + ["private_var2":"object_class":private]=> + int(21) + ["protected_var1":protected]=> + string(8) "string_1" + ["protected_var2":protected]=> + string(8) "string_2" + ["public_var2"]=> + int(11) + } + ["no_member_class_object"]=> + object(no_member_class)#6 (0) { + } + ["class_object5"]=> + *RECURSION* +} diff --git a/ext/standard/tests/general_functions/var_dump_object_circular.phpt b/ext/standard/tests/general_functions/var_dump_object_circular.phpt new file mode 100644 index 0000000000000..5670346a4bb99 --- /dev/null +++ b/ext/standard/tests/general_functions/var_dump_object_circular.phpt @@ -0,0 +1,24 @@ +--TEST-- +Test var_dump() function function with circular objects +--FILE-- +obj = $recursion_obj2; +$recursion_obj2->obj = $recursion_obj1; +var_dump($recursion_obj2); + +?> +--EXPECT-- +object(Circular)#2 (1) { + ["obj"]=> + object(Circular)#1 (1) { + ["obj"]=> + *RECURSION* + } +} diff --git a/ext/standard/tests/general_functions/var_dump_resources.phpt b/ext/standard/tests/general_functions/var_dump_resources.phpt new file mode 100644 index 0000000000000..facdc83d42c8d --- /dev/null +++ b/ext/standard/tests/general_functions/var_dump_resources.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test var_dump() function with resources +--FILE-- + +--EXPECT-- +resource(1) of type (stream) +resource(3) of type (stream) diff --git a/ext/standard/tests/general_functions/var_dump_strings.phpt b/ext/standard/tests/general_functions/var_dump_strings.phpt new file mode 100644 index 0000000000000..88436318badac --- /dev/null +++ b/ext/standard/tests/general_functions/var_dump_strings.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test var_dump() function with strings +--WHITESPACE_SENSITIVE-- +--FILE-- + +--EXPECT-- +-- Iteration 1 -- +string(0) "" +-- Iteration 2 -- +string(1) " " +-- Iteration 3 -- +string(1) "0" +-- Iteration 4 -- +string(2) "\0" +-- Iteration 5 -- +string(1) " " +-- Iteration 6 -- +string(2) "\t" +-- Iteration 7 -- +string(3) "PHP" +-- Iteration 8 -- +string(22) "1234 +5678 + 9100"abcda" diff --git a/ext/standard/tests/general_functions/var_dump_strings_nul_bytes.phpt b/ext/standard/tests/general_functions/var_dump_strings_nul_bytes.phpt new file mode 100644 index 0000000000000..20f06e11cd1f8 Binary files /dev/null and b/ext/standard/tests/general_functions/var_dump_strings_nul_bytes.phpt differ