|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-12-22 16:17 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 01:00:01 2025 UTC |
Description: ------------ In the recent PHP release 4.3.10 there had been added a bug to the unpack (PHP_FUNCTION(unpack)) function in unpack.c The code that manifests the problem is this: $h = unpack('H*hex', $data); The result would be: Warning: unpack(): Type H: outside of string in /my_file.php on line 20 The reason is a change in the function which using the current compiler (Red Hat Linux 3.2.3-42) generates incorrect behavior when "break" is placed within a curly braces block (within a "switch" statement) which causes break to leave the current scope but then continue falling down through the "switch" elements. For example this code: case 'C': { int issigned = (type == 'c') ? (input[inputpos] & 0x80) : 0; long v = php_unpack(&input[inputpos], 1, issigned, byte_map); add_assoc_long(return_value, n, v); break; } case 's': The correct setup needs to move the "break" outside the {...} scope, which would then fix the problem. This behavior is apparent in several places throughout that function and needs to be corrected in all of them. Thanks, Sefer.