Re: Console_GetOpt and mkdir bug
| From: | Sander Roobol | Date: | Sat, 12 Oct 2002 14:34:57 +0000 |
| Subject: | Re: Console_GetOpt and mkdir bug | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-10020@lists.php.net to get a copy of this message | ||
On Sat, Oct 12, 2002 at 02:18:49PM +0200, Pierre-Alain Joye wrote:
> In Console_Getopt:getopt() :
>
> if (isset($args[0]{0}) && $args[0]{0} != '-') {
> array_shift($args);
> }
>
> That drops the 1st dir argument passed to System::mkDir();
>
> Do you why it automaticly drop it if it does not start with '-' ?
IIRC, this test was added to allow getOpt() to accept $argv directly.
Before the test you needed to drop $argv[0] first.
But you're right, this test is probably not good. In some cases it might
not give the appropriate result.
IMO getOpt() should always accept $argv unmodified, just like C's getopt()
does. I don't really care about BC :)
Sander