Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:14283 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13680 invoked by uid 1010); 5 Jan 2005 01:24:30 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 13469 invoked from network); 5 Jan 2005 01:24:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jan 2005 01:24:27 -0000 X-Host-Fingerprint: 80.74.107.235 mail.zend.com Linux 2.4/2.6 Received: from ([80.74.107.235:37614] helo=mail.zend.com) by pb1.pair.com (ecelerity HEAD (r3992M)) with SMTP id D8/F0-06279-EB14BD14 for ; Tue, 04 Jan 2005 20:24:14 -0500 Received: (qmail 4526 invoked from network); 5 Jan 2005 01:24:10 -0000 Received: from localhost (HELO andi-notebook.zend.com) (127.0.0.1) by localhost with SMTP; 5 Jan 2005 01:24:10 -0000 Message-ID: <5.1.0.14.2.20050104172301.0265fcb0@localhost> X-Sender: andi@localhost X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Tue, 04 Jan 2005 17:24:06 -0800 To: Johannes Schlueter ,internals@lists.php.net, Jochem Maas In-Reply-To: <20050105002957.45371.qmail@pb1.pair.com> References: <41DB2D85.1080700@iamjochem.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] Re: CONSTANT names... From: andi@zend.com (Andi Gutmans) There are plenty of such examples in many languages. As Johannes mentions, some ppl might even be "abusing" it already :) Anyway, I don't think adding necessary checks for such things, and slowing define() down (even if it's negligible) is warranted in such cases. Andi At 12:29 AM 1/5/2005 +0100, Johannes Schlueter wrote: >Hi Jochem, > >you can get the valu of that constant with the constant() function and use >such a constant with defined() so forbidding this would at least be a BC >break. >btw. the same goes for reserved words so define('echo', 42); is valid too >but "echo echo;" doesn't work :-) > >johannes > >Jochem Maas wrote: > > > hi guys, > > > > I was mucking around and noticed the following: > > > > define("404_SKIP", 1); > > > > does not give an error and you can successfully get the value of the > > constant by doing: > > > > constant("404_SKIP"); > > > > where as doing: > > > > echo 404_SKIP; > > > > gives an error. > > as I understand it, i.e. what the docs say, is that the following regexp > > expresses valid starting chars for the name of a constant (the same > > going for vars): > > > > /^[a-zA-Z_\x7f-\xff]/ > > > > so pretty minor thing here but I expected to see the define() throw a > > (fatal?) error, rather than letting me go on. > > > > kind regards, > > Jochem > >-- >PHP Internals - PHP Runtime Development Mailing List >To unsubscribe, visit: http://www.php.net/unsub.php