mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Fix refcounting on zend_empty_array in ext-uri (GH-19908)
Fixes GH-19892
This commit is contained in:
1
NEWS
1
NEWS
@@ -58,6 +58,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).
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
12
ext/uri/tests/gh19892.phpt
Normal file
12
ext/uri/tests/gh19892.phpt
Normal file
@@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
GH-19892: Successful \Uri\WhatWg\Url::parse() with empty errors array
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
\Uri\WhatWg\Url::parse('https://example.com', errors: $errors);
|
||||
var_dump($errors);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(0) {
|
||||
}
|
||||
Reference in New Issue
Block a user