ID:               31247
 Updated by:       [EMAIL PROTECTED]
 Reported By:      sefer at hotmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Compile Warning
 Operating System: Linux redhat 9
 PHP Version:      4.3.10
 New Comment:

Please fix your compiler, the position of the break statment should not
matter.


Previous Comments:
------------------------------------------------------------------------

[2004-12-22 15:52:06] sefer at hotmail dot com

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.



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


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

Reply via email to