Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78185 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4708 invoked from network); 21 Oct 2014 09:14:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Oct 2014 09:14:54 -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 209.85.218.51 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.218.51 mail-oi0-f51.google.com Received: from [209.85.218.51] ([209.85.218.51:52925] helo=mail-oi0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8B/70-02077-D0426445 for ; Tue, 21 Oct 2014 05:14:53 -0400 Received: by mail-oi0-f51.google.com with SMTP id h136so608727oig.10 for ; Tue, 21 Oct 2014 02:14:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=Edn2MQDDzh0kGWTyVjMGCzhsf+4rR+auPREoi9obGhs=; b=HujJGk931Ox6yUpHdHuukoOcnPbudJYmBhTxymOpJEp8HiwQsp9PX6fjMqiIctE0MC ajS0TeY0QhxPavJ/pBFxkmokI2SeQjMzyX+jx09pwFMpLgP1TcZr8PmHUcae1T+7/Ixa SBu5RjqN5QNbTv44gBZbdCOK6UKojPsgNnV2EDpTNHDO9G3vdStIPRwGaGGoibkSq5ie yjc8OyWI+73DxjYO3LPPefJKb/EKv1LBecG9esOZFORpvFDGNE/3HzQnAX4jS7L/OL+p 22A3hivhdNWuoIDL4hy8/LYy5wb5HGbxqR1XhMCSL171D244Hxm84ltbBQdhYmXrSsuZ 6Nxg== X-Gm-Message-State: ALoCoQmYL/RSDhMHApkt1bbTuk44AV9frMErErzFb6iF7mH8K6Hw7ybcgCLpeZDJChN0+Sy766rhqKGITJC3HjAGh99CpfJTQ4d4X/3U9hHahOngMkFJv03JatRqgT8m1383a6JOGYXcDWVsCDnumeIe2NOwWUXVXQ== MIME-Version: 1.0 X-Received: by 10.60.67.233 with SMTP id q9mr28538174oet.30.1413882889959; Tue, 21 Oct 2014 02:14:49 -0700 (PDT) Received: by 10.60.70.41 with HTTP; Tue, 21 Oct 2014 02:14:49 -0700 (PDT) In-Reply-To: <66B7B28C-2651-4A71-AC2A-55D4C7BB3DDC@ajf.me> References: <66B7B28C-2651-4A71-AC2A-55D4C7BB3DDC@ajf.me> Date: Tue, 21 Oct 2014 13:14:49 +0400 Message-ID: To: Andrea Faulds Cc: PHP Internals Content-Type: multipart/alternative; boundary=001a11c30fbc693f970505eb433a Subject: Re: [PHP-DEV] [RFC] Safe Casting Functions From: dmitry@zend.com (Dmitry Stogov) --001a11c30fbc693f970505eb433a Content-Type: text/plain; charset=UTF-8 Both, the idea and implementation look fine. Personally, I hate the existing type conversion rules, and I would like to use something like this by default (may be with exception for null/false/true handling), but it may be a big compatibility break, so introducing to_int() is better than nothing. some notes: - it's probably make sense to implement these function as a new opcode(s) in VM - in case of conversion failure it's better to throw exception (to_int() returning FALSE is a pain). Thanks. Dmitry. On Tue, Oct 21, 2014 at 2:57 AM, Andrea Faulds wrote: > Good evening, > > I am presenting a new RFC to add a set of three functions to do validated > casts for scalar types: > > https://wiki.php.net/rfc/safe_cast > > Please read it. > > Thanks! > -- > Andrea Faulds > http://ajf.me/ > > > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a11c30fbc693f970505eb433a--