Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83037 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64272 invoked from network); 18 Feb 2015 09:55:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Feb 2015 09:55:03 -0000 Authentication-Results: pb1.pair.com smtp.mail=lester@lsces.co.uk; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=lester@lsces.co.uk; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lsces.co.uk from 217.147.176.214 cause and error) X-PHP-List-Original-Sender: lester@lsces.co.uk X-Host-Fingerprint: 217.147.176.214 mail4-2.serversure.net Linux 2.6 Received: from [217.147.176.214] ([217.147.176.214:44976] helo=mail4.serversure.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 57/27-18888-47164E45 for ; Wed, 18 Feb 2015 04:55:02 -0500 Received: (qmail 27236 invoked by uid 89); 18 Feb 2015 09:54:57 -0000 Received: by simscan 1.3.1 ppid: 27230, pid: 27233, t: 0.1262s scanners: attach: 1.3.1 clamav: 0.96/m:52/d:10677 Received: from unknown (HELO ?10.0.0.8?) (lester@rainbowdigitalmedia.org.uk@86.189.147.37) by mail4.serversure.net with ESMTPA; 18 Feb 2015 09:54:57 -0000 Message-ID: <54E46171.3010805@lsces.co.uk> Date: Wed, 18 Feb 2015 09:54:57 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: internals@lists.php.net References: <54E3E27B.2010903@lerdorf.com> <2f99c47df51fa6c73131032ec50fade0@mail.gmail.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Scalar Type Hints v0.4 From: lester@lsces.co.uk (Lester Caine) On 18/02/15 09:14, Andrey Andreev wrote: > That is especially bad when such identifiers are in fact generated as > integers first so that they are incremental, but the > program/database/business logic requires them to be fixed-length > strings and/or in hexadecimal format. In such cases, even silently > discarding leading zeros can prove to be problematic, while in the > case of hexadecimal representations you'd need more than 10 data > samples to notice the problem if you don't use a strict hint. > Obviously, that would be solved with automated testing, but > unfortunately even code with high test coverage % often lacks depth in > its test cases. Octal is something that can often be miss converted since it IS the same as an integer with only a '0' in front in PHP. But that is not something that can be fixed with the current proposals? Again we have to ensure that the pre-processing takes care of the problem and how would static analysis even know there was a problem? A type hint following the SQL standards would be more helpful than the javascript approach of giving an error in strict mode. -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk