Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:35393 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96371 invoked by uid 1010); 11 Feb 2008 18:49:10 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 96354 invoked from network); 11 Feb 2008 18:49:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Feb 2008 18:49:10 -0000 Authentication-Results: pb1.pair.com header.from=andi@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=andi@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.162 as permitted sender) X-PHP-List-Original-Sender: andi@zend.com X-Host-Fingerprint: 212.25.124.162 mail.zend.com Windows 2000 SP4, XP SP1 Received: from [212.25.124.162] ([212.25.124.162:35477] helo=mx1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3A/30-64922-4A890B74 for ; Mon, 11 Feb 2008 13:49:09 -0500 Received: from us-ex1.zend.com ([192.168.16.5]) by mx1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 11 Feb 2008 20:49:08 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Mon, 11 Feb 2008 10:49:04 -0800 Message-ID: <698DE66518E7CA45812BD18E807866CE013AA6C9@us-ex1.zend.net> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PHP-DEV] [RFC] Conditional INI support Thread-Index: AchrKQiHfx1/Y9JMRYuLxwH4IskikABs7+Ig References: <971575499.20080209153315@marcus-boerger.de> To: "Marcus Boerger" , "PHP Internals List" X-OriginalArrivalTime: 11 Feb 2008 18:49:08.0802 (UTC) FILETIME=[C8D54A20:01C86CDE] Subject: RE: [PHP-DEV] [RFC] Conditional INI support From: andi@zend.com ("Andi Gutmans") Hi Marcus, In general I think conditional INI support can benefit many of our users. We just need to make sure that we cover the most common needs and also that we keep it very basic and simple so that we don't boil the ocean and maintain two languages. So it's a balance we need to meet. It would be very helpful that as part of the feedback loop you write something a bit more detailed about this feature and what is and isn't supported. I imagine most people on this list would have a hard time to figure that out from the patch. This includes: - What operators are supported in conditionals - Are there any "functions" like empty() or is the ternary operator the proposed solution for that? - Is it possible to get to environment variables from this? If so how is it namespaced? How about registry on Windows? - What happens when you use a variable which is not set? - Do you propose a solution for concatenation of two values or is this outside the scope? - Can each [IF] include multiple conditionals i.e. $(value) > 1 AND $(value) < 5 or just one condition with the expectation that people will use nesting. A few specific feedbacks: - Ternary operator's syntax is a bit weird. My preference would be not to have such an operator and require using [if ..] so that it's very clear what's pre-processed even if it requires a bit more works. We don't want the INI files to become too cryptic. Also the syntax would be better formed as ${value}?1:2 but again I think it's better not to have it. - I would prefer to see [ELSEIF] instead of [ELIF] to be consistent with PHP. It would look weird for the same solution to have two approaches to this. Thanks! Andi > -----Original Message----- > From: Marcus Boerger [mailto:helly@php.net] > Sent: Saturday, February 09, 2008 6:33 AM > To: PHP Internals List > Subject: [PHP-DEV] [RFC] Conditional INI support >=20 > Hello PHPlers, >=20 > attached is a patch against 5.3 that brings three feature additions > to INI parsing. >=20 > 1) Ternary support for values >=20 > setting =3D ${value?1:2} >=20 > If ${value} evaluates to true then setting becomes 1 otherwise 2. > This cannot be nested and only works for values, not for setting names. >=20 > 2) if-elif-else-endif support >=20 > [IF ${value} =3D=3D 1] > setting =3D 1 > [ELIF ${value} =3D=3D 2] > setting =3D 2 > [ELSE] > setting =3D 3 > [ENDIF] >=20 > This can be nested. Alternatively we could use apache style syntax that > looks more like XML. The reason I used square brackets is that this is > the smallest change to normal INI files. >=20 > 3) Add more values to INI parsing, namely: >=20 > ${php.version} =3D 50300 > ${php.debug} =3D 0 > ${php.zts} =3D 0 > ${php.sapi} =3D CLI >=20 > Any comments? >=20 > Best regards, > Marcus