#198 Eclipse Linux Compability : Launch php-cli

open
5
2010-10-16
2010-10-16
No

I wonder how it ever worked in Linux; due to shell substitutution, the PHP Variables get interpreted as Shell variables.

The launch command is the following:
echo "<?php $path='/usr/share/php';ini_set('include_path', get_include_path().PATH_SEPARATOR . realpath($path));ini_set('html_errors','0');$fullpath = realpath('my.testfile.php');$pathparts = pathinfo($fullpath);$filename = $pathparts['basename'];$_SERVER['argv'][1]=basename("$fullpath","");$_SERVER['argv'][2] = "$fullpath";$_SERVER['PHPBIN']='/usr/bin/php5 -q -c /etc/php5/cli/php.ini';include_once('PHPUnit2/TextUI/TestRunner.php'); ?>" | "/usr/bin/php5" -q -c "/etc/php5/cli/php.ini"

Which generates the error

PHP Parse error: syntax error, unexpected '=' in - on line 1
(or Read error:Stream closed in the console)

How to solve this problem:
1) echo ' <?php ... ' does not replace shell variables.
2) Escape every ' inside the php string with \' so that it'll get a simple ' in the php code.

/src/net/sf/simpletest/eclipse/launcher/TestLaunchConfigurationDelegate.java, Line 299 gets:
String xml = "echo '<?php " + Pattern.compile("'").matcher(xb.toString()).replaceAll("\'") + " ?>' | " + cmd;

I will try to recompile & see if the plugin now works.

Discussion


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks