Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:35509 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 9695 invoked by uid 1010); 15 Feb 2008 08:36:44 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 9680 invoked from network); 15 Feb 2008 08:36:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Feb 2008 08:36:44 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; 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: dmitry@zend.com X-Host-Fingerprint: 212.25.124.162 mail.zend.com Linux 2.5 (sometimes 2.4) (4) Received: from [212.25.124.162] ([212.25.124.162:62480] helo=mail.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BB/61-26828-91F45B74 for ; Fri, 15 Feb 2008 03:36:44 -0500 Received: (qmail 24961 invoked from network); 15 Feb 2008 08:36:37 -0000 Received: from unknown (HELO ?10.1.20.12?) (10.1.20.12) by cvs.zend.com with SMTP; 15 Feb 2008 08:36:37 -0000 Message-ID: <47B54F0C.2090700@zend.com> Date: Fri, 15 Feb 2008 11:36:28 +0300 User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: Marcus Boerger CC: PHP Internals List , Andi Gutmans References: <971575499.20080209153315@marcus-boerger.de> In-Reply-To: <971575499.20080209153315@marcus-boerger.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Conditional INI support From: dmitry@zend.com (Dmitry Stogov) Hi Marcus, I think that the idea of ini preprocessing is great, however I would like little bit different syntax. a) I think we don't need (1) ternary support at all, as (2) if-elif=else-endif may do the same. b) I think usage of square brackets is not a good idea, because they are commonly used to divide ini files into sections. Why not to use C syntax? (#if...) c) We can use just "value" insted of ${value} in conditions. d) I would prefer not to use '.' in the variables name. It will allow to distribute conditional ini files, and use them with old PHP versions after manual preprocessing (using cpp). e) We don't need to define special names, we can use internal PHP constants. #if PHP_VERSION == '5.2.0' setting = 1 #elif PHP_VERSION == '5.3.0' setting = 2 #else setting = 3 #endif What do you think? (we can probably use similar preprocessor for PHP scripts too) Thanks. Dmitry. Marcus Boerger wrote: > Hello PHPlers, > > attached is a patch against 5.3 that brings three feature > additions to INI parsing. > > 1) Ternary support for values > > setting = ${value?1:2} > > If ${value} evaluates to true then setting becomes 1 otherwise 2. > This cannot be nested and only works for values, not for setting names. > > 2) if-elif-else-endif support > > [IF ${value} == 1] > setting = 1 > [ELIF ${value} == 2] > setting = 2 > [ELSE] > setting = 3 > [ENDIF] > > 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. > > 3) Add more values to INI parsing, namely: > > ${php.version} = 50300 > ${php.debug} = 0 > ${php.zts} = 0 > ${php.sapi} = CLI > > Any comments? > > Best regards, > Marcus > > > ------------------------------------------------------------------------ > > This body part will be downloaded on demand.