Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <tsteur@users.noreply.github.com>2020-11-15 22:23:43 +0300
committerGitHub <noreply@github.com>2020-11-15 22:23:43 +0300
commit0a0b4ba3900ce0504aac9d03f88a89738f2f4e48 (patch)
treeb75af5089a2ab1afca813d1317476097476a9850
parent6dca05e408b0503a4561822b14beaf02ba17241e (diff)
Workaround shell_exec being disabled (#16710)
-rw-r--r--core/CliMulti/CliPhp.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/core/CliMulti/CliPhp.php b/core/CliMulti/CliPhp.php
index 33b4022725..08e963b3af 100644
--- a/core/CliMulti/CliPhp.php
+++ b/core/CliMulti/CliPhp.php
@@ -45,8 +45,8 @@ class CliPhp
$bin = $this->getPhpCommandIfValid($possiblePhpPath);
}
- if (!$this->isValidPhpType($bin)) {
- $bin = shell_exec('which php');
+ if (!$this->isValidPhpType($bin) && function_exists('shell_exec')) {
+ $bin = @shell_exec('which php');
}
if (!$this->isValidPhpType($bin)) {
@@ -73,7 +73,7 @@ class CliPhp
{
global $piwik_minimumPHPVersion;
$cliVersion = $this->getPhpVersion($bin);
- $isCliVersionValid = version_compare($piwik_minimumPHPVersion, $cliVersion) <= 0;
+ $isCliVersionValid = $cliVersion && version_compare($piwik_minimumPHPVersion, $cliVersion) <= 0;
return $isCliVersionValid;
}
@@ -107,7 +107,10 @@ class CliPhp
private function getPhpVersion($bin)
{
$command = sprintf("%s -r 'echo phpversion();'", $bin);
- $version = shell_exec($command);
+ $version = null;
+ if (function_exists('shell_exec')) {
+ $version = @shell_exec($command);
+ }
return $version;
}
}