Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58167 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18517 invoked from network); 27 Feb 2012 18:22:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Feb 2012 18:22:55 -0000 Authentication-Results: pb1.pair.com smtp.mail=ceo@l-i-e.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ceo@l-i-e.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain l-i-e.com designates 67.139.134.202 as permitted sender) X-PHP-List-Original-Sender: ceo@l-i-e.com X-Host-Fingerprint: 67.139.134.202 o2.hostbaby.com FreeBSD 4.7-5.2 (or MacOS X 10.2-10.3) (2) Received: from [67.139.134.202] ([67.139.134.202:3512] helo=o2.hostbaby.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 69/52-40985-EF9CB4F4 for ; Mon, 27 Feb 2012 13:22:55 -0500 Received: (qmail 38545 invoked by uid 98); 27 Feb 2012 18:22:54 -0000 Received: from localhost by o2.hostbaby.com (envelope-from , uid 1013) with qmail-scanner-2.05 ( Clear:RC:1(127.0.0.1):. Processed in 0.037126 secs); 27 Feb 2012 18:22:54 -0000 Received: from localhost (HELO www.l-i-e.com) (127.0.0.1) by localhost with SMTP; 27 Feb 2012 18:22:54 -0000 Received: from webmail (SquirrelMail authenticated user ceo@l-i-e.com) by www.l-i-e.com with HTTP; Mon, 27 Feb 2012 12:22:54 -0600 Message-ID: <6d7e3ff8878174e4ae627b6744744330.squirrel@www.l-i-e.com> In-Reply-To: References: <4F457517.7050901@alliantinternet.com> <028d01ccf230$91d79b00$b586d100$@alliantinternet.com> <4F4686C6.2040207@sugarcrm.com> <4F496818.8000405@sugarcrm.com> <4F4982BF.8090102@sugarcrm.com> <4F4AA569.10502@gmail.com> Date: Mon, 27 Feb 2012 12:22:54 -0600 To: internals@lists.php.net User-Agent: SquirrelMail/1.4.21 [SVN] MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Subject: Re: [PHP-DEV] [RFC] Enum proposal (yet another) From: ceo@l-i-e.com ("Richard Lynch") >> I'm not so sure about that. In a well-written web application, you >> would >> typically convert them on the first layer, when receiving from the >> web. >> On next usages, your int variables are usually ints already. Afraid not. It turns out that PHP, on 32-bit hardware, converting large BIGINT using (int) $ID ends up as a negative number, and then when you pass it in to the database if a string query, you get a negative ID, not at all what was intended. (Been there, done that, got burned) At least, that's been my experience with some versions of PHP and some database drivers. So at least the database IDs have to remain as strings, if you are using BIGINT. You could, of course, only convert the values known to be in range of PHPs positive integers, and leave the others as strings. This is just a simple example of how the super strict typing simply doesn't work out too well in PHP. -- brain cancer update: http://richardlynch.blogspot.com/search/label/brain%20tumor Donate: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FS9NLTNEEKWBE