Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:44600 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46615 invoked from network); 1 Jul 2009 19:59:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jul 2009 19:59:21 -0000 Authentication-Results: pb1.pair.com header.from=foolistbar@googlemail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=foolistbar@googlemail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 209.85.219.227 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: foolistbar@googlemail.com X-Host-Fingerprint: 209.85.219.227 mail-ew0-f227.google.com Received: from [209.85.219.227] ([209.85.219.227:63258] helo=mail-ew0-f227.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5C/A0-43450-710CB4A4 for ; Wed, 01 Jul 2009 15:59:20 -0400 Received: by ewy27 with SMTP id 27so1298893ewy.23 for ; Wed, 01 Jul 2009 12:59:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:cc:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer; bh=s/CUzHEMeY79IKNHB42VKz7fXbr4QVz4gfneZrcqnuo=; b=UFt1xQC5DZELKiy3S2Hydbh78tvnfldPoEMPRhXju1i9uhky6c9JQeFHKVsIBFUUl+ Bx/a64/a5mn9rb2lIeiI6x6hNwahHnrT4/A+P5vje4XnEL7OejtCL1I8ihDgAoH8DuKV gzzV0nXwaGOtDBmYsVNbKgI4JL7MzrcI7mSmg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=cc:message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; b=XWjkiO3CkbxxEmhwSrGa925w4kP3hCJ44WhCB7U2zIJJt+0DI+iHcPF+jW6iEKRr/P cRUVucdOY1WOmBMjZzI8/e5eoC8c2qI7ZzI0G4Jxr5eWWv/WWvM9verCqh8M6/Wkyfwb cSZUjW0kIsk2Sdpg52A5AS28XNdMwAAvukznI= Received: by 10.216.7.212 with SMTP id 62mr2939771wep.92.1246478356467; Wed, 01 Jul 2009 12:59:16 -0700 (PDT) Received: from c83-252-197-137.bredband.comhem.se (c83-252-197-137.bredband.comhem.se [83.252.197.137]) by mx.google.com with ESMTPS id m5sm3672070gve.18.2009.07.01.12.59.15 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 01 Jul 2009 12:59:15 -0700 (PDT) Cc: PHP internals Message-ID: <8C356C24-8A93-4B9E-B6D6-4ADADF6EF5F0@googlemail.com> To: Ilia Alshanetsky In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v935.3) Date: Wed, 1 Jul 2009 21:59:13 +0200 References: X-Mailer: Apple Mail (2.935.3) Subject: Re: [PHP-DEV] RFC: Type hinting revisited for PHP 5.3 From: foolistbar@googlemail.com (Geoffrey Sneddon) On 1 Jul 2009, at 18:59, Ilia Alshanetsky wrote: > The main source of conflict appears to be that in some cases typical > type hinting is just too strict for PHP's typeless nature (most > people expect that "1" == 1, while int type hint would definitely > reject string "1"). To be fair, this is really my compliant, but: I think, for consistency, it should behaviour like zend_parse_parameters, hence not being overly strict, and should set the variable to it casted to the expected type. If it behaves differently to zend_parse_parameters then it'll be annoying that substr(), whose first parameter is a string, behaves differently to function foobar(string $what) when passed an int, for example. I'd expect: function foo(string $bar) { var_dump($bar); } foo(1234); To output: string(4) "1234" As this appears to be consistent with what internal functions that use zend_parse_parameters do. I don't want PHP to become any more inconsistent with itself than it already is. -- Geoffrey Sneddon