diff options
Diffstat (limited to '1365.patch')
-rw-r--r-- | 1365.patch | 71 |
1 files changed, 36 insertions, 35 deletions
@@ -1,66 +1,67 @@ -From edab489323b587e414564b6417cbb15d7d1b90aa Mon Sep 17 00:00:00 2001 +From c4e4248dbe3352274304e766d6020a4c319fdef6 Mon Sep 17 00:00:00 2001 From: Remi Collet <remi@remirepo.net> Date: Fri, 8 Jun 2018 10:46:04 +0200 -Subject: [PATCH] use PHP_BINARY instead of php and allow override +Subject: [PATCH] use PHP_BINARY instead of php and allow override honours + TEST_PHP_EXECUTABLE and TEST_PHP_ARGS (as standard php tests) --- - tests/RedisTest.php | 10 ++++++---- - tests/TestRedis.php | 2 ++ - 2 files changed, 8 insertions(+), 4 deletions(-) + tests/RedisTest.php | 27 +++++++++++++++++++++++---- + 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/tests/RedisTest.php b/tests/RedisTest.php -index ff0b7537..efb25f2e 100644 +index ff0b7537..cdfa5fd3 100644 --- a/tests/RedisTest.php +++ b/tests/RedisTest.php -@@ -5550,6 +5550,7 @@ private function startSessionProcess($sessionId, $sleepTime, $background, $maxEx - $this->markTestSkipped(); - return true; - } else { -+ $phpcmd = (getenv("PHPCMD") ?: PHP_BINARY); - $commandParameters = array($this->getFullHostPath(), $this->sessionSaveHandler, $sessionId, $sleepTime, $maxExecutionTime, $lock_retries, $lock_expires, $sessionData, $sessionLifetime); - if ($locking_enabled) { - $commandParameters[] = '1'; -@@ -5560,9 +5561,8 @@ private function startSessionProcess($sessionId, $sleepTime, $background, $maxEx +@@ -5560,9 +5560,8 @@ private function startSessionProcess($sessionId, $sleepTime, $background, $maxEx } $commandParameters = array_map('escapeshellarg', $commandParameters); - $command = 'php ' . __DIR__ . '/startSession.php ' . implode(' ', $commandParameters); -+ $command = "$phpcmd " . __DIR__ . '/startSession.php ' . implode(' ', $commandParameters); ++ $command = self::getPhpCommand('startSession.php') . implode(' ', $commandParameters); $command .= $background ? ' 2>/dev/null > /dev/null &' : ' 2>&1'; - exec($command, $output); return ($background || (count($output) == 1 && $output[0] == 'SUCCESS')) ? true : false; } -@@ -5576,7 +5576,8 @@ private function startSessionProcess($sessionId, $sleepTime, $background, $maxEx +@@ -5576,7 +5575,7 @@ private function startSessionProcess($sessionId, $sleepTime, $background, $maxEx */ private function getSessionData($sessionId, $sessionLifetime = 1440) { - $command = 'php ' . __DIR__ . '/getSessionData.php ' . escapeshellarg($this->getFullHostPath()) . ' ' . $this->sessionSaveHandler . ' ' . escapeshellarg($sessionId) . ' ' . escapeshellarg($sessionLifetime); -+ $phpcmd = (getenv("PHPCMD") ?: PHP_BINARY); -+ $command = "$phpcmd " . __DIR__ . '/getSessionData.php ' . escapeshellarg($this->getFullHostPath()) . ' ' . $this->sessionSaveHandler . ' ' . escapeshellarg($sessionId) . ' ' . escapeshellarg($sessionLifetime); ++ $command = self::getPhpCommand('getSessionData.php') . escapeshellarg($this->getFullHostPath()) . ' ' . $this->sessionSaveHandler . ' ' . escapeshellarg($sessionId) . ' ' . escapeshellarg($sessionLifetime); exec($command, $output); return $output[0]; -@@ -5594,7 +5595,8 @@ private function regenerateSessionId($sessionId, $locking = false, $destroyPrevi +@@ -5594,11 +5593,31 @@ private function regenerateSessionId($sessionId, $locking = false, $destroyPrevi { $args = array_map('escapeshellarg', array($sessionId, $locking, $destroyPrevious, $sessionProxy)); - $command = 'php --no-php-ini --define extension=igbinary.so --define extension=' . __DIR__ . '/../modules/redis.so ' . __DIR__ . '/regenerateSessionId.php ' . escapeshellarg($this->getFullHostPath()) . ' ' . $this->sessionSaveHandler . ' ' . implode(' ', $args); -+ $phpcmd = (getenv("PHPCMD") ?: PHP_BINARY . ' --no-php-ini --define extension=igbinary.so --define extension=' . __DIR__ . '/../modules/redis.so'); -+ $command = "$phpcmd " . __DIR__ . '/regenerateSessionId.php ' . escapeshellarg($this->getFullHostPath()) . ' ' . $this->sessionSaveHandler . ' ' . implode(' ', $args); ++ $command = self::getPhpCommand('regenerateSessionId.php') . escapeshellarg($this->getFullHostPath()) . ' ' . $this->sessionSaveHandler . ' ' . implode(' ', $args); exec($command, $output); -diff --git a/tests/TestRedis.php b/tests/TestRedis.php -index 4348c7d8..7107669e 100644 ---- a/tests/TestRedis.php -+++ b/tests/TestRedis.php -@@ -35,6 +35,8 @@ - /* Let the user know this can take a bit of time */ - echo "Note: these tests might take up to a minute. Don't worry :-)\n"; - echo "Using PHP version " . PHP_VERSION . " (" . (PHP_INT_SIZE*8) . " bits)\n"; -+$phpcmd = (getenv("PHPCMD") ?: PHP_BINARY); -+echo "Using PHP command: $phpcmd\n"; - - /* Depending on the classes being tested, run our tests on it */ - echo "Testing class "; + return $output[0]; + } ++ ++ /** ++ * Return command to launch PHP with built extension enabled ++ * taking care of environment (TEST_PHP_EXECUTABLE and TEST_PHP_ARGS) ++ * ++ * @param string $script ++ * ++ * @return string ++ */ ++ private function getPhpCommand($script) ++ { ++ static $cmd = NULL; ++ ++ if (!$cmd) { ++ $cmd = (getenv('TEST_PHP_EXECUTABLE') ?: (defined('PHP_BINARY') ? PHP_BINARY : 'php')); // PHP_BINARY is 5.4+ ++ $cmd .= ' '; ++ $cmd .= (getenv('TEST_PHP_ARGS') ?: '--no-php-ini --define extension=igbinary.so --define extension=' . dirname(__DIR__) . '/modules/redis.so'); ++ } ++ return $cmd . ' ' . __DIR__ . '/' . $script . ' '; ++ } + } + ?> |