From:             php-bug-31247 at ryandesign dot com
Operating system: N/A
PHP version:      5.0.3
PHP Bug Type:     Unknown/Other Function
Bug description:  Warning: unpack(): Type H: outside of string

Description:
------------
I am experiencing the problem reported in bug 31247, 
which was marked as bogus. The decision was that the 
user's compiler was broken. I challenge this decision, 
as I see the problem with the (php.net-endorsed) 
precompiled Mac OS X version of PHP 5.0.3 (release 1) 
from www.entropy.ch and also with PHP 4.3.10 installed 
on a Gentoo server. I don't think all of these 
compilers are broken. I don't see the problem with 
Entropy PHP 4.3.9 (release 2) nor with 4.3.9 on a 
different Gentoo server.

I wonder whether the problem really relates to the 
break-statement-within-the-braces notation, because this 
notation is already present in PHP 4.3.9 which does not 
exhibit the problem. Regardless, I consider braces 
around cases within a switch to be poor form, and 
encourage developers I work with to not use it, as it 
gives the false impression to the uninitiated (which is 
often the person writing the code) that closing the 
brace closes the case (which of course it doesn't; the 
break actually does that).

Reproduce code:
---------------
php -r "print_r(unpack('H*hex', 'data'));"

Expected result:
----------------
Array
(
    [hex] => 64617461
)

Actual result:
--------------
Warning: unpack(): Type H: outside of string in Command 
line code on line 1
Array
(
    [hex] => 64617461
)

-- 
Edit bug report at http://bugs.php.net/?id=31465&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=31465&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=31465&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=31465&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=31465&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=31465&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=31465&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=31465&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=31465&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=31465&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=31465&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=31465&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=31465&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=31465&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=31465&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=31465&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=31465&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=31465&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=31465&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=31465&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=31465&r=mysqlcfg

Reply via email to