php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4150 unpack ("H4","AB") is not enough input?
Submitted: 2000-04-15 07:43 UTC Modified: 2000-05-14 12:47 UTC
From: sagawa at sohgoh dot net Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 4.0 Release Candidate 1 OS: Windows 95
Private report: No CVE-ID: None
 [2000-04-15 07:43 UTC] sagawa at sohgoh dot net
<?php
print pack("H4", "4142"); // this prints "AB"
?>
So I do
<?php
$foo = unpack("H4", "AB");
?>
But, it appeared that
<b>Fatal error</b>:  pack type H: not enough input, need 4, have 2 in <b>-</b> on line <b>2</b><br>

I can this by using bin2hex function to do this.
But Perl works without error,
is this right unpack() behavior?

Thank you.
Akihiro SAGAWA

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-05-13 11:28 UTC] sterling at cvs dot php dot net
This is the correct behavior, see the docs.
 [2000-05-14 12:47 UTC] sterling at cvs dot php dot net
forgot to close.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jun 07 06:01:33 2024 UTC