|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43784 escapeshellarg removes % from given string
Submitted: 2008-01-08 09:04 UTC Modified: 2015-01-09 01:04 UTC
Avg. Score:4.4 ± 0.5
Reproduced:5 of 5 (100.0%)
Same Version:2 (40.0%)
Same OS:5 (100.0%)
From: Assigned: scottmac (profile)
Status: Closed Package: Program Execution
PHP Version: 6CVS-2008-01-08 (snap) OS: Windows
Private report: No CVE-ID: None
 [2008-01-08 09:04 UTC]
escapeshellarg(string) removes all % out of it. This results in a non working version for arguments that requires % for formating.

ie. imagick identify.exe

identify -format "%m" myimage.png

Reproduce code:
echo escapeshellarg('%m %f %v');

Expected result:
'%m %f %v'

Actual result:
' m  f  v'


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-08 09:10 UTC]
This is because of the following commit:
which was a reaction to a security bulletin. However, just stripping out the % is not the solution, as it can only be used to access env vars *outside* strings, and with a matching %. However, just stripping them out is not a good solution as it hinders real life use of it like in this example.
 [2008-01-08 09:10 UTC]
I'm assigning it to you ilia, as you made the original patch as well.
 [2008-07-20 16:09 UTC]
Assigned to Scott to see if this problem can't be solved with the one describe in #43261
 [2015-01-09 01:04 UTC]
-Status: Assigned +Status: Closed
 [2015-01-09 01:04 UTC]
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at

I'm using 5.6 and this is fixed. I assume it was fixed a while ago, but I don't know which version.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed May 25 01:05:44 2022 UTC