Bug #68140 [Fbk->Opn]: escapeshellarg doesn't escape double quotes, it removes them instead

From: Date: Sat, 04 Oct 2014 11:02:04 +0000
Subject: Bug #68140 [Fbk->Opn]: escapeshellarg doesn't escape double quotes, it removes them instead
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-187842@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68140&edit=1 ID: 68140 User updated by: petrhudecek2010 at gmail dot com Reported by: petrhudecek2010 at gmail dot com Summary: escapeshellarg doesn't escape double quotes, it removes them instead -Status: Feedback +Status: Open Type: Bug Package: Program Execution Operating System: Windows 8.1 PHP Version: 5.6.1 Block user comment: N Private report: N New Comment: I'm using this code (simplified from what I actually need, but shows the principle): <?php $arg = escapeshellarg('echo "hello";'); echo php -r $arg; I wanted it to print hello, instead it says that hello is not a defined constant because it strips the double quotes. Previous Comments: ------------------------------------------------------------------------ [2014-10-04 10:15:25] ab@php.net What is the particular command you're running? Thanks. ------------------------------------------------------------------------ [2014-10-03 06:08:21] petrhudecek2010 at gmail dot com Description: ------------ On Windows, the function escapeshellarg quotes the string in double quotes but instead of escaping existing double quotes, it removes them instead. Test script: --------------- <?php echo escapeshellarg('"'); Expected result: ---------------- "\"" Actual result: -------------- " " ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68140&edit=1

« previous php.bugs (#187842) next »