cvs: ZendEngine2 / zend_execute.c zend_vm_def.h zend_vm_execute.h zend_vm_opcodes.h /tests bug31098.phpt
| From: | Dmitry Stogov | Date: | Wed, 12 Jan 2005 09:18:31 +0000 |
| Subject: | cvs: ZendEngine2 / zend_execute.c zend_vm_def.h zend_vm_execute.h zend_vm_opcodes.h /tests bug31098.phpt | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-3285@lists.php.net to get a copy of this message | ||
dmitry Wed Jan 12 04:18:31 2005 EDT
Modified files:
/ZendEngine2 zend_execute.c zend_vm_def.h zend_vm_execute.h
zend_vm_opcodes.h
/ZendEngine2/tests bug31098.phpt
Log:
Fixed bug #31098 (isset false positive)
http://cvs.php.net/diff.php/ZendEngine2/zend_execute.c?r1=1.687&r2=1.688&ty=u Index: ZendEngine2/zend_execute.c diff -u ZendEngine2/zend_execute.c:1.687 ZendEngine2/zend_execute.c:1.688 --- ZendEngine2/zend_execute.c:1.687 Mon Dec 27 08:43:25 2004 +++ ZendEngine2/zend_execute.c Wed Jan 12 04:18:30 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute.c,v 1.687 2004/12/27 13:43:25 dmitry Exp $ */ +/* $Id: zend_execute.c,v 1.688 2005/01/12 09:18:30 dmitry Exp $ */ #define ZEND_INTENSIVE_DEBUGGING 0 @@ -1190,7 +1190,28 @@ zend_error_noreturn(E_ERROR, "[] operator not supported for strings"); } - if (dim->type != IS_LONG) { + if (Z_TYPE_P(dim) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(dim); + if (is_numeric_string(strval, Z_STRLEN_P(dim), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + dim = &tmp; + } else { + if (type != BP_VAR_IS && type != BP_VAR_UNSET) { + zend_error(E_NOTICE, "Trying to get string index from a string"); + } + if (result) { + result->var.ptr_ptr = &EG(error_zval_ptr); + PZVAL_LOCK(*result->var.ptr_ptr); + if (type == BP_VAR_R || type == BP_VAR_IS) { + AI_USE_PTR(result->var); + } + } + return; + } + } else if (dim->type != IS_LONG) { tmp = *dim; zval_copy_ctor(&tmp); convert_to_long(&tmp); http://cvs.php.net/diff.php/ZendEngine2/zend_vm_def.h?r1=1.7&r2=1.8&ty=u Index: ZendEngine2/zend_vm_def.h diff -u ZendEngine2/zend_vm_def.h:1.7 ZendEngine2/zend_vm_def.h:1.8 --- ZendEngine2/zend_vm_def.h:1.7 Mon Jan 10 09:57:35 2005 +++ ZendEngine2/zend_vm_def.h Wed Jan 12 04:18:30 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_def.h,v 1.7 2005/01/10 14:57:35 sniper Exp $ */ +/* $Id: zend_vm_def.h,v 1.8 2005/01/12 09:18:30 dmitry Exp $ */ ZEND_VM_HANDLER(1, ZEND_ADD, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) { @@ -3190,26 +3190,37 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - if (Z_TYPE_P(offset) != IS_LONG) { - tmp_offset = *offset; - zval_copy_ctor(&tmp_offset); - convert_to_long(&tmp_offset); - offset = &tmp_offset; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; + } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; } - 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 (offset->type == IS_LONG) { + 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/diff.php/ZendEngine2/zend_vm_execute.h?r1=1.9&r2=1.10&ty=u Index: ZendEngine2/zend_vm_execute.h diff -u ZendEngine2/zend_vm_execute.h:1.9 ZendEngine2/zend_vm_execute.h:1.10 --- ZendEngine2/zend_vm_execute.h:1.9 Tue Jan 11 16:53:10 2005 +++ ZendEngine2/zend_vm_execute.h Wed Jan 12 04:18:30 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_execute.h,v 1.9 2005/01/11 21:53:10 moriyoshi Exp $ */ +/* $Id: zend_vm_execute.h,v 1.10 2005/01/12 09:18:30 dmitry Exp $ */ #define ZEND_VM_CONTINUE() return 0 @@ -9010,16 +9010,25 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - 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; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + if (offset->type == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -10325,16 +10334,25 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - 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; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + if (offset->type == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -11661,16 +11679,25 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - 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; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + if (offset->type == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -13127,16 +13154,25 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - 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; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + if (offset->type == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -14193,16 +14229,25 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - 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; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + if (offset->type == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -15142,16 +15187,25 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - 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; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + if (offset->type == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -16091,16 +16145,25 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - 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; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + if (offset->type == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -17159,16 +17222,25 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - 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; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + if (offset->type == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -19644,16 +19716,25 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - 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; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + if (offset->type == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -20959,16 +21040,25 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - 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; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + if (offset->type == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -22295,16 +22385,25 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - 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; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + if (offset->type == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -23761,16 +23860,25 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - 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; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + if (offset->type == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -30827,16 +30935,25 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - 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; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + if (offset->type == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { http://cvs.php.net/diff.php/ZendEngine2/zend_vm_opcodes.h?r1=1.2&r2=1.3&ty=u Index: ZendEngine2/zend_vm_opcodes.h diff -u ZendEngine2/zend_vm_opcodes.h:1.2 ZendEngine2/zend_vm_opcodes.h:1.3 --- ZendEngine2/zend_vm_opcodes.h:1.2 Mon Jan 10 09:57:36 2005 +++ ZendEngine2/zend_vm_opcodes.h Wed Jan 12 04:18:31 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_opcodes.h,v 1.2 2005/01/10 14:57:36 sniper Exp $ */ +/* $Id: zend_vm_opcodes.h,v 1.3 2005/01/12 09:18:31 dmitry Exp $ */ #define ZEND_NOP 0 #define ZEND_ADD 1 http://cvs.php.net/diff.php/ZendEngine2/tests/bug31098.phpt?r1=1.1&r2=1.2&ty=u Index: ZendEngine2/tests/bug31098.phpt diff -u ZendEngine2/tests/bug31098.phpt:1.1 ZendEngine2/tests/bug31098.phpt:1.2 --- ZendEngine2/tests/bug31098.phpt:1.1 Tue Jan 11 16:57:01 2005 +++ ZendEngine2/tests/bug31098.phpt Wed Jan 12 04:18:31 2005 @@ -14,12 +14,44 @@ var_dump(isset($a{'b'})); $a = '0'; var_dump(isset($a{'b'})); + +$simpleString = "Bogus String Text"; +echo isset($simpleString->wrong)?"bug\n":"ok\n"; +echo isset($simpleString["wrong"])?"bug\n":"ok\n"; +echo isset($simpleString[-1])?"bug\n":"ok\n"; +echo isset($simpleString[0])?"ok\n":"bug\n"; +echo isset($simpleString["0"])?"ok\n":"bug\n"; +echo isset($simpleString["16"])?"ok\n":"bug\n"; +echo isset($simpleString["17"])?"bug\n":"ok\n"; +echo isset($simpleString["wrong"][0])?"bug\n":"ok\n"; +echo $simpleString->wrong === null?"ok\n":"bug\n"; +echo $simpleString["wrong"] === null?"ok\n":"bug\n"; +echo $simpleString["0"] === "B"?"ok\n":"bug\n"; +$simpleString["wrong"] = "f"; +echo $simpleString["0"] === "B"?"ok\n":"bug\n"; ?> --EXPECTF-- bool(false) bool(false) bool(false) bool(false) -bool(true) -bool(true) +bool(false) +bool(false) +ok +ok +ok +ok +ok +ok +ok +ok + +Notice: Trying to get property of non-object in %sbug31098.php on line %d +ok + +Notice: Trying to get string index from a string in %sbug31098.php on line %d +ok +ok +Notice: Trying to get string index from a string in %sbug31098.php on line %d +ok
http://cvs.php.net/diff.php/ZendEngine2/zend_execute.c?r1=1.687&r2=1.688&ty=u Index: ZendEngine2/zend_execute.c diff -u ZendEngine2/zend_execute.c:1.687 ZendEngine2/zend_execute.c:1.688 --- ZendEngine2/zend_execute.c:1.687 Mon Dec 27 08:43:25 2004 +++ ZendEngine2/zend_execute.c Wed Jan 12 04:18:30 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute.c,v 1.687 2004/12/27 13:43:25 dmitry Exp $ */ +/* $Id: zend_execute.c,v 1.688 2005/01/12 09:18:30 dmitry Exp $ */ #define ZEND_INTENSIVE_DEBUGGING 0 @@ -1190,7 +1190,28 @@ zend_error_noreturn(E_ERROR, "[] operator not supported for strings"); } - if (dim->type != IS_LONG) { + if (Z_TYPE_P(dim) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(dim); + if (is_numeric_string(strval, Z_STRLEN_P(dim), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + dim = &tmp; + } else { + if (type != BP_VAR_IS && type != BP_VAR_UNSET) { + zend_error(E_NOTICE, "Trying to get string index from a string"); + } + if (result) { + result->var.ptr_ptr = &EG(error_zval_ptr); + PZVAL_LOCK(*result->var.ptr_ptr); + if (type == BP_VAR_R || type == BP_VAR_IS) { + AI_USE_PTR(result->var); + } + } + return; + } + } else if (dim->type != IS_LONG) { tmp = *dim; zval_copy_ctor(&tmp); convert_to_long(&tmp); http://cvs.php.net/diff.php/ZendEngine2/zend_vm_def.h?r1=1.7&r2=1.8&ty=u Index: ZendEngine2/zend_vm_def.h diff -u ZendEngine2/zend_vm_def.h:1.7 ZendEngine2/zend_vm_def.h:1.8 --- ZendEngine2/zend_vm_def.h:1.7 Mon Jan 10 09:57:35 2005 +++ ZendEngine2/zend_vm_def.h Wed Jan 12 04:18:30 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_def.h,v 1.7 2005/01/10 14:57:35 sniper Exp $ */ +/* $Id: zend_vm_def.h,v 1.8 2005/01/12 09:18:30 dmitry Exp $ */ ZEND_VM_HANDLER(1, ZEND_ADD, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) { @@ -3190,26 +3190,37 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - if (Z_TYPE_P(offset) != IS_LONG) { - tmp_offset = *offset; - zval_copy_ctor(&tmp_offset); - convert_to_long(&tmp_offset); - offset = &tmp_offset; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; + } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; } - 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 (offset->type == IS_LONG) { + 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/diff.php/ZendEngine2/zend_vm_execute.h?r1=1.9&r2=1.10&ty=u Index: ZendEngine2/zend_vm_execute.h diff -u ZendEngine2/zend_vm_execute.h:1.9 ZendEngine2/zend_vm_execute.h:1.10 --- ZendEngine2/zend_vm_execute.h:1.9 Tue Jan 11 16:53:10 2005 +++ ZendEngine2/zend_vm_execute.h Wed Jan 12 04:18:30 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_execute.h,v 1.9 2005/01/11 21:53:10 moriyoshi Exp $ */ +/* $Id: zend_vm_execute.h,v 1.10 2005/01/12 09:18:30 dmitry Exp $ */ #define ZEND_VM_CONTINUE() return 0 @@ -9010,16 +9010,25 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - 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; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + if (offset->type == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -10325,16 +10334,25 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - 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; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + if (offset->type == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -11661,16 +11679,25 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - 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; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + if (offset->type == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -13127,16 +13154,25 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - 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; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + if (offset->type == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -14193,16 +14229,25 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - 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; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + if (offset->type == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -15142,16 +15187,25 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - 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; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + if (offset->type == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -16091,16 +16145,25 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - 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; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + if (offset->type == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -17159,16 +17222,25 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - 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; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + if (offset->type == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -19644,16 +19716,25 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - 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; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + if (offset->type == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -20959,16 +21040,25 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - 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; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + if (offset->type == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -22295,16 +22385,25 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - 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; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + if (offset->type == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -23761,16 +23860,25 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - 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; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + if (offset->type == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { @@ -30827,16 +30935,25 @@ } else { result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); } - } else if ((*container)->type == IS_STRING) { /* string offsets */ - zval tmp_offset; + } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ + zval tmp; - 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; + if (Z_TYPE_P(offset) == IS_STRING) { + char *strval; + long lval; + + strval = Z_STRVAL_P(offset); + if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { + ZVAL_LONG(&tmp, lval); + offset = &tmp; } + } else if (offset->type != IS_LONG) { + tmp = *offset; + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + if (offset->type == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { http://cvs.php.net/diff.php/ZendEngine2/zend_vm_opcodes.h?r1=1.2&r2=1.3&ty=u Index: ZendEngine2/zend_vm_opcodes.h diff -u ZendEngine2/zend_vm_opcodes.h:1.2 ZendEngine2/zend_vm_opcodes.h:1.3 --- ZendEngine2/zend_vm_opcodes.h:1.2 Mon Jan 10 09:57:36 2005 +++ ZendEngine2/zend_vm_opcodes.h Wed Jan 12 04:18:31 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_opcodes.h,v 1.2 2005/01/10 14:57:36 sniper Exp $ */ +/* $Id: zend_vm_opcodes.h,v 1.3 2005/01/12 09:18:31 dmitry Exp $ */ #define ZEND_NOP 0 #define ZEND_ADD 1 http://cvs.php.net/diff.php/ZendEngine2/tests/bug31098.phpt?r1=1.1&r2=1.2&ty=u Index: ZendEngine2/tests/bug31098.phpt diff -u ZendEngine2/tests/bug31098.phpt:1.1 ZendEngine2/tests/bug31098.phpt:1.2 --- ZendEngine2/tests/bug31098.phpt:1.1 Tue Jan 11 16:57:01 2005 +++ ZendEngine2/tests/bug31098.phpt Wed Jan 12 04:18:31 2005 @@ -14,12 +14,44 @@ var_dump(isset($a{'b'})); $a = '0'; var_dump(isset($a{'b'})); + +$simpleString = "Bogus String Text"; +echo isset($simpleString->wrong)?"bug\n":"ok\n"; +echo isset($simpleString["wrong"])?"bug\n":"ok\n"; +echo isset($simpleString[-1])?"bug\n":"ok\n"; +echo isset($simpleString[0])?"ok\n":"bug\n"; +echo isset($simpleString["0"])?"ok\n":"bug\n"; +echo isset($simpleString["16"])?"ok\n":"bug\n"; +echo isset($simpleString["17"])?"bug\n":"ok\n"; +echo isset($simpleString["wrong"][0])?"bug\n":"ok\n"; +echo $simpleString->wrong === null?"ok\n":"bug\n"; +echo $simpleString["wrong"] === null?"ok\n":"bug\n"; +echo $simpleString["0"] === "B"?"ok\n":"bug\n"; +$simpleString["wrong"] = "f"; +echo $simpleString["0"] === "B"?"ok\n":"bug\n"; ?> --EXPECTF-- bool(false) bool(false) bool(false) bool(false) -bool(true) -bool(true) +bool(false) +bool(false) +ok +ok +ok +ok +ok +ok +ok +ok + +Notice: Trying to get property of non-object in %sbug31098.php on line %d +ok + +Notice: Trying to get string index from a string in %sbug31098.php on line %d +ok +ok +Notice: Trying to get string index from a string in %sbug31098.php on line %d +ok