Skip to content

Escape \0 in var_dump() output #7059

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Zend/tests/bug60569.phpt
Binary file not shown.
Binary file modified Zend/tests/cast_to_array.phpt
Binary file not shown.
Binary file modified Zend/tests/cast_to_object.phpt
Binary file not shown.
Binary file modified Zend/tests/cast_to_string.phpt
Binary file not shown.
Binary file modified Zend/tests/settype_array.phpt
Binary file not shown.
Binary file modified Zend/tests/settype_object.phpt
Binary file not shown.
Binary file modified Zend/tests/settype_resource.phpt
Binary file not shown.
Binary file modified Zend/tests/settype_string.phpt
Binary file not shown.
Binary file modified ext/curl/tests/curl_escape.phpt
Binary file not shown.
Binary file modified ext/exif/tests/exif012.phpt
Binary file not shown.
Binary file modified ext/exif/tests/exif013.phpt
Binary file not shown.
Binary file modified ext/exif/tests/exif014.phpt
Binary file not shown.
Binary file modified ext/exif/tests/exif015.phpt
Binary file not shown.
6 changes: 2 additions & 4 deletions ext/exif/tests/exif020.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -1618,7 +1618,7 @@ array(34) {
["Copyright"]=>
string(12) "Eric Stewart"
["GPSVersion"]=>
string(4) ""
string(4) "\0\0"
["GPSLatitudeRef"]=>
string(1) "N"
["GPSLatitude"]=>
Expand All @@ -1642,7 +1642,7 @@ array(34) {
string(3) "0/1"
}
["GPSAltitudeRef"]=>
string(1) ""
string(1) "\0"
["GPSAltitude"]=>
string(5) "295/1"
["GPSTimeStamp"]=>
Expand All @@ -1655,5 +1655,3 @@ array(34) {
string(4) "53/1"
}
}
--CREDITS--
Eric Stewart <ericleestewart@gmail.com>
6 changes: 2 additions & 4 deletions ext/exif/tests/exif021.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -1618,7 +1618,7 @@ array(34) {
["Copyright"]=>
string(12) "Eric Stewart"
["GPSVersion"]=>
string(4) ""
string(4) "\0\0"
["GPSLatitudeRef"]=>
string(1) "N"
["GPSLatitude"]=>
Expand All @@ -1642,7 +1642,7 @@ array(34) {
string(3) "0/1"
}
["GPSAltitudeRef"]=>
string(1) ""
string(1) "\0"
["GPSAltitude"]=>
string(5) "295/1"
["GPSTimeStamp"]=>
Expand All @@ -1655,5 +1655,3 @@ array(34) {
string(4) "53/1"
}
}
--CREDITS--
Eric Stewart <ericleestewart@gmail.com>
6 changes: 2 additions & 4 deletions ext/exif/tests/exif022.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -1642,7 +1642,7 @@ array(45) {
["ExifImageLength"]=>
int(1)
["GPSVersion"]=>
string(4) ""
string(4) "\0\0"
["GPSLatitudeRef"]=>
string(1) "N"
["GPSLatitude"]=>
Expand All @@ -1666,7 +1666,7 @@ array(45) {
string(3) "0/1"
}
["GPSAltitudeRef"]=>
string(1) ""
string(1) "\0"
["GPSAltitude"]=>
string(5) "295/1"
["GPSTimeStamp"]=>
Expand All @@ -1679,5 +1679,3 @@ array(45) {
string(4) "53/1"
}
}
--CREDITS--
Eric Stewart <ericleestewart@gmail.com>
6 changes: 2 additions & 4 deletions ext/exif/tests/exif023.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -1642,7 +1642,7 @@ array(45) {
["ExifImageLength"]=>
int(1)
["GPSVersion"]=>
string(4) ""
string(4) "\0\0"
["GPSLatitudeRef"]=>
string(1) "N"
["GPSLatitude"]=>
Expand All @@ -1666,7 +1666,7 @@ array(45) {
string(3) "0/1"
}
["GPSAltitudeRef"]=>
string(1) ""
string(1) "\0"
["GPSAltitude"]=>
string(5) "295/1"
["GPSTimeStamp"]=>
Expand All @@ -1679,5 +1679,3 @@ array(45) {
string(4) "53/1"
}
}
--CREDITS--
Eric Stewart <ericleestewart@gmail.com>
Binary file modified ext/opcache/tests/compact_literals_collision.phpt
Binary file not shown.
Binary file modified ext/pdo_mysql/tests/bug_39483.phpt
Binary file not shown.
Binary file modified ext/spl/tests/array_018.phpt
Binary file not shown.
Binary file modified ext/spl/tests/iterator_049b.phpt
Binary file not shown.
Binary file modified ext/spl/tests/serialize_property_tables.phpt
Binary file not shown.
Binary file modified ext/standard/tests/array/array_flip_variation2.phpt
Binary file not shown.
Binary file modified ext/standard/tests/array/array_flip_variation3.phpt
Binary file not shown.
22 changes: 11 additions & 11 deletions ext/standard/tests/array/array_rand_variation6.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -65,34 +65,34 @@ echo "Done";
\*\*\* Testing array_rand\(\) : with keys of input array as heredoc strings \*\*\*

