-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Notice and Warning promotion in ext/zip #5823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Sorry but I don't like this one, especially the In previous versions, we don't have any notice/warning And I don't think we should be stricter than function arg parsing, so only raise exception in strict mode. |
Are these notices/warnings new in PHP 8?
I'm not sure what you mean by this? PHP 8 will throw type errors even for internal functions and not return |
I mean that
run without any error. |
ext/zip/php_zip.c
Outdated
zend_zval_type_name(option)); | ||
return false; | ||
} | ||
opts->remove_all_path = Z_LVAL_P(option); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is where I say we have no waning in previous version.
Okay, I see now, so if I drop the changes in |
I'm mostly fine with I will read other change after the week-end. |
6132ee3
to
be98aae
Compare
ext/zip/php_zip.c
Outdated
@@ -348,25 +349,62 @@ static int php_zip_parse_options(HashTable *options, zip_options *opts) | |||
#endif | |||
|
|||
if ((option = zend_hash_str_find(options, "remove_all_path", sizeof("remove_all_path") - 1)) != NULL) { | |||
if (Z_TYPE_P(option) != IS_FALSE && Z_TYPE_P(option) != IS_TRUE) { | |||
if (ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any precedent for this? I don't remember us making strict_types distinctions for something other than parameters anywhere.
Apart from php_zip_parse_options() this looks pretty good to me. For php_zip_parse_options() I would suggest not to mess with strict_types (which I think we don't do anywhere else) and only add the warnings. The warnings can be converted to errors at a later time then. |
be98aae
to
bb12ed7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, but maybe @remicollet wants to take another look as well.
ext/zip/php_zip.c
Outdated
@@ -334,7 +335,7 @@ typedef struct { | |||
#endif | |||
} zip_options; | |||
|
|||
static int php_zip_parse_options(HashTable *options, zip_options *opts) | |||
static bool php_zip_parse_options(HashTable *options, zip_options *opts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but I don't see any benefit changing this, and it will make merge from lower version harded and risky.
ext/zip/php_zip.c
Outdated
} | ||
|
||
idx = zip_name_locate(intern, name, 0); | ||
// TODO Warning? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove all these TODO.
unrelate to this PR
And returning FALSE is the documented behavior for not found entry.
…ict_types" This reverts commit 9cefc06.
bb12ed7
to
d187b73
Compare
d187b73
to
3364f8b
Compare
Thanks, Squashed and merged |
IMHO Most of these notices should have been warnings already as similar error states to those were warnings in other extensions, therefore I also promoted them to ValueErrors