Fixed the Console code on PHP 5.3
The PR #7657 introduced a requirement on PHP 5.4 by mistake.
This commit is contained in:
parent
bedac11d57
commit
1356050f21
@ -320,11 +320,14 @@ class ArgvInput extends Input
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
$tokens = array_map(function ($token) {
|
||||
$self = $this;
|
||||
$tokens = array_map(function ($token) use ($self) {
|
||||
if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
|
||||
return $match[1] . $this->escapeToken($match[2]);
|
||||
} elseif ($token && $token[0] !== '-') {
|
||||
return $this->escapeToken($token);
|
||||
return $match[1] . $self->escapeToken($match[2]);
|
||||
}
|
||||
|
||||
if ($token && $token[0] !== '-') {
|
||||
return $self->escapeToken($token);
|
||||
}
|
||||
|
||||
return $token;
|
||||
|
@ -214,9 +214,11 @@ abstract class Input implements InputInterface
|
||||
/**
|
||||
* Escapes a token through escapeshellarg if it contains unsafe chars
|
||||
*
|
||||
* @param string $token
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function escapeToken($token)
|
||||
public function escapeToken($token)
|
||||
{
|
||||
return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
|
||||
}
|
||||
|
Reference in New Issue
Block a user