Bug #54903 [Opn->Nab]: unpack("H*hex", $data) is adding an extra character to the end of the string.

From: Date: Tue, 07 Jul 2015 17:41:11 +0000
Subject: Bug #54903 [Opn->Nab]: unpack("H*hex", $data) is adding an extra character to the end of the string.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194184@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=54903&edit=1

 ID:                 54903
 Updated by:         cmb@php.net
 Reported by:        middle_of_nowere at hotmail dot com
 Summary:            unpack("H*hex", $data) is adding an extra character
                     to the end of the string.
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            Unknown/Other Function
 Operating System:   Windows 7
 PHP Version:        5.3.6
 Block user comment: N
 Private report:     N

 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

The "unexpected" character is already encoded by pack() (see
<http://3v4l.org/toVJd>), because the H format expects an
even
number of characters.


Previous Comments:
------------------------------------------------------------------------
[2011-05-22 10:50:07] middle_of_nowere at hotmail dot com

Description:
------------
Same bug as http://bugs.php.net/36148

unpack("H*hex", $data) is adding an unexpected extra character to the end of the string.


Test script:
---------------
$Value = pack("H*", "263");
$Result	= unpack("H*", $Value);

Expected result:
----------------
$Result = "263";

Actual result:
--------------
$Result = "2630";


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



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


Thread (2 messages)

« previous php.bugs (#194184) next »