Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78278 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13350 invoked from network); 23 Oct 2014 19:40:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Oct 2014 19:40:50 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@mabe.berlin; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php@mabe.berlin; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mabe.berlin from 80.237.132.167 cause and error) X-PHP-List-Original-Sender: php@mabe.berlin X-Host-Fingerprint: 80.237.132.167 wp160.webpack.hosteurope.de Received: from [80.237.132.167] ([80.237.132.167:51192] helo=wp160.webpack.hosteurope.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AA/9B-41150-EB959445 for ; Thu, 23 Oct 2014 15:40:48 -0400 Received: from dslb-178-005-231-204.178.005.pools.vodafone-ip.de ([178.5.231.204] helo=[192.168.178.30]); authenticated by wp160.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) id 1XhOFX-0007of-Su; Thu, 23 Oct 2014 21:40:43 +0200 Message-ID: <544959B8.20207@mabe.berlin> Date: Thu, 23 Oct 2014 21:40:40 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: internals@lists.php.net References: <66B7B28C-2651-4A71-AC2A-55D4C7BB3DDC@ajf.me> In-Reply-To: <66B7B28C-2651-4A71-AC2A-55D4C7BB3DDC@ajf.me> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-bounce-key: webpack.hosteurope.de;php@mabe.berlin;1414093248;c59040f3; Subject: Re: [PHP-DEV] [RFC] Safe Casting Functions From: php@mabe.berlin (Marc Bennewitz) I really like the strictness of this casting rules except of "010" will be a valid integer / float. As of you don't allow "0x" and trailing white spaces as valid numbers and don't allow floating like syntax as integers even if it result in mathematical integer. Allowing prefixed "0" as valid numbers results in a small data loss ("010" !== to_string(to_int("010"))), is simple to address in user land with ltrim("010", "0") (Same argument as trailing whitespace) and collides with octal notation (010 !== to_int("010")) Marc On 21.10.2014 00:57, 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/ > > > > >