Skip to content

Commit 11ce662

Browse files
committed
lexbor: Cherry pick "Core: Reset length in lexbor_str_destroy()"
see lexbor/lexbor@1bc9944 Fixes #19979
1 parent 8987c0b commit 11ce662

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

NEWS

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ PHP NEWS
66
. Fixed segfault in function JIT due to NAN to bool warning. (Girgias)
77

88
- URI:
9-
. Fixed Uri\WhatWg\Url::withPort() when an invalid value is passed. (timwolla)
9+
. Fixed Uri\WhatWg\Url::withPort() when an invalid value is passed.
10+
(timwolla)
11+
. Fixed Uri\WhatWg\Url::parse() when resolving a relative URL
12+
against a base URL with query or fragment. (timwolla)
1013

1114
- SOAP:
1215
. Fixed bug GH-19773 (SIGSEGV due to uninitialized soap_globals->lang_en).

ext/lexbor/lexbor/core/str.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ lexbor_str_destroy(lexbor_str_t *str, lexbor_mraw_t *mraw, bool destroy_obj)
8080
}
8181

8282
if (str->data != NULL) {
83+
lexbor_str_clean(str);
8384
str->data = lexbor_mraw_free(mraw, str->data);
8485
}
8586

ext/uri/tests/gh19979.phpt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
--TEST--
2+
GH-19979: Zend/zend_string.h:191:24: runtime error: null pointer passed as argument 2, which is declared to never be null
3+
--FILE--
4+
<?php
5+
6+
$baseUrl = \Uri\WhatWg\Url::parse('https://example.com/path?query');
7+
var_dump(\Uri\WhatWg\Url::parse('relative', $baseUrl));
8+
9+
?>
10+
--EXPECTF--
11+
object(Uri\WhatWg\Url)#%d (8) {
12+
["scheme"]=>
13+
string(5) "https"
14+
["username"]=>
15+
NULL
16+
["password"]=>
17+
NULL
18+
["host"]=>
19+
string(11) "example.com"
20+
["port"]=>
21+
NULL
22+
["path"]=>
23+
string(9) "/relative"
24+
["query"]=>
25+
NULL
26+
["fragment"]=>
27+
NULL
28+
}

0 commit comments

Comments
 (0)