]> granicus.if.org Git - php/commitdiff
Fixed Bug #53971 (isset() and empty() produce apparently spurious runtime error)
authorDmitry Stogov <dmitry@php.net>
Mon, 14 Feb 2011 08:46:53 +0000 (08:46 +0000)
committerDmitry Stogov <dmitry@php.net>
Mon, 14 Feb 2011 08:46:53 +0000 (08:46 +0000)
NEWS
Zend/tests/bug53971.phpt [new file with mode: 0644]
Zend/zend_execute.c

diff --git a/NEWS b/NEWS
index 46b17377f7060217989ca213884bb205c6ce6250..72c83eae115fd23ed9fde2af1cb04e2533ee9987 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,8 @@
   . Indirect reference to $this fails to resolve if direct $this is never used
     in method. (Scott)
   . Added options to debug backtrace functions. (Stas)
+  . Fixed Bug #53971 (isset() and empty() produce apparently spurious runtime
+    error). (Dmitry)
   . Fixed Bug #53629 (memory leak inside highlight_string()). (Hannes, Ilia)
   . Fixed Bug #51458 (Lack of error context with nested exceptions). (Stas)
   . Fixed Bug #47143 (Throwing an exception in a destructor causes a fatal
diff --git a/Zend/tests/bug53971.phpt b/Zend/tests/bug53971.phpt
new file mode 100644 (file)
index 0000000..a1e66cc
--- /dev/null
@@ -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)
+
+
index 7a1a7c6e624f4cd5cf5f46df138faaf835a0d37c..e270816d8b0ab2c0b33bbc62c086b8a7095a1eca 100644 (file)
@@ -1067,7 +1067,7 @@ static void zend_fetch_dimension_address_read(temp_variable *result, zval **cont
                                        dim = &tmp;
                                }
                                if (result) {
-                                       if (Z_LVAL_P(dim) < 0 || Z_STRLEN_P(container) <= Z_LVAL_P(dim)) {
+                                       if ((Z_LVAL_P(dim) < 0 || Z_STRLEN_P(container) <= Z_LVAL_P(dim)) && type != BP_VAR_IS) {
                                                zend_error(E_NOTICE, "Uninitialized string offset: %ld", Z_LVAL_P(dim));
                                        }
                                        result->str_offset.str = container;