Skip to content

Commit 0ea38b9

Browse files
committed
Fix Bug #81462 mime_content_type() indicates wrong arg num on TypeError
1 parent fbc922d commit 0ea38b9

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

ext/fileinfo/fileinfo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime
380380
break;
381381

382382
default:
383-
zend_argument_type_error(2, "must be of type resource|string, %s given", zend_zval_type_name(what));
383+
zend_argument_type_error(1, "must be of type resource|string, %s given", zend_zval_type_name(what));
384384
RETURN_THROWS();
385385
}
386386

ext/fileinfo/tests/mime_content_type_001.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ try {
4141

4242
?>
4343
--EXPECTF--
44-
mime_content_type(): Argument #2 must be of type resource|string, int given
45-
mime_content_type(): Argument #2 must be of type resource|string, null given
46-
mime_content_type(): Argument #2 must be of type resource|string, stdClass given
47-
mime_content_type(): Argument #2 must be of type resource|string, array given
44+
mime_content_type(): Argument #1 ($filename) must be of type resource|string, int given
45+
mime_content_type(): Argument #1 ($filename) must be of type resource|string, null given
46+
mime_content_type(): Argument #1 ($filename) must be of type resource|string, stdClass given
47+
mime_content_type(): Argument #1 ($filename) must be of type resource|string, array given
4848

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

0 commit comments

Comments
 (0)