-- with default parameters --
string\([0-9]*\) "[a-z \n \t \0 0-9 ]*"
string\([0-9]*\) "[a-z \n \t \\0 0-9 ]*"

-- with num_req = 1 --
string\([0-9]*\) "[a-z \n \t \0 0-9 ]*"
string\([0-9]*\) "[a-z \n \t \\0 0-9 ]*"

-- with num_req = 3 --
array\(3\) {
\[0\]=>
string\([0-9]*\) "[a-z \n \t \0 0-9 ]*"
string\([0-9]*\) "[a-z \n \t \\0 0-9 ]*"
\[1\]=>
string\([0-9]*\) "[a-z \n \t \0 0-9 ]*"
string\([0-9]*\) "[a-z \n \t \\0 0-9 ]*"
\[2\]=>
string\([0-9]*\) "[a-z \n \t \0 0-9 ]*"
string\([0-9]*\) "[a-z \n \t \\0 0-9 ]*"
}

-- with num_req = 6 --
array\(6\) {
\[0\]=>
string\([0-9]*\) "[a-z \n \t \0 0-9 ]*"
string\([0-9]*\) "[a-z \n \t \\0 0-9 ]*"
\[1\]=>
string\([0-9]*\) "[a-z \n \t \0 0-9 ]*"
string\([0-9]*\) "[a-z \n \t \\0 0-9 ]*"
\[2\]=>
string\([0-9]*\) "[a-z \n \t \0 0-9 ]*"
string\([0-9]*\) "[a-z \n \t \\0 0-9 ]*"
\[3\]=>
string\([0-9]*\) "[a-z \n \t \0 0-9 ]*"
string\([0-9]*\) "[a-z \n \t \\0 0-9 ]*"
\[4\]=>
string\([0-9]*\) "[a-z \n \t \0 0-9 ]*"
string\([0-9]*\) "[a-z \n \t \\0 0-9 ]*"
\[5\]=>
string\([0-9]*\) "[a-z \n \t \0 0-9 ]*"
string\([0-9]*\) "[a-z \n \t \\0 0-9 ]*"
}
Done
Binary file modified ext/standard/tests/array/array_search.phpt
Binary file not shown.
Binary file modified ext/standard/tests/array/array_values.phpt
Binary file not shown.
6 changes: 3 additions & 3 deletions ext/standard/tests/array/array_walk_object1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ var_dump( array_walk($input, "callback", 1));

echo "Done"
?>
--EXPECTF--
--EXPECT--
*** Testing array_walk() : object functionality ***
string(18) "%r\0%rMyClass%r\0%rpri_value"
string(18) "\0MyClass\0pri_value"
int(10)
int(1)

string(9) "pub_value"
int(10)
int(1)

string(12) "%r\0%r*%r\0%rpro_value"
string(12) "\0*\0pro_value"
int(10)
int(1)

