ext/uri: Increases test coverage - #23342
Open
NickSdot wants to merge 1 commit into
Open
Conversation
NickSdot
force-pushed
the
hardening/ext-uri-coverage
branch
3 times, most recently
from
September 4, 2026 14:29
10422c5 to
a0562e4
Compare
NickSdot
force-pushed
the
hardening/ext-uri-coverage
branch
from
September 4, 2026 18:32
a0562e4 to
8e4b223
Compare
Contributor
Author
|
Codex proposed the below which sounds sensible, and would add +4 lines/+2 branches. But not sure if it justifies adding another test helper. Thoughts? C Codestatic zend_result zend_test_uri_component_read_failure(
ZEND_ATTRIBUTE_UNUSED void *uri,
ZEND_ATTRIBUTE_UNUSED php_uri_component_read_mode read_mode,
ZEND_ATTRIBUTE_UNUSED zval *retval
) {
return FAILURE;
}
static ZEND_FUNCTION(zend_test_uri_parse_to_struct_failing_fragment)
{
php_uri_parser parser = *php_uri_get_parser(NULL);
parser.property_handler.fragment.read = zend_test_uri_component_read_failure;
php_uri *uri = php_uri_parse_to_struct(
&parser, ZEND_STRL("x://u:p@h:1/p?q#f"), PHP_URI_COMPONENT_READ_MODE_RAW, true
);
RETURN_BOOL(uri == NULL);
}Test Code--TEST--
Test zend_test_uri_parse_to_struct_failing_fragment() - error - fragment retrieval failure
--EXTENSIONS--
zend_test
--FILE--
<?php
var_dump(zend_test_uri_parse_to_struct_failing_fragment());
?>
--EXPECT--
bool(true) |
NickSdot
commented
Sep 4, 2026
| @@ -0,0 +1,23 @@ | |||
| --TEST-- | |||
Contributor
Author
There was a problem hiding this comment.
Debatable if this is worth testing. Thoughts?
NickSdot
marked this pull request as ready for review
September 4, 2026 18:49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is fully Codex made. I threw a coverage report at it to close uncovered lines/branch gaps. It came up with a tonne of edge cases; this PR is the result of me massaging it a bit, and after filtering out nonsense that did not actually increase coverage as well as things that seemed too esoteric. So everything here increases coverage even though things might seem already tested -- that's because of using slightly different api paths.After #23286 and #23551 this is no longer fully Codex made, and was rather a starting point.