Re: getopt bc break 5.2 -> 5.3

From: Date: Mon, 08 Aug 2011 12:25:47 +0000
Subject: Re: getopt bc break 5.2 -> 5.3
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-54466@lists.php.net to get a copy of this message
On 08.08.2011 14:09, Richard Quadling wrote: > Can you try ... > > php test.php -- Module.Controller.Action -p foobar I tried $ php test.php -p foobar -- Module.Controller.Action that gave me: array(1) { ["p"]=> string(6) "foobar" } But that doesn't help me much. I could add a prepend_file that would convert $_SERVER["argv"] but I still have to edit a lot of old / third-party code. For now I hacked ext/standard/basic_functions.c: > --- php-5.3.6-cli.o/ext/standard/basic_functions.c 2011-02-08 17:29:34.000000000 +0100 > +++ php-5.3.6-cli/ext/standard/basic_functions.c 2011-08-08 14:07:40.000000000 +0200 > @@ -4283,7 +4283,12 @@ > arg_ptr = &arg; > } > > - argv[pos++] = estrdup(Z_STRVAL_P(arg_ptr)); > + char *s = estrdup(Z_STRVAL_P(arg_ptr)); > + if (pos == 1 && strlen(s) > 0 && s[0] != > '-') { > + argc--; > + } else { > + argv[pos++] = s; > + } > > if (arg_ptr != *entry) { > zval_dtor(&arg); Martin

« previous php.internals (#54466) next »