Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46853 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 59793 invoked from network); 21 Jan 2010 15:21:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jan 2010 15:21:11 -0000 Authentication-Results: pb1.pair.com header.from=ceo@l-i-e.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ceo@l-i-e.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain l-i-e.com designates 67.139.134.202 as permitted sender) X-PHP-List-Original-Sender: ceo@l-i-e.com X-Host-Fingerprint: 67.139.134.202 o2.hostbaby.com FreeBSD 4.7-5.2 (or MacOS X 10.2-10.3) (2) Received: from [67.139.134.202] ([67.139.134.202:4827] helo=o2.hostbaby.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 33/90-26239-3E0785B4 for ; Thu, 21 Jan 2010 10:21:08 -0500 Received: (qmail 78472 invoked by uid 98); 21 Jan 2010 15:21:05 -0000 Received: from localhost by o2.hostbaby.com (envelope-from , uid 1013) with qmail-scanner-2.05 (clamdscan: 0.88.7/10320. Clear:RC:1(127.0.0.1):. Processed in 0.151799 secs); 21 Jan 2010 15:21:05 -0000 Received: from localhost (HELO l-i-e.com) (127.0.0.1) by localhost with SMTP; 21 Jan 2010 15:21:05 -0000 Received: from webmail (SquirrelMail authenticated user ceo@l-i-e.com) by www.l-i-e.com with HTTP; Thu, 21 Jan 2010 09:21:05 -0600 (CST) Message-ID: <3392.98.193.1264087265.squirrel@www.l-i-e.com> In-Reply-To: References: Date: Thu, 21 Jan 2010 09:21:05 -0600 (CST) To: "Nathan Rixham" Cc: internals@lists.php.net User-Agent: Hostbaby Webmail MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Subject: Re: [PHP-DEV] Dots and spaces in variable names are converted to underscores. From: ceo@l-i-e.com ("Richard Lynch") Once upon a time, a long time ago, PHP imported all GET/POST/COOKIE data as variables, for the convenience of the developer. This was called "register_globals" $a.b is not a valid variable name, so it was changed to $a_b to be a valid variable name. Nowadays, I see no real reason to keep doing this, other than BC. And I'm not sure who would actually use 'a.b' and then expect 'a_b', but I have to assume somebody has done that, perhaps consuming an API from somewhere else. Short-term, your options are to use $_SERVER['REQUEST_URI'] and parse it yourself, or "don't do that". Long-term, I suggest you lobby for this to change in PHP 6, if it isn't already in the works. For BC, I suppose PHP could have *both* 'a.b' and 'a_b', or yet another php.ini flag (sorry!) to choose the behaviour. On Wed, January 20, 2010 3:45 pm, Nathan Rixham wrote: > Dots and spaces in variable names are converted to underscores. For > example becomes $_POST["a_b"]. > > Any reason why? and any way to modify this behaviour to preserve dots > and spaces? (dots specifically) > > reason, when building "linked data" / rdf based applications using PHP > it's most beneficial to use subject / predicate URIs (eg > http://xmlns.com/foaf/0.1/mbox) as form input names. > > also worth noting that if you send: > > you'll receive the following in php: > $_POST[a_b] => array('c.d' => val) > note no conversion of c.d to c_d > > regards, > > Nathan > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Some people ask for gifts here. I just want you to buy an Indie CD for yourself: http://cdbaby.com/search/from/lynch