Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:48413 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56883 invoked from network); 23 May 2010 14:22:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 May 2010 14:22:28 -0000 Authentication-Results: pb1.pair.com smtp.mail=zeev@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=zeev@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.185 as permitted sender) X-PHP-List-Original-Sender: zeev@zend.com X-Host-Fingerprint: 212.25.124.185 il-mr1.zend.com Received: from [212.25.124.185] ([212.25.124.185:51877] helo=il-mr1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0A/7E-54147-12A39FB4 for ; Sun, 23 May 2010 10:22:27 -0400 Received: from il-gw1.zend.com (unknown [10.1.1.21]) by il-mr1.zend.com (Postfix) with ESMTP id 3DE53504F4; Sun, 23 May 2010 16:59:27 +0300 (IDT) Received: from LAP-ZEEV.zend.com ([10.1.2.34]) by il-gw1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Sun, 23 May 2010 17:22:22 +0300 Message-ID: <7.0.1.0.2.20100523171341.160561e8@zend.com> X-Mailer: QUALCOMM Windows Eudora Version 7.0.1.0 Date: Sun, 23 May 2010 17:22:21 +0300 To: Davey Shafik Cc: Lukas Kahwe Smith , Sebastian Bergmann ,internals@lists.php.net In-Reply-To: <25952FF9-2E3E-4E4D-9894-245A2624E5AD@php.net> References: <7.0.1.0.2.20100522175819.0a601c68@zend.com> <93EFAEF4-26F3-44A1-85ED-5E71E665B966@pooteeweet.org> <698DE66518E7CA45812BD18E807866CE0427ED12@us-ex1.zend.net> <0F9B2086-BEF9-4621-8518-73DA64B1008D@pooteeweet.org> <25952FF9-2E3E-4E4D-9894-245A2624E5AD@php.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-OriginalArrivalTime: 23 May 2010 14:22:22.0313 (UTC) FILETIME=[5BE8E590:01CAFA83] Subject: Re: [PHP-DEV] Type hinting From: zeev@zend.com (Zeev Suraski) At 16:10 23/05/2010, Davey Shafik wrote: >We also already have a precedent for type-caring functions in the >ctype_* functions: > >$ php -r 'var_dump(ctype_digit(123), ctype_digit((string) 123));' >bool(false) >bool(true) There's a very specific reason for this behavior - ctype treats numeric values as ASCII and checks if they're in the right range. So, for instance, ctype_digit(48) would return true. Talk about a high WTF factor... Personally I think that's probably a poor decision, and I either way I wouldn't qualify it as precedent. Sure, there are functions that don't auto-convert and behave differently depending on the type that's passed to them - but they're very much the exception to the rule. Zeev