Skip to content

Commit ba21ab4

Browse files
authored
1 parent c064fc4 commit ba21ab4

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

ext/fileinfo/fileinfo.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,13 @@ PHP_FUNCTION(finfo_buffer)
343343
RETURN_THROWS();
344344
}
345345

346+
if (ZEND_NUM_ARGS() == 4 || (hasThis() && ZEND_NUM_ARGS() == 3)) {
347+
php_error_docref(NULL, E_DEPRECATED, "The $context parameter has no effect for finfo_buffer()");
348+
if (UNEXPECTED(EG(exception))) {
349+
RETURN_THROWS();
350+
}
351+
}
352+
346353
if (!Z_FINFO_P(self)->magic) {
347354
zend_throw_error(NULL, "Invalid finfo object");
348355
RETURN_THROWS();
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
finfo_buffer() deprecated $context param
3+
--EXTENSIONS--
4+
fileinfo
5+
--FILE--
6+
<?php
7+
8+
$finfo = finfo_open();
9+
$buffer = "Regular string here";
10+
11+
var_dump(finfo_buffer($finfo, $buffer, FILEINFO_NONE, null));
12+
var_dump($finfo->buffer($buffer, FILEINFO_NONE, null));
13+
14+
?>
15+
--EXPECTF--
16+
Deprecated: finfo_buffer(): The $context parameter has no effect for finfo_buffer() in %s on line %d
17+
string(36) "ASCII text, with no line terminators"
18+
19+
Deprecated: finfo::buffer(): The $context parameter has no effect for finfo_buffer() in %s on line %d
20+
string(36) "ASCII text, with no line terminators"

0 commit comments

Comments
 (0)