Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bfd2747

Browse files
Modify session testing logic
In the event that the test PHP executable has been built with redis and/or igbinary support built statically, we don't need to try and find it by adding --no-php-ini and the extension directives themselves. This fixes the test execution when php has the required extensions already.
1 parent 2f694e1 commit bfd2747

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

tests/RedisTest.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5663,9 +5663,27 @@ private function getPhpCommand($script)
56635663

56645664
if (!$cmd) {
56655665
$cmd = (getenv('TEST_PHP_EXECUTABLE') ?: (defined('PHP_BINARY') ? PHP_BINARY : 'php')); // PHP_BINARY is 5.4+
5666-
$cmd .= ' ';
5667-
$cmd .= (getenv('TEST_PHP_ARGS') ?: '--no-php-ini --define extension=igbinary.so --define extension=' . dirname(__DIR__) . '/modules/redis.so');
5666+
5667+
if ($test_args = getenv('TEST_PHP_ARGS')) {
5668+
$cmd .= $test_args;
5669+
} else {
5670+
/* Only append specific extension directives if PHP hasn't been compiled with what we need statically */
5671+
$result = shell_exec("$cmd --no-php-ini -m");
5672+
$redis = strpos($result, 'redis') !== false;
5673+
$igbinary = strpos($result, 'igbinary') !== false;
5674+
5675+
if (!$redis || !$igbinary) {
5676+
$cmd .= ' --no-php-ini';
5677+
if (!$igbinary) {
5678+
$cmd .= ' --define extension=igbinary.so';
5679+
}
5680+
if (!$redis) {
5681+
$cmd .= ' --define extension=' . dirname(__DIR__) . '/modules/redis.so';
5682+
}
5683+
}
5684+
}
56685685
}
5686+
56695687
return $cmd . ' ' . __DIR__ . '/' . $script . ' ';
56705688
}
56715689
}

0 commit comments

Comments
 (0)