Skip to content

Commit

Permalink
Fix Bug #81462 mime_content_type() indicates wrong arg num on TypeError
Browse files Browse the repository at this point in the history
  • Loading branch information
Girgias committed Sep 20, 2021
1 parent fbc922d commit 0ea38b9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ext/fileinfo/fileinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime
break;

default:
zend_argument_type_error(2, "must be of type resource|string, %s given", zend_zval_type_name(what));
zend_argument_type_error(1, "must be of type resource|string, %s given", zend_zval_type_name(what));
RETURN_THROWS();
}

Expand Down
8 changes: 4 additions & 4 deletions ext/fileinfo/tests/mime_content_type_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ try {

?>
--EXPECTF--
mime_content_type(): Argument #2 must be of type resource|string, int given
mime_content_type(): Argument #2 must be of type resource|string, null given
mime_content_type(): Argument #2 must be of type resource|string, stdClass given
mime_content_type(): Argument #2 must be of type resource|string, array given
mime_content_type(): Argument #1 ($filename) must be of type resource|string, int given
mime_content_type(): Argument #1 ($filename) must be of type resource|string, null given
mime_content_type(): Argument #1 ($filename) must be of type resource|string, stdClass given
mime_content_type(): Argument #1 ($filename) must be of type resource|string, array given

Warning: mime_content_type(foo/inexistent): Failed to open stream: No such file or directory in %s on line %d
mime_content_type(): Argument #1 ($filename) cannot be empty
Expand Down

0 comments on commit 0ea38b9

Please sign in to comment.