Skip to content

Commit

Permalink
Improved Sys::isFunc()
Browse files Browse the repository at this point in the history
  • Loading branch information
SmetDenis committed Jul 29, 2020
1 parent 6d91404 commit f3a5f07
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/Sys.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,11 @@ public static function iniSet(string $phpIniKey, string $newValue): bool
* Alias fo ini_get function
*
* @param string $varName
* @return string|null
* @return string
*/
public static function iniGet(string $varName): ?string
public static function iniGet(string $varName): string
{
if (self::isFunc('ini_get')) {
return (string)ini_get($varName);
}

return null;
return (string)ini_get($varName);
}

/**
Expand All @@ -118,7 +114,12 @@ public static function iniGet(string $varName): ?string
*/
public static function isFunc($funcName): bool
{
return is_callable($funcName) || (is_string($funcName) && function_exists($funcName));
$isEnabled = true;
if (is_string($funcName)) {
$isEnabled = stripos(self::iniGet('disable_functions'), strtolower(trim($funcName))) === false;
}

return $isEnabled && (is_callable($funcName) || (is_string($funcName) && function_exists($funcName)));
}

/**
Expand Down

0 comments on commit f3a5f07

Please sign in to comment.