Re: [PATCH] Bug #34671 Incorrect callingconvention to cmd.exe

From: Date: Tue, 07 Feb 2006 06:58:29 +0000
Subject: Re: [PATCH] Bug #34671 Incorrect callingconvention to cmd.exe
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-21805@lists.php.net to get a copy of this message
Frank M. Kromann wrote: > I like the idea of a php.ini setting for the comspec (although this might > create OS specific ini files), and I do not like 'magick' stuff happening > to command parameters in any of the exec functions. > > According to Windows cmd specifications the quotes are needed if one of > the special characters is present in the command line. > > The special characters that require quotes are: > <space> > &()[]{}^=;!'+,`~ > > The user should know when to use quotes when calling any of the exec > functions. Two sets of quotes are needed. Like this: $result = ""c:\\program files\\some program\\prog.exe" "filename""; This won't work: $result = "c:\\program files\\some program\\prog.exe" "filename"; You think the user is meant to know that? I'm not suggesting magically adding quotes around filenames which contain special characters, that's the user's responsibility. I'm suggesting adding quotes around the entire command, with a /s switch preceding, so that the command specified by the user is successfully passed to the command interpreter. This kind of quoting is done on Unix, see tsrm_virtual_cwd.c around line 1016. But it is missing on Windows. It's a bug, plain and simple. -- Tim Starling

« previous php.internals (#21805) next »