diff --git a/Zend/tests/cast_to_string.phpt b/Zend/tests/cast_to_string.phpt index eabb51cb13776..be58ccf2c866f 100644 --- a/Zend/tests/cast_to_string.phpt +++ b/Zend/tests/cast_to_string.phpt @@ -52,6 +52,8 @@ string(5) "Array" string(0) "" string(1) "1" string(0) "" + +Warning: Resource to string conversion in %s on line %d string(%d) "Resource id #%d" string(2) "10" Done diff --git a/Zend/tests/operator_unsupported_types.phpt b/Zend/tests/operator_unsupported_types.phpt index ef169bb39fc29..a8579f22c8493 100644 --- a/Zend/tests/operator_unsupported_types.phpt +++ b/Zend/tests/operator_unsupported_types.phpt @@ -1047,6 +1047,7 @@ No error for [] . [] Warning: Array to string conversion Object of class stdClass could not be converted to string Warning: Array to string conversion +Warning: Resource to string conversion No error for [] . STDOUT Warning: Array to string conversion No error for [] . "foo" @@ -1056,13 +1057,19 @@ Object of class stdClass could not be converted to string Object of class stdClass could not be converted to string Object of class stdClass could not be converted to string Warning: Array to string conversion +Warning: Resource to string conversion No error for STDOUT . [] +Warning: Resource to string conversion Object of class stdClass could not be converted to string +Warning: Resource to string conversion +Warning: Resource to string conversion No error for STDOUT . STDOUT +Warning: Resource to string conversion No error for STDOUT . "foo" Warning: Array to string conversion No error for "foo" . [] Object of class stdClass could not be converted to string +Warning: Resource to string conversion No error for "foo" . STDOUT No error for "foo" . "foo" Warning: Array to string conversion @@ -1107,19 +1114,33 @@ Object of class stdClass could not be converted to string Object of class stdClass could not be converted to string Object of class stdClass could not be converted to string Object of class stdClass could not be converted to string +Warning: Resource to string conversion No error for STDOUT . null +Warning: Resource to string conversion No error for null . STDOUT +Warning: Resource to string conversion No error for STDOUT . true +Warning: Resource to string conversion No error for true . STDOUT +Warning: Resource to string conversion No error for STDOUT . false +Warning: Resource to string conversion No error for false . STDOUT +Warning: Resource to string conversion No error for STDOUT . 2 +Warning: Resource to string conversion No error for 2 . STDOUT +Warning: Resource to string conversion No error for STDOUT . 3.5 +Warning: Resource to string conversion No error for 3.5 . STDOUT +Warning: Resource to string conversion No error for STDOUT . "123" +Warning: Resource to string conversion No error for "123" . STDOUT +Warning: Resource to string conversion No error for STDOUT . "123foo" +Warning: Resource to string conversion No error for "123foo" . STDOUT No error for "foo" . null No error for null . "foo" @@ -2001,6 +2022,7 @@ No error for [] .= [] Warning: Array to string conversion Object of class stdClass could not be converted to string Warning: Array to string conversion +Warning: Resource to string conversion No error for [] .= STDOUT Warning: Array to string conversion No error for [] .= "foo" @@ -2008,14 +2030,20 @@ Object of class stdClass could not be converted to string Object of class stdClass could not be converted to string Object of class stdClass could not be converted to string Object of class stdClass could not be converted to string +Warning: Resource to string conversion Warning: Array to string conversion No error for STDOUT .= [] +Warning: Resource to string conversion Object of class stdClass could not be converted to string +Warning: Resource to string conversion +Warning: Resource to string conversion No error for STDOUT .= STDOUT +Warning: Resource to string conversion No error for STDOUT .= "foo" Warning: Array to string conversion No error for "foo" .= [] Object of class stdClass could not be converted to string +Warning: Resource to string conversion No error for "foo" .= STDOUT No error for "foo" .= "foo" Warning: Array to string conversion @@ -2060,19 +2088,33 @@ Object of class stdClass could not be converted to string Object of class stdClass could not be converted to string Object of class stdClass could not be converted to string Object of class stdClass could not be converted to string +Warning: Resource to string conversion No error for STDOUT .= null +Warning: Resource to string conversion No error for null .= STDOUT +Warning: Resource to string conversion No error for STDOUT .= true +Warning: Resource to string conversion No error for true .= STDOUT +Warning: Resource to string conversion No error for STDOUT .= false +Warning: Resource to string conversion No error for false .= STDOUT +Warning: Resource to string conversion No error for STDOUT .= 2 +Warning: Resource to string conversion No error for 2 .= STDOUT +Warning: Resource to string conversion No error for STDOUT .= 3.5 +Warning: Resource to string conversion No error for 3.5 .= STDOUT +Warning: Resource to string conversion No error for STDOUT .= "123" +Warning: Resource to string conversion No error for "123" .= STDOUT +Warning: Resource to string conversion No error for STDOUT .= "123foo" +Warning: Resource to string conversion No error for "123foo" .= STDOUT No error for "foo" .= null No error for null .= "foo" diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index c2fbc0ee110c9..265cdd89b2366 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -1018,6 +1018,10 @@ static zend_always_inline zend_string* __zval_get_string_func(zval *op, bool try case IS_TRUE: return ZSTR_CHAR('1'); case IS_RESOURCE: + zend_error(E_WARNING, "Resource to string conversion"); + if (try && UNEXPECTED(EG(exception))) { + return NULL; + } return zend_strpprintf(0, "Resource id #" ZEND_LONG_FMT, (zend_long)Z_RES_HANDLE_P(op)); case IS_LONG: return zend_long_to_str(Z_LVAL_P(op)); diff --git a/ext/standard/tests/array/array_combine_variation5.phpt b/ext/standard/tests/array/array_combine_variation5.phpt index ef0859373e339..a1a82f41d4ab8 100644 --- a/ext/standard/tests/array/array_combine_variation5.phpt +++ b/ext/standard/tests/array/array_combine_variation5.phpt @@ -147,6 +147,8 @@ array(2) { string(11) "Hello world" } -- Iteration 10 -- + +Warning: Resource to string conversion in %s on line %d array(3) { ["Class A object"]=> object(classA)#%d (0) { @@ -157,6 +159,8 @@ array(3) { resource(%d) of type (stream) } -- Iteration 11 -- + +Warning: Resource to string conversion in %s on line %d array(8) { ["hello"]=> string(5) "hello" diff --git a/ext/standard/tests/array/array_diff_variation8.phpt b/ext/standard/tests/array/array_diff_variation8.phpt index 5a1b2c4f3016b..687d514385a78 100644 --- a/ext/standard/tests/array/array_diff_variation8.phpt +++ b/ext/standard/tests/array/array_diff_variation8.phpt @@ -176,6 +176,10 @@ array(3) { string(11) "Hello world" } -- Iteration 8 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(3) { ["a"]=> string(1) "1" @@ -184,6 +188,10 @@ array(3) { ["c"]=> string(1) "3" } + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(5) { [11]=> object(classA)#%d (0) { diff --git a/ext/standard/tests/array/array_fill_keys_variation1.phpt b/ext/standard/tests/array/array_fill_keys_variation1.phpt index a05c90b534edc..e7bbe595e2a37 100644 --- a/ext/standard/tests/array/array_fill_keys_variation1.phpt +++ b/ext/standard/tests/array/array_fill_keys_variation1.phpt @@ -52,6 +52,8 @@ array(4) { -- Testing array_fill_keys() function with mixed array -- +Warning: Resource to string conversion in %s on line %d + Warning: Array to string conversion in %s on line %d array(7) { ["Resource id #%d"]=> diff --git a/ext/standard/tests/array/array_intersect_assoc_variation7.phpt b/ext/standard/tests/array/array_intersect_assoc_variation7.phpt index f971b356ba340..be43a6e7e3b15 100644 --- a/ext/standard/tests/array/array_intersect_assoc_variation7.phpt +++ b/ext/standard/tests/array/array_intersect_assoc_variation7.phpt @@ -168,6 +168,10 @@ array(1) { string(11) "Hello world" } -- Iteration 10 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(2) { [11]=> object(classA)#%d (0) { @@ -175,6 +179,14 @@ array(2) { ["resource"]=> resource(%d) of type (stream) } + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(2) { [11]=> object(classA)#%d (0) { @@ -183,6 +195,10 @@ array(2) { resource(%d) of type (stream) } -- Iteration 11 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(4) { [222]=> string(5) "fruit" @@ -193,6 +209,14 @@ array(4) { ["heredoc"]=> string(11) "Hello world" } + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(4) { [222]=> string(5) "fruit" diff --git a/ext/standard/tests/array/array_intersect_assoc_variation8.phpt b/ext/standard/tests/array/array_intersect_assoc_variation8.phpt index c4a26c09d5c07..e9346c2b827e6 100644 --- a/ext/standard/tests/array/array_intersect_assoc_variation8.phpt +++ b/ext/standard/tests/array/array_intersect_assoc_variation8.phpt @@ -168,6 +168,10 @@ array(1) { string(11) "Hello world" } -- Iteration 10 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(2) { [11]=> object(classA)#%d (0) { @@ -175,6 +179,14 @@ array(2) { ["resource"]=> resource(%d) of type (stream) } + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(2) { [11]=> object(classA)#%d (0) { @@ -183,6 +195,10 @@ array(2) { resource(%d) of type (stream) } -- Iteration 11 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(4) { ["heredoc"]=> string(11) "Hello world" @@ -193,6 +209,14 @@ array(4) { [222]=> string(5) "fruit" } + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(4) { ["heredoc"]=> string(11) "Hello world" diff --git a/ext/standard/tests/array/array_intersect_variation7.phpt b/ext/standard/tests/array/array_intersect_variation7.phpt index 559783b96c01f..f7c9234860556 100644 --- a/ext/standard/tests/array/array_intersect_variation7.phpt +++ b/ext/standard/tests/array/array_intersect_variation7.phpt @@ -85,31 +85,143 @@ echo "Done"; --EXPECTF-- *** Testing array_intersect() : assoc array with diff values to $arr1 argument *** -- Iterator 1 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(0) { } + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(0) { } -- Iterator 2 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(0) { } + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(0) { } -- Iterator 3 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(1) { [1]=> int(1) } + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(1) { [1]=> int(1) } -- Iterator 4 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(2) { ["one"]=> int(1) ["two"]=> int(2) } + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(2) { ["one"]=> int(1) @@ -117,51 +229,231 @@ array(2) { int(2) } -- Iterator 5 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(1) { ["float"]=> float(2.3333) } + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(1) { ["float"]=> float(2.3333) } -- Iterator 6 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(1) { ["f1"]=> float(1.2) } + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(1) { ["f1"]=> float(1.2) } -- Iterator 7 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(1) { ["red"]=> string(6) "col or" } + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(1) { ["red"]=> string(6) "col or" } -- Iterator 8 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(1) { [2]=> string(9) "\v\fworld" } + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(1) { [2]=> string(9) "\v\fworld" } -- Iterator 9 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(1) { ["heredoc"]=> string(11) "Hello world" } + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(1) { ["heredoc"]=> string(11) "Hello world" } -- Iterator 10 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(2) { [11]=> object(classA)#%d (0) { @@ -169,6 +461,42 @@ array(2) { ["resource"]=> resource(%d) of type (stream) } + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(2) { [11]=> object(classA)#%d (0) { @@ -177,6 +505,44 @@ array(2) { resource(%d) of type (stream) } -- Iterator 11 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(5) { [2]=> object(classA)#%d (0) { @@ -190,6 +556,62 @@ array(5) { ["heredoc"]=> string(11) "Hello world" } + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(5) { [2]=> object(classA)#%d (0) { diff --git a/ext/standard/tests/array/array_intersect_variation8.phpt b/ext/standard/tests/array/array_intersect_variation8.phpt index 319804bbc745f..2c5c6c61c5848 100644 --- a/ext/standard/tests/array/array_intersect_variation8.phpt +++ b/ext/standard/tests/array/array_intersect_variation8.phpt @@ -85,31 +85,199 @@ echo "Done"; --EXPECTF-- *** Testing array_intersect() : assoc array with diff values to $arr2 argument *** -- Iterator 1 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(0) { } + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(0) { } -- Iterator 2 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(0) { } + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(0) { } -- Iterator 3 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(1) { [0]=> int(1) } + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(1) { [0]=> int(1) } -- Iterator 4 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(2) { [0]=> int(1) [1]=> int(2) } + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(2) { [0]=> int(1) @@ -117,48 +285,278 @@ array(2) { int(2) } -- Iterator 5 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(1) { [3]=> float(2.3333) } + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(1) { [3]=> float(2.3333) } -- Iterator 6 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(1) { [2]=> float(1.2) } + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(1) { [2]=> float(1.2) } -- Iterator 7 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(1) { [4]=> string(6) "col or" } + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(1) { [4]=> string(6) "col or" } -- Iterator 8 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(1) { [5]=> string(9) "\v\fworld" } + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(1) { [5]=> string(9) "\v\fworld" } -- Iterator 9 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(2) { [7]=> string(11) "Hello world" [8]=> string(11) "Hello world" } + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(2) { [7]=> string(11) "Hello world" @@ -166,6 +564,38 @@ array(2) { string(11) "Hello world" } -- Iterator 10 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(2) { [6]=> resource(%d) of type (stream) @@ -173,6 +603,60 @@ array(2) { object(classA)#%d (0) { } } + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(2) { [6]=> resource(%d) of type (stream) @@ -181,6 +665,42 @@ array(2) { } } -- Iterator 11 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(6) { [6]=> resource(%d) of type (stream) @@ -196,6 +716,62 @@ array(6) { [11]=> string(5) "fruit" } + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(6) { [6]=> resource(%d) of type (stream) diff --git a/ext/standard/tests/array/array_unique_variation4.phpt b/ext/standard/tests/array/array_unique_variation4.phpt index 7b4f8bd443cf3..50b06c2798026 100644 --- a/ext/standard/tests/array/array_unique_variation4.phpt +++ b/ext/standard/tests/array/array_unique_variation4.phpt @@ -96,6 +96,10 @@ array(2) { string(11) "Hello world" } -- Iteration 6 -- + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d array(3) { [11]=> object(classA)#%d (0) { diff --git a/ext/standard/tests/general_functions/get_defined_constants_basic.phpt b/ext/standard/tests/general_functions/get_defined_constants_basic.phpt index b89cc937aae8c..e68b4a69dbf24 100644 --- a/ext/standard/tests/general_functions/get_defined_constants_basic.phpt +++ b/ext/standard/tests/general_functions/get_defined_constants_basic.phpt @@ -9,7 +9,10 @@ var_dump(gettype(get_defined_constants())); $arr1 = get_defined_constants(false); $arr2 = get_defined_constants(); -var_dump(array_diff($arr1, $arr2)); + +// TODO We suppress the warning for resource to string conversion +// This should be removed when array_diff is fixed +var_dump(@array_diff($arr1, $arr2)); $n1 = count(get_defined_constants()); define("USER_CONSTANT", "test"); diff --git a/ext/standard/tests/general_functions/is_callable_variation2.phpt b/ext/standard/tests/general_functions/is_callable_variation2.phpt index 53fe64a245457..c6716e86ed58e 100644 --- a/ext/standard/tests/general_functions/is_callable_variation2.phpt +++ b/ext/standard/tests/general_functions/is_callable_variation2.phpt @@ -133,8 +133,12 @@ bool(false) -- Iteration 11 -- bool(false) bool(false) + +Warning: Resource to string conversion in %s on line %d bool(false) Resource id #%d bool(false) + +Warning: Resource to string conversion in %s on line %d bool(false) Resource id #%d 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_arrays.phpt b/ext/standard/tests/general_functions/print_r_arrays.phpt new file mode 100644 index 0000000000000..2d0f30bc918a5 --- /dev/null +++ b/ext/standard/tests/general_functions/print_r_arrays.phpt @@ -0,0 +1,162 @@ +--TEST-- +print_r(): Test printing of arrays +--INI-- +precision=14 +--WHITESPACE_SENSITIVE-- +--FILE-- + 'One'], + ["test" => "is_array"], + [0], + [-1], + [10.5, 5.6], + ["string", "test"], + ['string', 'test'], +]; + +check_print_r($arrays); + +?> +--EXPECT-- +-- Iteration 1 -- +Array +( +) +bool(true) +bool(true) +-- Iteration 2 -- +Array +( + [0] => +) +bool(true) +bool(true) +-- Iteration 3 -- +Array +( + [0] => +) +bool(true) +bool(true) +-- Iteration 4 -- +Array +( + [0] => 1 +) +bool(true) +bool(true) +-- Iteration 5 -- +Array +( + [0] => +) +bool(true) +bool(true) +-- Iteration 6 -- +Array +( + [0] => Array + ( + ) + + [1] => Array + ( + ) + +) +bool(true) +bool(true) +-- Iteration 7 -- +Array +( + [0] => Array + ( + [0] => 1 + [1] => 2 + ) + + [1] => Array + ( + [0] => a + [1] => b + ) + +) +bool(true) +bool(true) +-- Iteration 8 -- +Array +( + [1] => One +) +bool(true) +bool(true) +-- Iteration 9 -- +Array +( + [test] => is_array +) +bool(true) +bool(true) +-- Iteration 10 -- +Array +( + [0] => 0 +) +bool(true) +bool(true) +-- Iteration 11 -- +Array +( + [0] => -1 +) +bool(true) +bool(true) +-- Iteration 12 -- +Array +( + [0] => 10.5 + [1] => 5.6 +) +bool(true) +bool(true) +-- Iteration 13 -- +Array +( + [0] => string + [1] => test +) +bool(true) +bool(true) +-- Iteration 14 -- +Array +( + [0] => string + [1] => test +) +bool(true) +bool(true) diff --git a/ext/standard/tests/general_functions/print_r_basic_primitive_types.phpt b/ext/standard/tests/general_functions/print_r_basic_primitive_types.phpt new file mode 100644 index 0000000000000..21a2098667a86 --- /dev/null +++ b/ext/standard/tests/general_functions/print_r_basic_primitive_types.phpt @@ -0,0 +1,71 @@ +--TEST-- +print_r(): Test printing basic primitive types +--INI-- +precision=14 +--FILE-- + +--EXPECT-- +-- Iteration 1 -- + +bool(true) +string(0) "" +-- Iteration 2 -- + +bool(true) +string(0) "" +-- Iteration 3 -- +1 +bool(true) +string(1) "1" +-- Iteration 4 -- +0 +bool(true) +string(1) "0" +-- Iteration 5 -- +42 +bool(true) +string(2) "42" +-- Iteration 6 -- +-245 +bool(true) +string(4) "-245" +-- Iteration 7 -- +12 +bool(true) +string(2) "12" +-- Iteration 8 -- +4005 +bool(true) +string(4) "4005" +-- Iteration 9 -- +13 +bool(true) +string(2) "13" 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..487d34959eafa --- /dev/null +++ b/ext/standard/tests/general_functions/print_r_floats.phpt @@ -0,0 +1,128 @@ +--TEST-- +print_r(): Test printing floats +--FILE-- + +--EXPECT-- +-- Iteration 1 -- +-0 +bool(true) +bool(true) +-- Iteration 2 -- +0 +bool(true) +bool(true) +-- Iteration 3 -- +1.234 +bool(true) +bool(true) +-- Iteration 4 -- +-1.234 +bool(true) +bool(true) +-- Iteration 5 -- +-2 +bool(true) +bool(true) +-- Iteration 6 -- +2 +bool(true) +bool(true) +-- Iteration 7 -- +-0.5 +bool(true) +bool(true) +-- Iteration 8 -- +0.567 +bool(true) +bool(true) +-- Iteration 9 -- +-0.00067 +bool(true) +bool(true) +-- Iteration 10 -- +670 +bool(true) +bool(true) +-- Iteration 11 -- +-0.00410003 +bool(true) +bool(true) +-- Iteration 12 -- +0.004100003 +bool(true) +bool(true) +-- Iteration 13 -- +100000 +bool(true) +bool(true) +-- Iteration 14 -- +-100000 +bool(true) +bool(true) +-- Iteration 15 -- +1.0E-5 +bool(true) +bool(true) +-- Iteration 16 -- +-1.0E-5 +bool(true) +bool(true) +-- Iteration 17 -- +100000 +bool(true) +bool(true) +-- Iteration 18 -- +-100000 +bool(true) +bool(true) +-- Iteration 19 -- +-1.844674407371E+19 +bool(true) +bool(true) +-- Iteration 20 -- +2.7670116110564E+19 +bool(true) +bool(true) diff --git a/ext/standard/tests/general_functions/print_r_objects.phpt b/ext/standard/tests/general_functions/print_r_objects.phpt new file mode 100644 index 0000000000000..386599b6243e0 --- /dev/null +++ b/ext/standard/tests/general_functions/print_r_objects.phpt @@ -0,0 +1,272 @@ +--TEST-- +print_r(): Test printing of objects +--INI-- +precision=14 +--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 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(); + } +} + +/* objects of different classes */ +$obj = new contains_object_class; +$temp_class_obj = new object_class(); + +$objects = [ + 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, +]; + +check_print_r($objects); + +?> +--EXPECT-- +-- 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 +) +bool(true) +bool(true) +-- Iteration 2 -- +no_member_class Object +( +) +bool(true) +bool(true) +-- 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 + ( + ) + +) +bool(true) +bool(true) +-- 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 + ( + ) + +) +bool(true) +bool(true) +-- 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 +) +bool(true) +bool(true) +-- 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 +) +bool(true) +bool(true) +-- Iteration 7 -- +no_member_class Object +( +) +bool(true) +bool(true) +-- 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 +) +bool(true) +bool(true) diff --git a/ext/standard/tests/general_functions/print_r_objects_recursive.phpt b/ext/standard/tests/general_functions/print_r_objects_recursive.phpt new file mode 100644 index 0000000000000..bfa79d69c366a --- /dev/null +++ b/ext/standard/tests/general_functions/print_r_objects_recursive.phpt @@ -0,0 +1,26 @@ +--TEST-- +print_r(): Test objects with circular reference +--FILE-- +var = &$recursion_obj2; +$recursion_obj2->var = &$recursion_obj1; +print_r($recursion_obj2); + +?> +--EXPECT-- +object_class Object +( + [var] => object_class Object + ( + [var] => object_class 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..4cb2c649e1096 --- /dev/null +++ b/ext/standard/tests/general_functions/print_r_resources.phpt @@ -0,0 +1,52 @@ +--TEST-- +print_r(): Test printing resources +--INI-- +precision=14 +--FILE-- + +--EXPECTF-- +-- Iteration 1 -- + +Warning: Resource to string conversion in %s on line %d +Resource id #3 +bool(true) + +Warning: Resource to string conversion in %s on line %d +string(14) "Resource id #3" +-- Iteration 2 -- + +Warning: Resource to string conversion in %s on line %d +Resource id #5 +bool(true) + +Warning: Resource to string conversion in %s on line %d +string(14) "Resource id #5" diff --git a/ext/standard/tests/general_functions/print_r_strings_basic.phpt b/ext/standard/tests/general_functions/print_r_strings_basic.phpt new file mode 100644 index 0000000000000..bf40f2fb405df --- /dev/null +++ b/ext/standard/tests/general_functions/print_r_strings_basic.phpt @@ -0,0 +1,57 @@ +--TEST-- +print_r(): Test printing strings +--WHITESPACE_SENSITIVE-- +--FILE-- + +--EXPECT-- +-- Iteration 1 -- + +bool(true) +bool(true) +-- Iteration 2 -- + +bool(true) +bool(true) +-- Iteration 3 -- +0 +bool(true) +bool(true) +-- Iteration 4 -- +PHP +bool(true) +bool(true) +-- Iteration 5 -- +12 34 +5678 + 9100"abcda +bool(true) +bool(true) diff --git a/ext/standard/tests/general_functions/print_r_strings_null_byte.phpt b/ext/standard/tests/general_functions/print_r_strings_null_byte.phpt new file mode 100644 index 0000000000000..6f77b85d13901 Binary files /dev/null and b/ext/standard/tests/general_functions/print_r_strings_null_byte.phpt differ diff --git a/ext/standard/tests/general_functions/strval.phpt b/ext/standard/tests/general_functions/strval.phpt index 678da93fac94f..e26aeb70c40f7 100644 --- a/ext/standard/tests/general_functions/strval.phpt +++ b/ext/standard/tests/general_functions/strval.phpt @@ -268,8 +268,12 @@ string(0) "" -- Iteration 1 -- string(6) "Object" -- Iteration 2 -- + +Warning: Resource to string conversion in %s on line %d string(14) "Resource id #%d" -- Iteration 3 -- + +Warning: Resource to string conversion in %s on line %d string(14) "Resource id #%d" -- Iteration 4 -- diff --git a/ext/standard/tests/strings/implode_variation.phpt b/ext/standard/tests/strings/implode_variation.phpt index 2cc0870f39f4f..862184e2cfad0 100644 --- a/ext/standard/tests/strings/implode_variation.phpt +++ b/ext/standard/tests/strings/implode_variation.phpt @@ -225,5 +225,9 @@ array(2) { } *** Testing end() on resource type *** + +Warning: Resource to string conversion in %s on line %d + +Warning: Resource to string conversion in %s on line %d string(%d) "Resource id #%d::Resource id #%d" Done diff --git a/ext/standard/tests/strings/print_variation1.phpt b/ext/standard/tests/strings/print_variation1.phpt index 1288a242d80b9..4480dbb99fb76 100644 --- a/ext/standard/tests/strings/print_variation1.phpt +++ b/ext/standard/tests/strings/print_variation1.phpt @@ -138,6 +138,8 @@ int(1) sample object int(1) -- Iteration 19 -- + +Warning: Resource to string conversion in %s on line %d Resource id #%d int(1) -- Iteration 20 -- diff --git a/ext/standard/tests/strings/printf_variation2.phpt b/ext/standard/tests/strings/printf_variation2.phpt index 1ee44a61e6a80..8760ab89824e7 100644 --- a/ext/standard/tests/strings/printf_variation2.phpt +++ b/ext/standard/tests/strings/printf_variation2.phpt @@ -286,7 +286,11 @@ int(0) int(0) -- Iteration 28 -- + +Warning: Resource to string conversion in %s on line %d Resource id #%d int(%d) + +Warning: Resource to string conversion in %s on line %d Resource id #%d int(%d) diff --git a/ext/standard/tests/strings/sprintf_variation2.phpt b/ext/standard/tests/strings/sprintf_variation2.phpt index 0695f9e6ad221..46ed6c65359fe 100644 --- a/ext/standard/tests/strings/sprintf_variation2.phpt +++ b/ext/standard/tests/strings/sprintf_variation2.phpt @@ -229,6 +229,10 @@ string(0) "" string(0) "" -- Iteration 28 -- + +Warning: Resource to string conversion in %s on line %d string(%d) "Resource id #%d" + +Warning: Resource to string conversion in %s on line %d string(%d) "Resource id #%d" Done diff --git a/ext/standard/tests/strings/sprintf_variation54.phpt b/ext/standard/tests/strings/sprintf_variation54.phpt index e925293ceef7c..2ae39df464f1f 100644 --- a/ext/standard/tests/strings/sprintf_variation54.phpt +++ b/ext/standard/tests/strings/sprintf_variation54.phpt @@ -49,6 +49,8 @@ Warning: Array to string conversion in %s on line %d Array %s with resource: + +Warning: Resource to string conversion in %s on line %d Resource id #%d %s with {}: diff --git a/ext/standard/tests/strings/strval_variation1.phpt b/ext/standard/tests/strings/strval_variation1.phpt index 69239df75ade1..26c5baea486fe 100644 --- a/ext/standard/tests/strings/strval_variation1.phpt +++ b/ext/standard/tests/strings/strval_variation1.phpt @@ -176,6 +176,8 @@ string(0) "" string(7) "MyClass" -- Iteration 29 -- + +Warning: Resource to string conversion in %s on line %d string(%d) "Resource id #%d" -- Iteration 30 --