-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Promote warnings to Error in FileInfo extension #5914
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
ext/fileinfo/fileinfo.c
Outdated
@@ -487,6 +485,9 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime | |||
|
|||
default: | |||
php_error_docref(NULL, E_WARNING, "Can only process string or stream arguments"); | |||
// TODO Not sure I understand this code flow completely |
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.
I think this code path can't be reached since you added the type error
ext/fileinfo/fileinfo.c
Outdated
@@ -376,8 +376,8 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime | |||
break; | |||
|
|||
default: | |||
php_error_docref(NULL, E_WARNING, "Can only process string or stream arguments"); | |||
RETURN_FALSE; | |||
zend_argument_type_error(2, "must be of type string|resource, %s given", zend_zval_type_name(what)); |
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.
I think this message is good as-is, although probably the order of the types could be swapped. As far as I saw, object
, array
are both displayed before strings, so maybe it's worth to do the same with resources too.
05d03fb
to
0b54e61
Compare
CI Failure is unrelated |
Not sure how we deal with resource types in union?
@kocsismate as the expert here on error messages, what do you recommend?