mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
ext/uri: Fix the distinction between an empty and a missing query/fragment for WHATWG URLs (#20208)
This commit is contained in:
@@ -15,5 +15,5 @@ var_dump($url2->toAsciiString());
|
|||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
NULL
|
NULL
|
||||||
NULL
|
string(0) ""
|
||||||
string(21) "https://example.com/#"
|
string(21) "https://example.com/#"
|
||||||
|
|||||||
@@ -15,5 +15,5 @@ var_dump($url2->toAsciiString());
|
|||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
NULL
|
NULL
|
||||||
NULL
|
string(0) ""
|
||||||
string(21) "https://example.com/?"
|
string(21) "https://example.com/?"
|
||||||
|
|||||||
@@ -431,7 +431,7 @@ static zend_result php_uri_parser_whatwg_path_read(void *uri, php_uri_component_
|
|||||||
{
|
{
|
||||||
const lxb_url_t *lexbor_uri = uri;
|
const lxb_url_t *lexbor_uri = uri;
|
||||||
|
|
||||||
if (lexbor_uri->path.str.length) {
|
if (lexbor_uri->path.str.length > 0) {
|
||||||
ZVAL_STRINGL(retval, (const char *) lexbor_uri->path.str.data, lexbor_uri->path.str.length);
|
ZVAL_STRINGL(retval, (const char *) lexbor_uri->path.str.data, lexbor_uri->path.str.length);
|
||||||
} else {
|
} else {
|
||||||
ZVAL_EMPTY_STRING(retval);
|
ZVAL_EMPTY_STRING(retval);
|
||||||
@@ -460,7 +460,7 @@ static zend_result php_uri_parser_whatwg_query_read(void *uri, php_uri_component
|
|||||||
{
|
{
|
||||||
const lxb_url_t *lexbor_uri = uri;
|
const lxb_url_t *lexbor_uri = uri;
|
||||||
|
|
||||||
if (lexbor_uri->query.length) {
|
if (lexbor_uri->query.data != NULL) {
|
||||||
ZVAL_STRINGL(retval, (const char *) lexbor_uri->query.data, lexbor_uri->query.length);
|
ZVAL_STRINGL(retval, (const char *) lexbor_uri->query.data, lexbor_uri->query.length);
|
||||||
} else {
|
} else {
|
||||||
ZVAL_NULL(retval);
|
ZVAL_NULL(retval);
|
||||||
@@ -489,7 +489,7 @@ static zend_result php_uri_parser_whatwg_fragment_read(void *uri, php_uri_compon
|
|||||||
{
|
{
|
||||||
const lxb_url_t *lexbor_uri = uri;
|
const lxb_url_t *lexbor_uri = uri;
|
||||||
|
|
||||||
if (lexbor_uri->fragment.length) {
|
if (lexbor_uri->fragment.data != NULL) {
|
||||||
ZVAL_STRINGL(retval, (const char *) lexbor_uri->fragment.data, lexbor_uri->fragment.length);
|
ZVAL_STRINGL(retval, (const char *) lexbor_uri->fragment.data, lexbor_uri->fragment.length);
|
||||||
} else {
|
} else {
|
||||||
ZVAL_NULL(retval);
|
ZVAL_NULL(retval);
|
||||||
|
|||||||
Reference in New Issue
Block a user