Skip to content

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

Closed
wants to merge 2 commits into from

Conversation

Girgias
Copy link
Member

@Girgias Girgias commented Jul 31, 2020

Not sure how we deal with resource types in union?
@kocsismate as the expert here on error messages, what do you recommend?

@@ -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
Copy link
Member

@kocsismate kocsismate Jul 31, 2020

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

@@ -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));
Copy link
Member

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.

@Girgias Girgias force-pushed the fileinfo-warning-to-error branch from 05d03fb to 0b54e61 Compare July 31, 2020 18:56
@Girgias
Copy link
Member Author

Girgias commented Aug 1, 2020

CI Failure is unrelated

@php-pulls php-pulls closed this in 196f8fd Aug 6, 2020
@Girgias Girgias deleted the fileinfo-warning-to-error branch August 6, 2020 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants