ID:               37234
 User updated by:  phpbug at drque dot net
 Reported By:      phpbug at drque dot net
-Status:           Feedback
+Status:           Closed
 Bug Type:         Unknown/Other Function
 Operating System: Linux, Debian 2.6.8-3-k7
 PHP Version:      5.1.2
 New Comment:

PHP 5.1-200605011230 does work fine.  Seems the area in question in
"ext/standard/pack.c" has been changed to:
   if (argb > 0) {      
     len -= argb % 2;
   }

Thank you Mike


Previous Comments:
------------------------------------------------------------------------

[2006-04-29 11:27:32] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip

Looks fine in 5.1.3.

------------------------------------------------------------------------

[2006-04-28 08:46:07] phpbug at drque dot net

Description:
------------
When unpacking hex with 'unpack', a "0" is appended to the end of the
resulting string.  This did not happen in previous versions (this code
functions in PHP 5.1.1).

A quick fix can be done by commenting out line 695 in
"ext/standard/pack.c":

Change
   len -= argb % 2;
to 
   //len -= argb % 2;

This line is one of 6 differences in "pack.c" between version 5.1.1 and
5.1.2.  I wasn't able to understand why the "len -= argb %2" line was
added.


Reproduce code:
---------------
<?php
   $HexString = 'c45dc988443fa8fff52ce7953bf049b8';

   $PackedHexString = pack( "h*" , $HexString );
   $UnpackedHex  =
     unpack( "h*Hex" , $PackedHexString );
   $UnpackedHex  = $UnpackedHex[ 'Hex' ];

   echo "$HexString\n";
   echo "$UnpackedHex\n";
?>

Expected result:
----------------
c45dc988443fa8fff52ce7953bf049b8
c45dc988443fa8fff52ce7953bf049b8


Actual result:
--------------
c45dc988443fa8fff52ce7953bf049b8
c45dc988443fa8fff52ce7953bf049b80



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=37234&edit=1

Reply via email to