You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.
Hoa\Console\Processus automatically escape command and options. Moreover, when building the command line, it adds a = between the option name and the option value. See
* @param array $options Options (option => value, or input).
* @return array
*/
protectedfunctionsetOptions ( Array$options ) {
foreach($optionsas &$option)
$option = escapeshellarg($option);
$old = $this->_options;
$this->_options = $options;
return$old;
}
/**
* Get options.
*
* @access public
* @return array
*/
publicfunctiongetOptions ( ) {
return$this->_options;
}
/**
* Get command-line.
*
* @access public
* @return string
*/
publicfunctiongetCommandLine ( ) {
$out = $this->getCommand();
foreach($this->getOptions() as$key => $value)
if(!is_int($key))
$out .= '' . $key . '=' . $value;
else
$out .= '' . $value;
return$out;
}
.
In some case, this behavior is not desired. For instance, with atoum, when we build the command, we don't use the $options because = will be inserted and atoum does not support them. The solution is to pass the whole command line in $command, with the options. It's fine, this is how to deal with it.
However, because Processus automatically escape the command, sometimes, it is not what we expect because escaping can create invalid command. Example: --filter 'class = "foo"' becomes --filter 'class = \"foo\"'.
2 solutions:
we tell the users of this behavior in the documentation and we advice to extend Processus and override the setCommand method,
we add one or more arguments in the constructor to disable the escaping.
Hello :-),
Hoa\Console\Processus
automatically escape command and options. Moreover, when building the command line, it adds a=
between the option name and the option value. SeeConsole/Processus.php
Lines 963 to 1035 in 26092d3
In some case, this behavior is not desired. For instance, with atoum, when we build the command, we don't use the
$options
because=
will be inserted and atoum does not support them. The solution is to pass the whole command line in$command
, with the options. It's fine, this is how to deal with it.However, because
Processus
automatically escape the command, sometimes, it is not what we expect because escaping can create invalid command. Example:--filter 'class = "foo"'
becomes--filter 'class = \"foo\"'
.2 solutions:
Processus
and override thesetCommand
method,Thoughts? /cc @hoaproject/hoackers
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: