note 94020 added to function.escapeshellarg

From: Date: Mon, 12 Oct 2009 17:53:57 +0000
Subject: note 94020 added to function.escapeshellarg
Groups: php.notes 
Request: Send a blank email to php-notes+get-161657@lists.php.net to get a copy of this message
The comment from 'rmays at castlecomm dot com' is incorrect: single quotes cannot be backslash-escaped inside a single-quoted string when constructing a shell argument. The output from this function is in fact correct. It drops out of the single-quoted string, includes a literal single quote with a backslash-escape, then resumes the single-quoted string. Observe: [shellarg.php] <?php system("echo ' single quote\'d '"); system("echo ' single quote'\''d '"); ?> $ php shellarg.php sh: -c: line 0: unexpected EOF while looking for matching `'' sh: -c: line 1: syntax error: unexpected end of file single quote'd ---- Server IP: 92.48.74.199 Probable Submitter: 87.194.177.60 ---- Manual Page -- http://www.php.net/manual/en/function.escapeshellarg.php Edit -- https://master.php.net/note/edit/94020 Del: integrated -- https://master.php.net/note/delete/94020/integrated Del: useless -- https://master.php.net/note/delete/94020/useless Del: bad code -- https://master.php.net/note/delete/94020/bad+code Del: spam -- https://master.php.net/note/delete/94020/spam Del: non-english -- https://master.php.net/note/delete/94020/non-english Del: in docs -- https://master.php.net/note/delete/94020/in+docs Del: other reasons-- https://master.php.net/note/delete/94020 Reject -- https://master.php.net/note/reject/94020 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#161657) next »