Skip to content

Support PHP script parameter values containing spaces #600

Open
@nachtkinder

Description

@nachtkinder

Summary

When attempting to supply a parameter value containing a space to a PHP script it is necessary to enclose the parameter value in double-quotes. Doing this in the "Program Arguments" field of Script's "Configure Run Options" dialogue results in the parameter being incorrectly parsed.

To reproduce

Create and verify test case

Create space_test.php containing the following:

<?php
$argsCount = $argc -1;
echo "$argsCount argument(s) received";

if ('foo bar' != $argv[1]) {
    trigger_error('Space mishandled', E_USER_ERROR);
}

Verify that the script works correctly on the command-line:

php -f space_test.php -- "foo bar"

The result should be:

1 argument(s) received

Run with Script package in Atom

Open space_test.php in Atom.

Open Script's "Configure Run Options" dialogue and enter php in the "Command" field and "foo bar" in "Program Arguments".

Click the "Run" button.

The expected result is as before:

1 argument(s) received

The actual result is:

PHP Fatal error: Space mishandled in space_test.php on line 6
PHP Stack trace:
PHP 1. {main}() space_test.php:0
PHP 2. trigger_error() space_test.php:6
2 argument(s) received

The above was discovered in Atom 1.0.19 and Script 2.29.0 running on Ubuntu 14.04 LTS 64Bit. go version returns:

go version go1.4.2 linux/amd64

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions