X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/f6e894a53af83a69f553555cb4a6248d57a58391..b1d490ea53c2fddb3fe2c5466267e898e87e743e:/lib-php/Shell.php diff --git a/lib-php/Shell.php b/lib-php/Shell.php index 52a7d8fb..4bec20e9 100644 --- a/lib-php/Shell.php +++ b/lib-php/Shell.php @@ -33,7 +33,9 @@ class Shell public function addEnvPair($sKey, $sVal) { if (isset($sKey) && $sKey && isset($sVal)) { - if (!isset($this->aEnv)) $this->aEnv = $_ENV; + if (!isset($this->aEnv)) { + $this->aEnv = $_ENV; + } $this->aEnv = array_merge($this->aEnv, array($sKey => $sVal), $_ENV); } return $this; @@ -48,7 +50,7 @@ class Shell return join(' ', $aEscaped); } - public function run($bExitOnFail = False) + public function run($bExitOnFail = false) { $sCmd = $this->escapedCmd(); // $aEnv does not need escaping, proc_open seems to handle it fine @@ -75,11 +77,8 @@ class Shell return $iStat; } - - private function escapeParam($sParam) { - if (preg_match('/^-*\w+$/', $sParam)) return $sParam; - return escapeshellarg($sParam); + return (preg_match('/^-*\w+$/', $sParam)) ? $sParam : escapeshellarg($sParam); } }