object members get trimmed by zero bytes
| Bug #63980 | object members get trimmed by zero bytes | ||||
|---|---|---|---|---|---|
| Submitted: | 2013-01-13 02:33 UTC | Modified: | 2013-01-15 15:04 UTC | ||
| From: | thbley at gmail dot com | Assigned: | laruence (profile) | ||
| Status: | Closed | Package: | *General Issues | ||
| PHP Version: | 5.5.0alpha3-nts | OS: | Win64 | ||
| Private report: | No | CVE-ID: | None | ||
[2013-01-13 02:33 UTC] thbley at gmail dot com
Description:
------------
Array keys are not trimmed by zero bytes. (ok)
Object member names are trimmed by zero bytes. (bug)
Test script:
---------------
$arr = ["abc\0def" => "abc\0def"];
print_r($arr);
print_r((object)$arr);
Expected result:
----------------
Array
(
[abc def] => abc def
)
stdClass Object
(
[abc def] => abc def
)
Actual result:
--------------
Array
(
[abc def] => abc def
)
stdClass Object
(
[abc] => abc def
)
Patches
bug63980.patch (last revision 2013-01-14 03:44 UTC by laruence@php.net)Pull Requests
History
AllCommentsChangesGit/SVN commits
[2013-01-13 12:55 UTC] laruence@php.net
[2013-01-13 16:07 UTC] thbley at gmail dot com
-Status: Feedback +Status: Open -PHP Version: 5.5.0alpha2 +PHP Version: 5.5.0alpha3-nts
[2013-01-13 16:07 UTC] thbley at gmail dot com
Thanks, var_dump() works. But it would be great if get_object_vars() and foreach() could be fixed. Here is a more detailed test: $arr = ["abc\0def" => "abc\0def"]; $obj = (object)$arr; print_r($arr); // ok echo "\n"; var_dump($obj); // ok echo "\n"; echo serialize($obj); // ok echo "\n"; echo (int)property_exists($obj, "abc"); // ok echo "\n"; echo (int)isset($obj->{"abc"}); // ok echo "\n"; echo json_encode($obj); // ok echo "\n"; var_dump((array)$obj); // ok echo "\n"; var_export($obj); // bug echo "\n"; print_r($obj); // bug echo "\n"; debug_zval_dump($obj); // bug echo "\n"; var_dump(get_object_vars($obj)); // bug echo "\n"; echo get_object_vars($obj)["abc"]; // bug echo "\n"; foreach ($obj as $key=>$val) { echo $key." : ".$val."\n"; // bug }[2013-01-15 15:04 UTC] thbley at gmail dot com