Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:26240 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44911 invoked by uid 1010); 25 Oct 2006 06:40:27 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 44896 invoked from network); 25 Oct 2006 06:40:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Oct 2006 06:40:27 -0000 Authentication-Results: pb1.pair.com header.from=keo.skalpa@gmail.com; sender-id=pass; domainkeys=good Authentication-Results: pb1.pair.com smtp.mail=keo.skalpa@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 64.233.182.188 as permitted sender) DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: keo.skalpa@gmail.com X-Host-Fingerprint: 64.233.182.188 nf-out-0910.google.com Linux 2.4/2.6 Received: from [64.233.182.188] ([64.233.182.188:37143] helo=nf-out-0910.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2C/11-34241-9D60F354 for ; Wed, 25 Oct 2006 02:40:26 -0400 Received: by nf-out-0910.google.com with SMTP id y25so539608nfb for ; Tue, 24 Oct 2006 23:40:22 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:reply-to:to:subject:date:user-agent:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=DDoKJbQL2E1NDaAylXubcjecAa3At5kf6XtZX+Wunj1oJal4+lzmk3jO1Ev7p6RDVCbqfv/zkHZipZkHzss1JyVplRVUYfS7fPF/Hnu+DazsN6Hbym6PkTi8XTYrW0zFlEqV4qq8CoO1U1moG30mlj/raH+V8nVIUQx/Vd/xOq4= Received: by 10.49.93.13 with SMTP id v13mr2656444nfl; Tue, 24 Oct 2006 23:40:22 -0700 (PDT) Received: from ?192.168.1.2? ( [84.5.173.51]) by mx.google.com with ESMTP id k24sm61858nfc.2006.10.24.23.40.21; Tue, 24 Oct 2006 23:40:22 -0700 (PDT) Reply-To: keo.skalpa@gmail.com To: internals@lists.php.net Date: Wed, 25 Oct 2006 08:40:27 +0200 User-Agent: KMail/1.9.5 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <200610250840.27409.keo.skalpa@gmail.com> Subject: Smaller fix for the ext/filter boolean filter limitation (was Re: cvs: php-src /ext/filter long subject) From: keo.skalpa@gmail.com (Skalpa Keo) Hi, First my apologies for not being able to go a real reply to the real thread, but I just subscribed to the list a couple days ago (and the original thread subject was way too long anyway ;-)). > > Boolean values are the only case where it is not possible to > > distinguish FALSE from invalid as they can be FALSE, but it is really > > not an issue. > If it wasn't an issue I wouldn't have fixed it. IMHO there's a more simple way to fix that without changing all the functions behavior. I think the distinction between NULL (non-existent data) and FALSE (invalid) should be kept and that having both cases return NULL, thus forcing users to use filter_has_var() to determine what this NULL means is a bit counter-intuitive. A quite smaller modification of the boolean filter behavior could allow this (I'm sorry I can't send you a patch, but I'm a "PHP user" who hasn't touched a C source file for years... I'll try and do better next time if I can). Make php_filter_boolean() return: - (int)1 when the value is 1/on/true/yes - (int)0 when the value is 0/off/false/no - (bool)false when the value is something else This is mostly backward compatible, as PHP considers that 0 == false and 1 == true, and would still allow people like Derick who'd need to make a difference between a "valid" boolean and an invalid value the possibility to do so by testing the returned value using ===. Also, it would just require a small change in one single function, which I think would be more safe considering 5.2.0 is already an RC5. Hoping I could be helpful, skalpa.>