cvs: ZendEngine2(PHP_5_0) / zend_execute.c /tests bug31098.phpt

From: Date: Tue, 11 Jan 2005 21:59:57 +0000
Subject: cvs: ZendEngine2(PHP_5_0) / zend_execute.c /tests bug31098.phpt
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-3280@lists.php.net to get a copy of this message
moriyoshi Tue Jan 11 16:59:57 2005 EDT Added files: (Branch: PHP_5_0) /ZendEngine2/tests bug31098.phpt Modified files: /ZendEngine2 zend_execute.c Log: - MFH: fix for bug #31098. # I just wasn't aware of the bug being assigned to Dmitry. # Sorry if there has already been an effort for this one. http://cvs.php.net/diff.php/ZendEngine2/zend_execute.c?r1=1.652.2.12&r2=1.652.2.13&ty=u Index: ZendEngine2/zend_execute.c diff -u ZendEngine2/zend_execute.c:1.652.2.12 ZendEngine2/zend_execute.c:1.652.2.13 --- ZendEngine2/zend_execute.c:1.652.2.12 Mon Dec 27 08:04:02 2004 +++ ZendEngine2/zend_execute.c Tue Jan 11 16:59:56 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute.c,v 1.652.2.12 2004/12/27 13:04:02 dmitry Exp $ */ +/* $Id: zend_execute.c,v 1.652.2.13 2005/01/11 21:59:56 moriyoshi Exp $ */ #define ZEND_INTENSIVE_DEBUGGING 0 @@ -4035,23 +4035,25 @@ } else if ((*container)->type == IS_STRING) { /* string offsets */ zval tmp_offset; - if (Z_TYPE_P(offset) != IS_LONG) { - tmp_offset = *offset; - zval_copy_ctor(&tmp_offset); - convert_to_long(&tmp_offset); - offset = &tmp_offset; - } - switch (opline->extended_value) { - case ZEND_ISSET: - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { - result = 1; - } - break; - case ZEND_ISEMPTY: - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { - result = 1; - } - break; + if (!prop_dim) { + if (Z_TYPE_P(offset) != IS_LONG) { + tmp_offset = *offset; + zval_copy_ctor(&tmp_offset); + convert_to_long(&tmp_offset); + offset = &tmp_offset; + } + switch (opline->extended_value) { + case ZEND_ISSET: + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + result = 1; + } + break; + case ZEND_ISEMPTY: + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + result = 1; + } + break; + } } } } http://cvs.php.net/co.php/ZendEngine2/tests/bug31098.phpt?r=1.1&p=1 Index: ZendEngine2/tests/bug31098.phpt +++ ZendEngine2/tests/bug31098.phpt --TEST-- Bug #31098 (isset() / empty() incorrectly returns true in dereference of a wrong type) --FILE-- <?php $a = ''; var_dump(isset($a->b)); $a = 'a'; var_dump(isset($a->b)); $a = '0'; var_dump(isset($a->b)); $a = ''; var_dump(isset($a{'b'})); $a = 'a'; var_dump(isset($a{'b'})); $a = '0'; var_dump(isset($a{'b'})); ?> --EXPECTF-- bool(false) bool(false) bool(false) bool(false) bool(true) bool(true)

« previous php.zend-engine.cvs (#3280) next »