@@ -5560,9 +5560,8 @@ private function startSessionProcess($sessionId, $sleepTime, $background, $maxEx
5560
5560
}
5561
5561
$ commandParameters = array_map ('escapeshellarg ' , $ commandParameters );
5562
5562
5563
- $ command = ' php ' . __DIR__ . ' / startSession.php ' . implode (' ' , $ commandParameters );
5563
+ $ command = self :: getPhpCommand ( ' startSession.php ' ) . implode (' ' , $ commandParameters );
5564
5564
$ command .= $ background ? ' 2>/dev/null > /dev/null & ' : ' 2>&1 ' ;
5565
-
5566
5565
exec ($ command , $ output );
5567
5566
return ($ background || (count ($ output ) == 1 && $ output [0 ] == 'SUCCESS ' )) ? true : false ;
5568
5567
}
@@ -5576,7 +5575,7 @@ private function startSessionProcess($sessionId, $sleepTime, $background, $maxEx
5576
5575
*/
5577
5576
private function getSessionData ($ sessionId , $ sessionLifetime = 1440 )
5578
5577
{
5579
- $ command = ' php ' . __DIR__ . ' / getSessionData.php ' . escapeshellarg ($ this ->getFullHostPath ()) . ' ' . $ this ->sessionSaveHandler . ' ' . escapeshellarg ($ sessionId ) . ' ' . escapeshellarg ($ sessionLifetime );
5578
+ $ command = self :: getPhpCommand ( ' getSessionData.php ' ) . escapeshellarg ($ this ->getFullHostPath ()) . ' ' . $ this ->sessionSaveHandler . ' ' . escapeshellarg ($ sessionId ) . ' ' . escapeshellarg ($ sessionLifetime );
5580
5579
exec ($ command , $ output );
5581
5580
5582
5581
return $ output [0 ];
@@ -5594,11 +5593,31 @@ private function regenerateSessionId($sessionId, $locking = false, $destroyPrevi
5594
5593
{
5595
5594
$ args = array_map ('escapeshellarg ' , array ($ sessionId , $ locking , $ destroyPrevious , $ sessionProxy ));
5596
5595
5597
- $ 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 );
5596
+ $ command = self :: getPhpCommand ( ' regenerateSessionId.php ' ) . escapeshellarg ($ this ->getFullHostPath ()) . ' ' . $ this ->sessionSaveHandler . ' ' . implode (' ' , $ args );
5598
5597
5599
5598
exec ($ command , $ output );
5600
5599
5601
5600
return $ output [0 ];
5602
5601
}
5602
+
5603
+ /**
5604
+ * Return command to launch PHP with built extension enabled
5605
+ * taking care of environment (TEST_PHP_EXECUTABLE and TEST_PHP_ARGS)
5606
+ *
5607
+ * @param string $script
5608
+ *
5609
+ * @return string
5610
+ */
5611
+ private function getPhpCommand ($ script )
5612
+ {
5613
+ static $ cmd = NULL ;
5614
+
5615
+ if (!$ cmd ) {
5616
+ $ cmd = (getenv ('TEST_PHP_EXECUTABLE ' ) ?: (defined ('PHP_BINARY ' ) ? PHP_BINARY : 'php ' )); // PHP_BINARY is 5.4+
5617
+ $ cmd .= ' ' ;
5618
+ $ cmd .= (getenv ('TEST_PHP_ARGS ' ) ?: '--no-php-ini --define extension=igbinary.so --define extension= ' . dirname (__DIR__ ) . '/modules/redis.so ' );
5619
+ }
5620
+ return $ cmd . ' ' . __DIR__ . '/ ' . $ script . ' ' ;
5621
+ }
5603
5622
}
5604
5623
?>
0 commit comments