Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54466 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39271 invoked from network); 8 Aug 2011 12:25:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Aug 2011 12:25:52 -0000 Authentication-Results: pb1.pair.com header.from=martin@spuetz.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=martin@spuetz.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain spuetz.net from 83.169.42.81 cause and error) X-PHP-List-Original-Sender: martin@spuetz.net X-Host-Fingerprint: 83.169.42.81 mta.infogurke.de Linux 2.6 Received: from [83.169.42.81] ([83.169.42.81:45699] helo=mta.infogurke.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FD/A3-17191-EC5DF3E4 for ; Mon, 08 Aug 2011 08:25:51 -0400 Received: (qmail 3765 invoked by uid 89); 8 Aug 2011 12:25:47 -0000 Received: from localhost (HELO ?10.85.130.47?) (martin@spuetz.net@127.0.0.1) by mta.infogurke.de with ESMTPA; 8 Aug 2011 12:25:47 -0000 Message-ID: <4E3FD5CB.2000008@spuetz.net> Date: Mon, 08 Aug 2011 14:25:47 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 To: RQuadling@GMail.com CC: internals@lists.php.net References: <4E3FCB12.70707@spuetz.net> In-Reply-To: X-Enigmail-Version: 1.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] getopt bc break 5.2 -> 5.3 From: martin@spuetz.net (=?UTF-8?B?TWFydGluIFNww7x0eg==?=) 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