From 47abb35edde318ead04e102e88bafb90d07d85e4 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 8 Jun 2018 16:20:22 +0200 Subject: better path (PR 1335) test build with 7.3 open https://github.com/phpredis/phpredis/pull/1366 Fix: Warning: time() expects exactly 0 parameters, 1 given ... --- 1365.patch | 71 ++++++++++++++++++++++++++-------------------------- 1366.patch | 23 +++++++++++++++++ php-pecl-redis4.spec | 15 ++++++++--- 3 files changed, 71 insertions(+), 38 deletions(-) create mode 100644 1366.patch diff --git a/1365.patch b/1365.patch index b84586f..bc6beb8 100644 --- a/1365.patch +++ b/1365.patch @@ -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 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 . ' '; ++ } + } + ?> diff --git a/1366.patch b/1366.patch new file mode 100644 index 0000000..f3d5f37 --- /dev/null +++ b/1366.patch @@ -0,0 +1,23 @@ +From ff32a634151fd471cbd5b39e26cd56af63fe7ea5 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 8 Jun 2018 16:16:53 +0200 +Subject: [PATCH] Fix: Warning: time() expects exactly 0 parameters, 1 given + ... (php 7.3) + +--- + tests/RedisTest.php | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/RedisTest.php b/tests/RedisTest.php +index ff0b7537..e48309d5 100644 +--- a/tests/RedisTest.php ++++ b/tests/RedisTest.php +@@ -452,7 +452,7 @@ public function testSetTimeout() { + public function testExpireAt() { + $this->redis->del('key'); + $this->redis->set('key', 'value'); +- $now = time(NULL); ++ $now = time(); + $this->redis->expireAt('key', $now + 1); + $this->assertEquals('value', $this->redis->get('key')); + sleep(2); diff --git a/php-pecl-redis4.spec b/php-pecl-redis4.spec index 2303ee6..78d5d49 100644 --- a/php-pecl-redis4.spec +++ b/php-pecl-redis4.spec @@ -34,7 +34,7 @@ Summary: Extension for communicating with the Redis key-value store Name: %{?sub_prefix}php-pecl-redis4 Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}} -Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} Source0: http://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz License: PHP URL: http://pecl.php.net/package/redis @@ -46,6 +46,8 @@ Source3: https://raw.githubusercontent.com/phpredis/phpredis/develop/tests # See https://github.com/phpredis/phpredis/pull/1365 Patch0: 1365.patch +# See https://github.com/phpredis/phpredis/pull/1366 +Patch1: 1366.patch BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel @@ -133,6 +135,7 @@ sed -e 's/role="test"/role="src"/' \ cd NTS cp %{SOURCE1} %{SOURCE2} %{SOURCE3} tests/ %patch0 -p1 -b .pr1365 +%patch1 -p1 -b .pr1366 # Use system library rm -r liblzf @@ -281,12 +284,13 @@ sed -e "s/6379/$port/" -i *.php # Run the test Suite ret=0 -export PHPCMD="%{__php} --no-php-ini \ +export TEST_PHP_EXECUTABLE=%{__php} +export TEST_PHP_ARGS="--no-php-ini \ %if %{with_igbin} --define extension=igbinary.so \ %endif --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so" -$PHPCMD TestRedis.php || ret=1 +$TEST_PHP_EXECUTABLE $TEST_PHP_ARGS TestRedis.php || ret=1 # Cleanup if [ -f $pidfile ]; then @@ -335,6 +339,11 @@ fi %changelog +* Fri Jun 8 2018 Remi Collet - 4.1.0~RC1-2 +- test build with 7.3 +- open https://github.com/phpredis/phpredis/pull/1366 + Fix: Warning: time() expects exactly 0 parameters, 1 given ... + * Fri Jun 8 2018 Remi Collet - 4.1.0~RC1-1 - update to 4.1.0RC1 - open https://github.com/phpredis/phpredis/pull/1365 -- cgit