Possible fix for bug #26281 & test case.

This commit is contained in:
Ilia Alshanetsky 2003-11-19 00:41:14 +00:00
parent a16ca5a1c2
commit fdd902f0dd
2 changed files with 15 additions and 0 deletions

13
Zend/tests/bug26281.phpt Executable file
View File

@ -0,0 +1,13 @@
--TEST--
Bug #26281 (switch() crash when condition is a string offset)
--FILE--
<?php
$x = 'abc';
switch ($x{0}) {
case 'a':
echo "no crash\n";
break;
}
?>
--EXPECT--
no crash

View File

@ -200,7 +200,9 @@ static inline void zend_switch_free(zend_op *opline, temp_variable *Ts TSRMLS_DC
* quick & silent get_zval_ptr, and FREE_OP
*/
PZVAL_UNLOCK(T->EA.data.str_offset.str);
#ifdef ilia_0 /* attempts to free already freed data */
zval_dtor(&T->tmp_var);
#endif
} else {
zval_ptr_dtor(&T(opline->op1.u.var).var.ptr);
if (opline->extended_value) { /* foreach() free */