mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Fix GH-20771: Assertion failure when getUnicodeHost() returns empty string
If nothing was added to a smart_str, the interned empty string is returned, and therefore ZVAL_NEW_STR is wrong as it'll set the REFCOUNTED flag. Closes GH-20773.
This commit is contained in:
4
NEWS
4
NEWS
@@ -50,6 +50,10 @@ PHP NEWS
|
||||
- Standard:
|
||||
. Fix error check for proc_open() command. (ndossche)
|
||||
|
||||
- URI:
|
||||
. Fixed bug GH-20771 (Assertion failure when getUnicodeHost() returns
|
||||
empty string). (ndossche)
|
||||
|
||||
18 Dec 2025, PHP 8.5.1
|
||||
|
||||
- Core:
|
||||
|
||||
14
ext/uri/tests/whatwg/getters/gh20771.phpt
Normal file
14
ext/uri/tests/whatwg/getters/gh20771.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
GH-20771 (Assertion failure when getUnicodeHost() returns empty string)
|
||||
--EXTENSIONS--
|
||||
uri
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$url = Uri\WhatWg\Url::parse('test://');
|
||||
|
||||
var_dump($url->getUnicodeHost());
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(0) ""
|
||||
@@ -365,7 +365,7 @@ static zend_result php_uri_parser_whatwg_host_read(void *uri, php_uri_component_
|
||||
lxb_url_serialize_host_unicode(&lexbor_idna, &lexbor_uri->host, serialize_to_smart_str_callback, &host_str);
|
||||
lxb_unicode_idna_clean(&lexbor_idna);
|
||||
|
||||
ZVAL_NEW_STR(retval, smart_str_extract(&host_str));
|
||||
ZVAL_STR(retval, smart_str_extract(&host_str));
|
||||
break;
|
||||
}
|
||||
case PHP_URI_COMPONENT_READ_MODE_NORMALIZED_ASCII:
|
||||
|
||||
Reference in New Issue
Block a user