Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77003 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68145 invoked from network); 1 Sep 2014 11:09:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Sep 2014 11:09:25 -0000 Authentication-Results: pb1.pair.com header.from=julienpauli@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=julienpauli@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.174 as permitted sender) X-PHP-List-Original-Sender: julienpauli@gmail.com X-Host-Fingerprint: 209.85.220.174 mail-vc0-f174.google.com Received: from [209.85.220.174] ([209.85.220.174:60511] helo=mail-vc0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 22/C1-48532-4E354045 for ; Mon, 01 Sep 2014 07:09:24 -0400 Received: by mail-vc0-f174.google.com with SMTP id hy4so5302250vcb.19 for ; Mon, 01 Sep 2014 04:09:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=32ZE9Sz6nh/ei5U0M48ccTQSE6vC8n5pHvOhO8adlMo=; b=Q/IwoX8G1michk4yhdLxKZO5MLOzd1CB7P37MFA92ZlXZVjYieI9GVKN7cOVSFeBGe fv+i7wyt8XXH8OYB95JHRzUPSHzUvdHY/gmqcaPbyijfCQ83/Kn/B+ln5raNjxywinjw zAJMxvQYGxw1fzjITOxMpzL1DdIIjl/lnht8vvi1r+Jx0q73DTYRwjJRPiKGeL+RI6+R hkSNpmk3Iw2VrdfGqAma9CzgVs/ZNuYlsswNSeSfmnhRr6cikO+A+w4vgbes7CU36qDZ 6OwHrnbqV4NfGcB9yuaWOrQ+yFH+vciEb0rNIvafwNkXco5lxwHjxxHBYQzaxJEAqZSO +8DQ== X-Received: by 10.220.49.10 with SMTP id t10mr12678vcf.34.1409569761586; Mon, 01 Sep 2014 04:09:21 -0700 (PDT) MIME-Version: 1.0 Sender: julienpauli@gmail.com Received: by 10.221.34.194 with HTTP; Mon, 1 Sep 2014 04:08:41 -0700 (PDT) In-Reply-To: <2BBB5D80-5594-4F53-B507-4AD3BB03AE0A@gmail.com> References: <2BBB5D80-5594-4F53-B507-4AD3BB03AE0A@gmail.com> Date: Mon, 1 Sep 2014 13:08:41 +0200 X-Google-Sender-Auth: KX-LmHJZr5RnXqoXmROhTf4Wp2s Message-ID: To: Tjerk Meesters Cc: PHP Internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Making parse_ini_*() aware of types From: jpauli@php.net (Julien Pauli) On Sat, Aug 30, 2014 at 4:36 PM, Tjerk Meesters wrote: > Hi internals, > > I was going through the bug list and found this report: > > https://bugs.php.net/bug.php?id=3D38409 > > It discusses the fact that `parse_ini_file()` and `parse_ini_string()` th= row away type information; for instance, the flag =E2=80=9Con=E2=80=9D does= n=E2=80=99t translate into a bool(true) but string(=E2=80=9C1=E2=80=9D). > > The report has had 21 votes and an average score of 4.3 +- 0.7, so it see= ms to have some traction with users. > > > Simply changing this behaviour would cause BC, so I=E2=80=99ve found a wa= y in which this can be solved with a separate scanner mode; e.g.: > > $data =3D parse_ini_file(=E2=80=98/path/to/file=E2=80=99, true, INI_SCANN= ER_TYPED); > > A patch for the lexer can be found here, together with a simple test case= : > > https://github.com/datibbaw/php-src/compare/php:master...datibbaw:ini-sca= nner-plus > > It currently distinguishes between booleans, numbers and NULL (it was men= tioned in the ticket by someone else, not entirely sure of its usefulness, = though). I haven=E2=80=99t benchmarked it, but the impact on performance sh= ould be quite minimal. > > Thoughts? +1 for me, this seems obvious. Julien