8000 merged branch stof/fix_5_3 (PR #7662) · symfony/symfony@9b6d30c · GitHub
[go: up one dir, main page]

Skip to content

Commit 9b6d30c

Browse files
committed
merged branch stof/fix_5_3 (PR #7662)
This PR was merged into the master branch. Discussion ---------- Fixed the Console code on PHP 5.3 | Q | A | ------------- | --- | Fixed tickets | none (catched by the Travis builds) | License | MIT The PR #7657 introduced a requirement on PHP 5.4 by mistake. Commits ------- 1356050 Fixed the Console code on PHP 5.3
2 parents bedac11 + 1356050 commit 9b6d30c

File tree

2 files changed

+10
-5
lines changed
8000

2 files changed

+10
-5
lines changed

src/Symfony/Component/Console/Input/ArgvInput.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,11 +320,14 @@ public function getParameterOption($values, $default = false)
320320
*/
321321
public function __toString()
322322
{
323-
$tokens = array_map(function ($token) {
323+
$self = $this;
324+
$tokens = array_map(function ($token) use ($self) {
324325
if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
325-
return $match[1] . $this->escapeToken($match[2]);
326-
} elseif ($token && $token[0] !== '-') {
327-
return $this->escapeToken($token);
326+
return $match[1] . $self->escapeToken($match[2]);
327+
}
328+
329+
if ($token && $token[0] !== '-') {
330+
return $self->escapeToken($token);
328331
}
329332

330333
return $token;

src/Symfony/Component/Console/Input/Input.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,11 @@ public function hasOption($name)
214214
/**
215215
* Escapes a token through escapeshellarg if it contains unsafe chars
216216
*
217+
* @param string $token
218+
*
217219
* @return string
218220
*/
219-
protected function escapeToken($token)
221+
public function escapeToken($token)
220222
{
221223
return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
222224
}

0 commit comments

Comments
 (0)
0