From: Dmitry Stogov Date: Mon, 14 Feb 2011 08:46:53 +0000 (+0000) Subject: Fixed Bug #53971 (isset() and empty() produce apparently spurious runtime error) X-Git-Tag: php-5.3.6RC1~15 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ac057c610cbdce68ed3de5d7e4dfd5907dcb6f49;p=php Fixed Bug #53971 (isset() and empty() produce apparently spurious runtime error) --- diff --git a/NEWS b/NEWS index 46b17377f7..72c83eae11 100644 --- 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 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-- + +--EXPECT-- +bool(false) + + diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 7a1a7c6e62..e270816d8b 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -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;