ID:               26281
 Updated by:       [EMAIL PROTECTED]
 Reported By:      tater at potatoe dot com
-Status:           Verified
+Status:           Closed
 Bug Type:         Strings related
 Operating System: OS X 10.2
 PHP Version:      5CVS-2003-11-16 (dev)
 New Comment:

This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.




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

[2003-11-16 23:06:18] tater at potatoe dot com

Description:
------------
a switch() statement testing a string offset, like 
'switch($string{0})', crashes after executing the
matching case or default block. this only happens
if there is at least one case. workarounds: assign
offset to another variable first, or put it in 
quotes like "{$string{0}}".

This breaks a lot of PEAR code, btw.

Reproduce code:
---------------
$x = 'abc';
switch ($x{0}) { default: print "default - works\n"; }
switch ($x{0}) { case 'a': print "case 'a' - bus error\n"; }
print "done\n";

Expected result:
----------------
default - works
case 'a' - bus error
done

Actual result:
--------------
default - works
case 'a' - bus error
Bus error
--------------------
backtrace:
(gdb) run bug.php
Starting program: /usr/local/book/php/bin/php bug.php
[Switching to process 5410 thread 0xb03]
Reading symbols for shared libraries . done
Reading symbols for shared libraries ............ done
default - works
case 'a' - bus error

Program received signal EXC_BAD_ACCESS, Could not access memory.
0x00229f8c in _zval_dtor (zvalue=0xbb4c10, __zend_filename=0x2c2a24
"/Users/tater/book/php-src/Zend/zend_execute.c", __zend_lineno=203) at
/Users/tater/book/php-src/Zend/zend_variables.c:44
44                              CHECK_ZVAL_STRING_REL(zvalue);
(gdb)


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


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

Reply via email to