cvs: pear-core /PEAR RunTest.php
| From: | Helgi �ormar �orbj�rnsson | Date: | Sat, 14 Jun 2008 12:04:26 +0000 |
| Subject: | cvs: pear-core /PEAR RunTest.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-7601@lists.php.net to get a copy of this message | ||
dufuz Sat Jun 14 12:04:26 2008 UTC
Modified files:
/pear-core/PEAR RunTest.php
Log:
* Fix Bug #13943: tests fail when php.exe path contains spaces [dufuz / jorrit]
http://cvs.php.net/viewvc.cgi/pear-core/PEAR/RunTest.php?r1=1.68&r2=1.69&diff_format=u
Index: pear-core/PEAR/RunTest.php
diff -u pear-core/PEAR/RunTest.php:1.68 pear-core/PEAR/RunTest.php:1.69
--- pear-core/PEAR/RunTest.php:1.68 Wed May 21 18:51:15 2008
+++ pear-core/PEAR/RunTest.php Sat Jun 14 12:04:26 2008
@@ -16,7 +16,7 @@
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2008 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version CVS: $Id: RunTest.php,v 1.68 2008/05/21 18:51:15 cellog Exp $
+ * @version CVS: $Id: RunTest.php,v 1.69 2008/06/14 12:04:26 dufuz Exp $
* @link http://pear.php.net/package/PEAR
* @since File available since Release 1.3.3
*/
@@ -234,6 +234,19 @@
return $settings;
}
+ function _preparePhpBin($php, $file, $ini_settings)
+ {
+ $file = escapeshellarg($file);
+ // This was fixed in php 5.3 and is not needed after that
+ if (OS_WINDOWS && version_compare(PHP_VERSION, '5.3', '<'))
{
+ $cmd = '"'.escapeshellarg($php).' '.$ini_settings.' -f
' . $file .'"';
+ } else {
+ $cmd = $php . $ini_settings . ' -f ' . $file;
+ }
+
+ return $cmd;
+ }
+
function runPHPUnit($file, $ini_settings = '')
{
if (!file_exists($file) && file_exists(getcwd() . DIRECTORY_SEPARATOR . $file)) {
@@ -242,7 +255,8 @@
} elseif (file_exists($file)) {
$file = realpath($file);
}
- $cmd = "$this->_php$ini_settings -f $file";
+
+ $cmd = $this->_preparePhpBin($this->_php, $file. $ini_settings);
if (isset($this->_logger)) {
$this->_logger->log(2, 'Running command "' . $cmd .
'"');
}
@@ -391,7 +405,8 @@
}
$args = $section_text['ARGS'] ? ' -- '.$section_text['ARGS']
: '';
- $cmd = "$this->_php$ini_settings -f \"$temp_file\" $args
2>&1";
+ $cmd = $this->_preparePhpBin($this->_php, $temp_file, $ini_settings);
+ $cmd.= "$args 2>&1";
if (isset($this->_logger)) {
$this->_logger->log(2, 'Running command "' . $cmd .
'"');
}