Skip to content

Commit f5bb75a

Browse files
committed
Deprecate ReflectionFunction::isDisabled()
1 parent dc9e9fc commit f5bb75a

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

ext/reflection/php_reflection.stub.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,10 @@ public function __construct($name) {}
104104

105105
public function __toString(): string {}
106106

107-
/** @return bool */
107+
/**
108+
* @return bool
109+
* @deprecated ReflectionFunction can no longer be constructed for disabled functions
110+
*/
108111
public function isDisabled() {}
109112

110113
/** @return mixed */

ext/reflection/php_reflection_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ static const zend_function_entry class_ReflectionFunctionAbstract_methods[] = {
694694
static const zend_function_entry class_ReflectionFunction_methods[] = {
695695
ZEND_ME(ReflectionFunction, __construct, arginfo_class_ReflectionFunction___construct, ZEND_ACC_PUBLIC)
696696
ZEND_ME(ReflectionFunction, __toString, arginfo_class_ReflectionFunction___toString, ZEND_ACC_PUBLIC)
697-
ZEND_ME(ReflectionFunction, isDisabled, arginfo_class_ReflectionFunction_isDisabled, ZEND_ACC_PUBLIC)
697+
ZEND_ME(ReflectionFunction, isDisabled, arginfo_class_ReflectionFunction_isDisabled, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED)
698698
ZEND_ME(ReflectionFunction, invoke, arginfo_class_ReflectionFunction_invoke, ZEND_ACC_PUBLIC)
699699
ZEND_ME(ReflectionFunction, invokeArgs, arginfo_class_ReflectionFunction_invokeArgs, ZEND_ACC_PUBLIC)
700700
ZEND_ME(ReflectionFunction, getClosure, arginfo_class_ReflectionFunction_getClosure, ZEND_ACC_PUBLIC)

ext/reflection/tests/ReflectionFunction_isDisabled_basic.phpt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@ disable_functions=is_file
88
--FILE--
99
<?php
1010
try {
11-
$rc = new ReflectionFunction('is_file');
12-
var_dump($rc->isDisabled());
11+
$rf = new ReflectionFunction('is_file');
12+
var_dump($rf->isDisabled());
1313
} catch (ReflectionException $e) {
1414
echo $e->getMessage(), "\n";
1515
}
16+
17+
$rf = new ReflectionFunction('is_string');
18+
var_dump($rf->isDisabled());
1619
?>
17-
--EXPECT--
20+
--EXPECTF--
1821
Function is_file() does not exist
22+
23+
Deprecated: Function ReflectionFunction::isDisabled() is deprecated in %s on line %d
24+
bool(false)

0 commit comments

Comments
 (0)