ID: 36148
Updated by: iliaa@php.net
Reported By: andy at advancethermal dot com
-Status: Assigned
+Status: Closed
Bug Type: Strings related
Operating System: *
PHP Version: 5CVS-2006-01-25 (snap)
Assigned To: iliaa
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2006-01-25 18:59:23] sniper@php.net
Ilia, verified on Linux too.
------------------------------------------------------------------------
[2006-01-25 18:53:49] andy at advancethermal dot com
The latest CVS (5.1.3-dev built Jan 25 2006 16:19:11) does not correct
the problem.
------------------------------------------------------------------------
[2006-01-25 18:22:14] andy at advancethermal dot com
Upon further testing, I found the following:
CODE:
$values = array("a", "aa", "aaa", "aaaa");
foreach ($values as $value) {
$a = pack("H*", $value);
$b = unpack("H*", $a);
echo "<p>".$value.": ";
var_dump($b);
}
ACTUAL RESULT:
a: array(1) { [1]=> string(3) "a00" }
aa: array(1) { [1]=> string(3) "aa0" }
aaa: array(1) { [1]=> string(5) "aaa00" }
aaaa: array(1) { [1]=> string(5) "aaaa0" }
EXPECTED RESULT: (produced from PHP 5.0.5)
a: array(1) { [1]=> string(2) "a0" }
aa: array(1) { [1]=> string(2) "aa" }
aaa: array(1) { [1]=> string(4) "aaa0" }
aaaa: array(1) { [1]=> string(4) "aaaa" }
The release notes for 5.1.2 indicate that the problem was fixed,
however this does not appear to be the case -- or is a new problem.
All scripts that handle binary data using unpack() had to be modified
with substr($unpackeddata[1], 0, -1) so it would be properly handled.
------------------------------------------------------------------------
[2006-01-25 00:32:56] tony2001@php.net
See bug #35817.
------------------------------------------------------------------------
[2006-01-25 00:10:45] andy at advancethermal dot com
Sorry, reverse the Expected and Actual Results...
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/36148--
Edit this bug report at http://bugs.php.net/?id=36148&edit=1