diff options
-rw-r--r-- | Zend/tests/bug53971.phpt | 11 | ||||
-rw-r--r-- | Zend/zend_execute.c | 4 |
2 files changed, 14 insertions, 1 deletions
diff --git a/Zend/tests/bug53971.phpt b/Zend/tests/bug53971.phpt new file mode 100644 index 0000000000..a1e66cc51e --- /dev/null +++ b/Zend/tests/bug53971.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #53971 (isset() and empty() produce apparently spurious runtime error) +--FILE-- +<?php +$s = ""; +var_dump(isset($s[0][0])); +?> +--EXPECT-- +bool(false) + + diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 26de484f58..264ecefc14 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1258,7 +1258,9 @@ static void zend_fetch_dimension_address_read(temp_variable *result, zval **cont Z_TYPE_P(ptr) = IS_STRING; if (Z_LVAL_P(dim) < 0 || Z_STRLEN_P(container) <= Z_LVAL_P(dim)) { - zend_error(E_NOTICE, "Uninitialized string offset: %ld", Z_LVAL_P(dim)); + if (type != BP_VAR_IS) { + zend_error(E_NOTICE, "Uninitialized string offset: %ld", Z_LVAL_P(dim)); + } Z_STRVAL_P(ptr) = STR_EMPTY_ALLOC(); Z_STRLEN_P(ptr) = 0; } else { |