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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sagawa at sohgoh dot net
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 06 15:01:35 2025 UTC