Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 01a0250

Browse filesBrowse files
bug #21485 [Process] Non ASCII characters disappearing during the escapeshellarg (GuillaumeVerdon)
This PR was submitted for the 3.2 branch but it was merged into the 2.7 branch instead (closes #21485). Discussion ---------- [Process] Non ASCII characters disappearing during the escapeshellarg If the LC_CTYPE is not set at UTF-8, the escapeshellarg() function will remove every non-ascii characters. As it's usual in europe to have directories with non-ascii chars in their name (ex : ~/Vidéos) the function should throw an exception if we're trying to submit it an argument containing non-ascii param and the LC_CTYPE is not set to use UTF-8 | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | | Fixed tickets | | License | MIT | Doc PR | I had this issue while using the lib ffmpeg and giving it a path like "~/Vidéos" the "é" chars was disappearing from the command giving a RuntimeException. The problem was my LC_CTYPE that wasn't set properly, I believe an exception should be raised before the RuntimeException to warn the user of that behavior Commits ------- 3779f3f [Process] Non ASCII characters disappearing during the escapeshellarg
2 parents 3ee1aa0 + 3779f3f commit 01a0250
Copy full SHA for 01a0250

File tree

2 files changed

+2
-1
lines changed
Filter options

2 files changed

+2
-1
lines changed

‎src/Symfony/Component/Process/ProcessUtils.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Process/ProcessUtils.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public static function escapeArgument($argument)
7171
return $escapedArgument;
7272
}
7373

74-
return escapeshellarg($argument);
74+
return "'".str_replace("'", "'\\''", $argument)."'";
7575
}
7676

7777
/**

‎src/Symfony/Component/Process/Tests/ProcessUtilsTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Process/Tests/ProcessUtilsTest.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public function dataArguments()
4343
array("'<|>\" \"'\\''f'", '<|>" "\'f'),
4444
array("''", ''),
4545
array("'with\\trailingbs\\'", 'with\trailingbs\\'),
46+
array("'withNonAsciiAccentLikeéÉèÈàÀöä'", 'withNonAsciiAccentLikeéÉèÈàÀöä'),
4647
);
4748
}
4849
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.