mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
ext/finfo: Deprecate the parameter for finfo_buffer() (#19378)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_context_parameter_for_finfo_buffer
This commit is contained in:
parent
c064fc4fe8
commit
ba21ab4ea0
2 changed files with 27 additions and 0 deletions
|
@ -343,6 +343,13 @@ PHP_FUNCTION(finfo_buffer)
|
||||||
RETURN_THROWS();
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ZEND_NUM_ARGS() == 4 || (hasThis() && ZEND_NUM_ARGS() == 3)) {
|
||||||
|
php_error_docref(NULL, E_DEPRECATED, "The $context parameter has no effect for finfo_buffer()");
|
||||||
|
if (UNEXPECTED(EG(exception))) {
|
||||||
|
RETURN_THROWS();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!Z_FINFO_P(self)->magic) {
|
if (!Z_FINFO_P(self)->magic) {
|
||||||
zend_throw_error(NULL, "Invalid finfo object");
|
zend_throw_error(NULL, "Invalid finfo object");
|
||||||
RETURN_THROWS();
|
RETURN_THROWS();
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
--TEST--
|
||||||
|
finfo_buffer() deprecated $context param
|
||||||
|
--EXTENSIONS--
|
||||||
|
fileinfo
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$finfo = finfo_open();
|
||||||
|
$buffer = "Regular string here";
|
||||||
|
|
||||||
|
var_dump(finfo_buffer($finfo, $buffer, FILEINFO_NONE, null));
|
||||||
|
var_dump($finfo->buffer($buffer, FILEINFO_NONE, null));
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
Deprecated: finfo_buffer(): The $context parameter has no effect for finfo_buffer() in %s on line %d
|
||||||
|
string(36) "ASCII text, with no line terminators"
|
||||||
|
|
||||||
|
Deprecated: finfo::buffer(): The $context parameter has no effect for finfo_buffer() in %s on line %d
|
||||||
|
string(36) "ASCII text, with no line terminators"
|
Loading…
Add table
Add a link
Reference in a new issue