Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78211 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70157 invoked from network); 21 Oct 2014 20:57:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Oct 2014 20:57:00 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.182 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.212.182 mail-wi0-f182.google.com Received: from [209.85.212.182] ([209.85.212.182:42473] helo=mail-wi0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7E/CB-02077-A98C6445 for ; Tue, 21 Oct 2014 16:56:59 -0400 Received: by mail-wi0-f182.google.com with SMTP id bs8so2143678wib.15 for ; Tue, 21 Oct 2014 13:56:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=4bnvWxOqPmpgh10095CPQOQoPe/+UnCjC/obB+wWTZk=; b=zABGX5TIAKuRBf87bt1+/78ccGkTsQWKbAvZFsA6exFisxbTaL+5ZH9tqwRWsI4n0z dKPXU1Pyc8F5PI5C2dgFDef/kUj//lFUKOMsjc2g/I8lj6hsRenNPDFRvqAdEqaLNbn0 UltyAjS/vmRmSGE3eqofLIIhB2/XnlZDmERCwnBHEZWw/rvs4kUYOE43x5L/F4XOqMRh c4OdtXIaN83nhhMi4cqGASNyenbiXjXNh0RG6EhHrH4k9pieI+Zsc1lWS8On7eyZPUXU gP/02eEj1qyPYlI9IRaZqM3Sne/rISRVhWU8ID8M49AgGoAnTNuyoyIJHzov6tNolEOT QDuw== X-Received: by 10.194.60.230 with SMTP id k6mr7305322wjr.135.1413925015860; Tue, 21 Oct 2014 13:56:55 -0700 (PDT) Received: from [192.168.0.2] (cpc68956-brig15-2-0-cust215.3-3.cable.virginm.net. [82.6.24.216]) by mx.google.com with ESMTPSA id wm6sm16592483wjb.5.2014.10.21.13.56.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Oct 2014 13:56:55 -0700 (PDT) Message-ID: <5446C896.9020500@gmail.com> Date: Tue, 21 Oct 2014 21:56:54 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: internals@lists.php.net References: <66B7B28C-2651-4A71-AC2A-55D4C7BB3DDC@ajf.me> <5445A9AE.2060001@sugarcrm.com> <5445B206.9010801@sugarcrm.com> <5445BB6F.6080905@sugarcrm.com> In-Reply-To: <5445BB6F.6080905@sugarcrm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC] Safe Casting Functions From: rowan.collins@gmail.com (Rowan Collins) On 21/10/2014 02:48, Stas Malyshev wrote: >> It would be possible to make to_int() merely an alias of >> >filter_var(…, FILTER_VALIDATE_INT). Though that would make it depend >> >on ext/filter or otherwise duplicate functionality. > You seem to sound like depending on something already existing in PHP is > a bad thing. > I think the point was that ext/filter extension is optional (its enabled by default, but not mandatory) whereas > I'm not sure how using function starting with to_ is "more > straightforward" than using function starting with filter_ As I mentioned in a previous thread, the design of ext/filter makes it feel like a Swiss Army knife when what I'm looking for is a pair of scissors - it will work, but I have to figure out how to select the right component (both a function and a filter type), and whether the other bits will get in my way (do I need to set any options? what is the actual return type?). On the other hand, the myriad of options it provides covers off most of the issues in this discussion, so maybe that complexity is the price you pay for pleasing all the people, and it's just a matter of documentation. -- Rowan Collins [IMSoP]