parse_url raises ValueError in some error code paths.#10465
parse_url raises ValueError in some error code paths.#10465devnexen wants to merge 2 commits intophp:masterfrom
Conversation
|
This would solve phpstan/phpstan#8638, can |
|
no indeed it would not. |
|
looking into the code Line 353 in 56a8baf false is returned only here and in php_url_parse_ex2 you throw before every null return, so if I am not mistaken false is never returned, thus can/should be removed from php-src/ext/standard/basic_functions.stub.php Line 3421 in 56a8baf |
431174d to
0b07df1
Compare
Girgias
left a comment
There was a problem hiding this comment.
This looks sensible, but I don't know if we could make the behaviour default to strict in a minor version :-/
ext/standard/url.c
Outdated
| /* {{{ php_url_parse_ex2 | ||
| */ | ||
| PHPAPI php_url *php_url_parse_ex2(char const *str, size_t length, bool *has_port) | ||
| PHPAPI php_url *php_url_parse_ex2(char const *str, size_t length, bool strict, bool *has_port) |
There was a problem hiding this comment.
The naming is getting out of hand, and we might want to start removing or deprecating the version which just passes a char * (which now that I stare at I don't know if it's the content of the str that is constant or the pointer address that is constant...). Or maybe adding a version which takes a zend_string might be another idea?
But to preserve API BC for extension, it might make sense to move this to a function named php_url_parse_ex3() and passing false as the strict parameter. This looks like it would prevent the diffs in most of the other extensions.
There was a problem hiding this comment.
fair enough I did that on purpose in case we would apply the strictness aspect in a couple of sub modules but I can backpedal on this, no problem.
There was a problem hiding this comment.
oh ok I saw your comment too late
0b07df1 to
d8e4aa3
Compare
|
In my opinion, |
you re surely right albeit this was aiming 8.3 while what you suggest might be more fit 9 |
Bad wording from my side. I don't think we should replace |
|
With the new policy this could go ahead, or maybe we should deprecate the function in favour of the new URI API. |
At this point I would just deprecate and not change anything about |
No description provided.