Skip to content

Commit ea83eba

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
2 parents 1663ed6 + c5e0a6a commit ea83eba

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

NEWS

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ PHP NEWS
2323
. Fixed bug GH-15654 (Signed integer overflow in ext/dom/nodelist.c).
2424
(nielsdos)
2525

26+
- Fileinfo:
27+
. Fixed bug GH-15752 (Incorrect error message for finfo_file
28+
with an empty filename argument). (DanielEScherzer)
29+
2630
- MySQLnd:
2731
. Fixed bug GH-15432 (Heap corruption when querying a vector). (cmb,
2832
Kamil Tekiela)

ext/fileinfo/fileinfo.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -373,12 +373,14 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime
373373
php_stream_wrapper *wrap;
374374
php_stream_statbuf ssb;
375375

376+
// Implementation is used for both finfo_file() and mimetype_emu()
377+
int buffer_param_num = (mimetype_emu ? 1 : 2);
376378
if (buffer == NULL || buffer_len == 0) {
377-
zend_argument_value_error(1, "cannot be empty");
379+
zend_argument_value_error(buffer_param_num, "cannot be empty");
378380
goto clean;
379381
}
380382
if (CHECK_NULL_PATH(buffer, buffer_len)) {
381-
zend_argument_type_error(1, "must not contain any null bytes");
383+
zend_argument_type_error(buffer_param_num, "must not contain any null bytes");
382384
goto clean;
383385
}
384386

ext/fileinfo/tests/finfo_file_001.phpt

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ var_dump(finfo_file($fp, '&'));
2121

2222
?>
2323
--EXPECTF--
24-
finfo_file(): Argument #1 ($finfo) must not contain any null bytes
25-
finfo_file(): Argument #1 ($finfo) cannot be empty
24+
finfo_file(): Argument #2 ($filename) must not contain any null bytes
25+
finfo_file(): Argument #2 ($filename) cannot be empty
2626
string(9) "directory"
2727

2828
Warning: finfo_file(&): Failed to open stream: No such file or directory in %s on line %d

ext/fileinfo/tests/finfo_file_basic.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ try {
2525
string(28) "text/x-php; charset=us-ascii"
2626
string(22) "PHP script, ASCII text"
2727
string(28) "text/plain; charset=us-ascii"
28-
finfo_file(): Argument #1 ($finfo) must not contain any null bytes
28+
finfo_file(): Argument #2 ($filename) must not contain any null bytes

0 commit comments

Comments
 (0)