diff --git a/NEWS b/NEWS index 7b6f8f9440d83..28e538080bdba 100644 --- a/NEWS +++ b/NEWS @@ -55,6 +55,7 @@ PHP NEWS . Add new Uri\UriError exception that is thrown for internal error conditions. (timwolla) . Further clean up the internal API. (timwolla) + . Fixed bug GH-19892 (Refcounting on zend_empty_array). (ilutov, timwolla) - Windows: . Fix GH-19722 (_get_osfhandle asserts in debug mode when given a socket). diff --git a/Zend/zend_API.h b/Zend/zend_API.h index f4a6fc5f50e9d..8cde8317530e4 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -1364,6 +1364,7 @@ ZEND_API zend_result zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval #define ZEND_TRY_ASSIGN_REF_ARR(zv, arr) do { \ ZEND_ASSERT(Z_ISREF_P(zv)); \ + ZEND_ASSERT(!(GC_FLAGS(arr) & GC_IMMUTABLE)); \ _ZEND_TRY_ASSIGN_ARR(zv, arr, 1); \ } while (0) diff --git a/ext/uri/php_uri.c b/ext/uri/php_uri.c index bfe14e117477f..308c54ddc4a86 100644 --- a/ext/uri/php_uri.c +++ b/ext/uri/php_uri.c @@ -308,7 +308,7 @@ static zend_result pass_errors_by_ref_and_free(zval *errors_zv, zval *errors) return SUCCESS; } - ZEND_TRY_ASSIGN_REF_ARR(errors_zv, Z_ARRVAL_P(errors)); + ZEND_TRY_ASSIGN_REF_TMP(errors_zv, errors); if (EG(exception)) { return FAILURE; } diff --git a/ext/uri/tests/gh19892.phpt b/ext/uri/tests/gh19892.phpt new file mode 100644 index 0000000000000..42a9c660e0d05 --- /dev/null +++ b/ext/uri/tests/gh19892.phpt @@ -0,0 +1,12 @@ +--TEST-- +GH-19892: Successful \Uri\WhatWg\Url::parse() with empty errors array +--FILE-- + +--EXPECT-- +array(0) { +}