RE: [PHP-DEV] Suggestion for fixing Bug #40928
| From: | Tzachi Tager | Date: | Wed, 11 Jul 2007 08:55:51 +0000 |
| Subject: | RE: [PHP-DEV] Suggestion for fixing Bug #40928 | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-30775@lists.php.net to get a copy of this message | ||
The reason I'm doing this is because it seems that Windows parser looks for an odd number of
'"' before the escaping, otherwise the escaping character is included in the outcome,
for example:
string(25) "md "test ^& echo ^%foo^%"" ==> will output a directory
called "test ^& echo ^%foo^%"
While:
string(31) "md "test "^&" echo "^%"foo"^%"""
==> will output a directory called "test & echo %foo%"
(I changed the php code and ran again, these are not the runs of the cmd.exe which does the escaping
internally).
Which is what I wanted in the first place (and I know it looks ugly...).
Tzachi.
-----Original Message-----
From: Stanislav Malyshev [mailto:stas@zend.com]
Sent: ג 10 יולי 2007 23:51
To: Tzachi Tager
Cc: internals@lists.php.net
Subject: Re: [PHP-DEV] Suggestion for fixing Bug #40928
> /en-us/ntcmds_shelloverview.mspx?mfr=true , quoting: "You can use most
> characters as variable values, including white space. If you use the
> special characters <, >, |, &, or ^, you must precede them with the
> escape character (^) or quotation marks." - So all special characters
> will be replaced with "^<char>".
I think you are not entirely correct here. What the quote means is that
if you want foo&bar, you should do either "foo&bar" or foo^&bar - not
replace & with "^&".
--
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com