Skip to content

Commit f3a5f07

Browse files
committed
Improved Sys::isFunc()
1 parent 6d91404 commit f3a5f07

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/Sys.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,11 @@ public static function iniSet(string $phpIniKey, string $newValue): bool
9999
* Alias fo ini_get function
100100
*
101101
* @param string $varName
102-
* @return string|null
102+
* @return string
103103
*/
104-
public static function iniGet(string $varName): ?string
104+
public static function iniGet(string $varName): string
105105
{
106-
if (self::isFunc('ini_get')) {
107-
return (string)ini_get($varName);
108-
}
109-
110-
return null;
106+
return (string)ini_get($varName);
111107
}
112108

113109
/**
@@ -118,7 +114,12 @@ public static function iniGet(string $varName): ?string
118114
*/
119115
public static function isFunc($funcName): bool
120116
{
121-
return is_callable($funcName) || (is_string($funcName) && function_exists($funcName));
117+
$isEnabled = true;
118+
if (is_string($funcName)) {
119+
$isEnabled = stripos(self::iniGet('disable_functions'), strtolower(trim($funcName))) === false;
120+
}
121+
122+
return $isEnabled && (is_callable($funcName) || (is_string($funcName) && function_exists($funcName)));
122123
}
123124

124125
/**

0 commit comments

Comments
 (0)