Expand Down
6 changes: 3 additions & 3 deletions ext/standard/tests/array/array_walk_objects.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ try {

echo "Done\n";
?>
--EXPECTF--
--EXPECT--
string(3) "foo"
string(3) "foo"
string(3) "bar"
string(3) "bar"
string(13) "%r\0%rtest%r\0%rvar_pri"
string(13) "\0test\0var_pri"
string(12) "test_private"
string(10) "%r\0%r*%r\0%rvar_pro"
string(10) "\0*\0var_pro"
string(14) "test_protected"
string(7) "var_pub"
string(11) "test_public"
Expand Down
Binary file modified ext/standard/tests/array/array_walk_rec_objects.phpt
Binary file not shown.
6 changes: 3 additions & 3 deletions ext/standard/tests/array/array_walk_recursive_object1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ var_dump( array_walk_recursive($input, "callback", 1));

echo "Done"
?>
--EXPECTF--
--EXPECT--
*** Testing array_walk_recursive() : object functionality ***
string(18) "%r\0%rMyClass%r\0%rpri_value"
string(18) "\0MyClass\0pri_value"
int(10)
int(1)

string(9) "pub_value"
int(10)
int(1)

string(12) "%r\0%r*%r\0%rpro_value"
string(12) "\0*\0pro_value"
int(10)
int(1)

Expand Down
Binary file modified ext/standard/tests/array/arsort_variation11.phpt
Binary file not shown.
Binary file modified ext/standard/tests/array/asort_variation11.phpt
Binary file not shown.
Binary file modified ext/standard/tests/array/bug26458.phpt
Binary file not shown.
Binary file modified ext/standard/tests/array/krsort_variation8.phpt
Binary file not shown.
Binary file modified ext/standard/tests/array/ksort_variation8.phpt
Binary file not shown.
Binary file modified ext/standard/tests/array/natcasesort_variation9.phpt
Binary file not shown.
Binary file modified ext/standard/tests/array/rsort_variation11.phpt
Binary file not shown.
12 changes: 6 additions & 6 deletions ext/standard/tests/array/shuffle_variation5.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,17 @@ bool\(true\)
The output array is:
array\(6\) {
\[0\]=>
string\([0-9]*\) "[0-9 a-z \n \0 \t]*"
string\([0-9]*\) "[0-9 a-z \n \\0 \t]*"
\[1\]=>
string\([0-9]*\) "[0-9 a-z \n \0 \t]*"
string\([0-9]*\) "[0-9 a-z \n \\0 \t]*"
\[2\]=>
string\([0-9]*\) "[0-9 a-z \n \0 \t]*"
string\([0-9]*\) "[0-9 a-z \n \\0 \t]*"
\[3\]=>
string\([0-9]*\) "[0-9 a-z \n \0 \t]*"
string\([0-9]*\) "[0-9 a-z \n \\0 \t]*"
\[4\]=>
string\([0-9]*\) "[0-9 a-z \n \0 \t]*"
string\([0-9]*\) "[0-9 a-z \n \\0 \t]*"
\[5\]=>
string\([0-9]*\) "[0-9 a-z \n \0 \t]*"
string\([0-9]*\) "[0-9 a-z \n \\0 \t]*"
}

-- with array having heredoc strings as keys --
Expand Down
Binary file modified ext/standard/tests/array/sort_variation11.phpt
Binary file not shown.
Binary file modified ext/standard/tests/array/uasort_variation3.phpt
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified ext/standard/tests/file/basename.phpt
Binary file not shown.
Binary file modified ext/standard/tests/file/bug26003.phpt
Binary file not shown.
Binary file modified ext/standard/tests/file/ftruncate.phpt
Binary file not shown.
22 changes: 11 additions & 11 deletions ext/standard/tests/general_functions/var_dump_64bit.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ closedir($dir_handle);

echo "Done\n";
?>
--EXPECT--
--EXPECTF--
*** Testing var_dump() on integer variables ***
-- Iteration 1 --
int(0)
Expand Down Expand Up @@ -427,7 +427,7 @@ string(1) " "
-- Iteration 5 --
string(1) "0"
-- Iteration 6 --
string(1) ""
string(1) "\0"
-- Iteration 7 --
string(2) "\0"
-- Iteration 8 --
Expand All @@ -439,9 +439,9 @@ string(3) "PHP"
-- Iteration 11 --
string(3) "PHP"
-- Iteration 12 --
string(29) "abcdn12340567800efgh\xijkl"
string(29) "abcd\0n1234\005678\000efgh\xijkl"
-- Iteration 13 --
string(34) "abcdefghijklmnop0qrstuvwx0yz"
string(34) "abcd\0efgh\0ijkl\0mnop\00qrst\0uvwx\00yz"
-- Iteration 14 --
string(22) "1234
5678
Expand Down Expand Up @@ -827,9 +827,9 @@ object(object_class)#13 (8) {

*** Testing var_dump() on resources ***
-- Iteration 1 --
resource(5) of type (stream)
resource(%d) of type (stream)
-- Iteration 2 --
resource(6) of type (stream)
resource(%d) of type (stream)

*** Testing var_dump() on different combinations of scalar
and non-scalar variables ***
Expand Down Expand Up @@ -1081,7 +1081,7 @@ array(14) {
[4]=>
string(1) "0"
[5]=>
string(1) ""
string(1) "\0"
[6]=>
string(2) "\0"
[7]=>
Expand All @@ -1093,9 +1093,9 @@ array(14) {
[10]=>
string(3) "PHP"
[11]=>
string(29) "abcdn12340567800efgh\xijkl"
string(29) "abcd\0n1234\005678\000efgh\xijkl"
[12]=>
string(34) "abcdefghijklmnop0qrstuvwx0yz"
string(34) "abcd\0efgh\0ijkl\0mnop\00qrst\0uvwx\00yz"
[13]=>
string(22) "1234
5678
Expand Down Expand Up @@ -1210,9 +1210,9 @@ array(4) {
}
array(2) {
[0]=>
resource(5) of type (stream)
resource(%d) of type (stream)
[1]=>
resource(6) of type (stream)
resource(%d) of type (stream)
}
array(9) {
[0]=>
Expand Down
Binary file modified ext/standard/tests/math/bug62112.phpt
Binary file not shown.
Binary file modified ext/standard/tests/serialize/serialization_objects_001.phpt
Binary file not shown.
Binary file modified ext/standard/tests/serialize/serialization_objects_002.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/addcslashes_001.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/addcslashes_003.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/basename.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/basename_basic.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/bug39621.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/bug40915.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/bug60801.phpt
Binary file not shown.
6 changes: 3 additions & 3 deletions ext/standard/tests/strings/bug61038.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ var_dump(unpack("a*", "str\0\0"));
--EXPECTF--
array(1) {
[1]=>
string(4) "str%c"
string(4) "str\0"
}
array(1) {
[1]=>
string(5) "str%c%c"
string(5) "str\0\0"
}

Warning: unpack(): Type a: not enough input, need 6, have 5 in %s on line %d
bool(false)
array(1) {
[1]=>
string(5) "str%c%c"
string(5) "str\0\0"
}
Binary file modified ext/standard/tests/strings/chop_basic.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/chop_variation3.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/chop_variation4.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/chunk_split_variation5.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/chunk_split_variation7.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/chunk_split_variation9.phpt
Binary file not shown.
2 changes: 1 addition & 1 deletion ext/standard/tests/strings/dirname_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,5 @@ string\(1\) "(\\|\/)"
string\(1\) "."

--Iteration 29 --
string\(8\) "(\\|\/)foo\x00bar"
string\(8\) "(\\|\/)foo\\0bar"
Done
Binary file not shown.
Binary file modified ext/standard/tests/strings/implode1.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/join_variation4.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/join_variation6.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/lcfirst.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/md5_file.phpt
Binary file not shown.
4 changes: 2 additions & 2 deletions ext/standard/tests/strings/pack_A.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ var_dump(
unpack("A4", "foo\0\rbar\0 \t\r\n")
);
?>
--EXPECTF--
--EXPECT--
string(5) "foo "
string(4) "fooo"
string(4) "foo "
array(1) {
[1]=>
string(8) "foo%c%cbar"
string(8) "foo\0bar"
}
array(1) {
[1]=>
Expand Down
8 changes: 4 additions & 4 deletions ext/standard/tests/strings/pack_Z.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ var_dump(
--EXPECTF--
Warning: unpack(): Type Z: not enough input, need 2, have 1 in %s on line %d
string(0) ""
string(5) "foo%c%c"
string(4) "foo%c"
string(4) "foo%c"
string(4) "foo%c"
string(5) "foo\0\0"
string(4) "foo\0"
string(4) "foo\0"
string(4) "foo\0"
array(1) {
[1]=>
string(3) "foo"
Expand Down
Binary file modified ext/standard/tests/strings/parse_str_basic3.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/quoted_printable_encode_002.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/rtrim.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/sprintf_variation15.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/sprintf_variation27.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/str_replace_variation2.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/str_split_variation3.phpt
Binary file not shown.
6 changes: 3 additions & 3 deletions ext/standard/tests/strings/strings001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ $s = "alabala nica".chr(0)."turska panica";
var_dump(strstr($s, "nic"));
var_dump(strrchr($s," nic"));
?>
--EXPECTREGEX--
string\(18\) \"nica\x00turska panica\"
string\(7\) \" panica\"
--EXPECT--
string(18) "nica\0turska panica"
string(7) " panica"
Binary file modified ext/standard/tests/strings/stripslashes_basic.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/stripslashes_variation2.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/strrchr_variation1.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/strrchr_variation12.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/strrev_variation1.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/strrev_variation2.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/strrev_variation3.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/strstr.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/strtolower.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/strtoupper1.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/substr.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/trim1.phpt
Binary file not shown.
Binary file modified ext/standard/tests/strings/ucfirst.phpt
Binary file not shown.
Loading