|  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [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-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 25 10:01:29 2024 UTC