Skip to content

Commit b84967d

Browse files
committed
Fixed Bug #53971 (isset() and empty() produce apparently spurious runtime error)
1 parent f912a2d commit b84967d

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

Zend/tests/bug53971.phpt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Bug #53971 (isset() and empty() produce apparently spurious runtime error)
3+
--FILE--
4+
<?php
5+
$s = "";
6+
var_dump(isset($s[0][0]));
7+
?>
8+
--EXPECT--
9+
bool(false)
10+
11+

Zend/zend_execute.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1258,7 +1258,9 @@ static void zend_fetch_dimension_address_read(temp_variable *result, zval **cont
12581258
Z_TYPE_P(ptr) = IS_STRING;
12591259

12601260
if (Z_LVAL_P(dim) < 0 || Z_STRLEN_P(container) <= Z_LVAL_P(dim)) {
1261-
zend_error(E_NOTICE, "Uninitialized string offset: %ld", Z_LVAL_P(dim));
1261+
if (type != BP_VAR_IS) {
1262+
zend_error(E_NOTICE, "Uninitialized string offset: %ld", Z_LVAL_P(dim));
1263+
}
12621264
Z_STRVAL_P(ptr) = STR_EMPTY_ALLOC();
12631265
Z_STRLEN_P(ptr) = 0;
12641266
} else {

0 commit comments

Comments
 (0)