diff --git a/ext/uri/tests/whatwg/modification/fragment_success_hashmark.phpt b/ext/uri/tests/whatwg/modification/fragment_success_hashmark.phpt index 12ce6d6e6b64d..4639d993df04d 100644 --- a/ext/uri/tests/whatwg/modification/fragment_success_hashmark.phpt +++ b/ext/uri/tests/whatwg/modification/fragment_success_hashmark.phpt @@ -15,5 +15,5 @@ var_dump($url2->toAsciiString()); ?> --EXPECT-- NULL -NULL +string(0) "" string(21) "https://example.com/#" diff --git a/ext/uri/tests/whatwg/modification/query_success_question_mark.phpt b/ext/uri/tests/whatwg/modification/query_success_question_mark.phpt index 18a1593a9819a..3e1bf5ab9dce5 100644 --- a/ext/uri/tests/whatwg/modification/query_success_question_mark.phpt +++ b/ext/uri/tests/whatwg/modification/query_success_question_mark.phpt @@ -15,5 +15,5 @@ var_dump($url2->toAsciiString()); ?> --EXPECT-- NULL -NULL +string(0) "" string(21) "https://example.com/?" diff --git a/ext/uri/uri_parser_whatwg.c b/ext/uri/uri_parser_whatwg.c index ef9bf0e020c34..2e9ffad22d463 100644 --- a/ext/uri/uri_parser_whatwg.c +++ b/ext/uri/uri_parser_whatwg.c @@ -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; - 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); } else { 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; - if (lexbor_uri->query.length) { + if (lexbor_uri->query.data != NULL) { ZVAL_STRINGL(retval, (const char *) lexbor_uri->query.data, lexbor_uri->query.length); } else { 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; - if (lexbor_uri->fragment.length) { + if (lexbor_uri->fragment.data != NULL) { ZVAL_STRINGL(retval, (const char *) lexbor_uri->fragment.data, lexbor_uri->fragment.length); } else { ZVAL_NULL(retval);