Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46843 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8908 invoked from network); 20 Jan 2010 22:29:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jan 2010 22:29:40 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 209.85.220.212 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.220.212 mail-fx0-f212.google.com Received: from [209.85.220.212] ([209.85.220.212:48849] helo=mail-fx0-f212.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 16/B3-26239-2D3875B4 for ; Wed, 20 Jan 2010 17:29:39 -0500 Received: by fxm4 with SMTP id 4so3533962fxm.12 for ; Wed, 20 Jan 2010 14:29:36 -0800 (PST) Received: by 10.223.101.143 with SMTP id c15mr593455fao.91.1264026575905; Wed, 20 Jan 2010 14:29:35 -0800 (PST) Received: from ?192.168.200.20? (c-98-234-184-167.hsd1.ca.comcast.net [98.234.184.167]) by mx.google.com with ESMTPS id 16sm264326fxm.0.2010.01.20.14.29.33 (version=SSLv3 cipher=RC4-MD5); Wed, 20 Jan 2010 14:29:34 -0800 (PST) Message-ID: <4B5783C7.5000100@lerdorf.com> Date: Wed, 20 Jan 2010 14:29:27 -0800 User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812) MIME-Version: 1.0 To: Stan Vassilev CC: internals@lists.php.net, Nathan Rixham References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Dots and spaces in variable names are converted to underscores. From: rasmus@lerdorf.com (Rasmus Lerdorf) Stan Vassilev 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) > > I'm also using dots for this reason, so I feel your pain. What I ended > up doing is converting dot syntax to PHP array syntax as I compile my > templates. > So when I type this: what I get actually > compiled and sent to the browser is this: > > The reason for this quirk is register_globals. The symbols not > suitable for symbol names, such as dots, are replaced with > underscores, so that you can access your POST variable "foo.bar" as > $foo_bar in global space. Of course it never made sense the conversion > is applied to the superglobals like $_COOKIE/GET/POST, but it was, and > now there are claims that it'll break backwards compatibility if changed. > > I hope PHP6 will remove this processing as register_globals will be > completely removed at that point. Well, that conversion still needs to happen somewhere, since plenty of apps call extract() on those superglobals, but with register_globals entirely gone in PHP 6, I suppose that conversion can be moved to the extract() call. -Rasmus