Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:40879 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94709 invoked from network); 7 Oct 2008 19:59:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Oct 2008 19:59:25 -0000 Authentication-Results: pb1.pair.com smtp.mail=quickshiftin@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=quickshiftin@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.198.226 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: quickshiftin@gmail.com X-Host-Fingerprint: 209.85.198.226 rv-out-0506.google.com Received: from [209.85.198.226] ([209.85.198.226:52561] helo=rv-out-0506.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D8/4F-48736-B9FBBE84 for ; Tue, 07 Oct 2008 15:59:23 -0400 Received: by rv-out-0506.google.com with SMTP id g37so3486746rvb.23 for ; Tue, 07 Oct 2008 12:59:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=6rWQUVtQKNDjyXdPRfTk0tft1ODgDm4+4Li9ljDFmTk=; b=GPA3rgj6TM7CeF3AGuE0Fv4I0ua0jVFlVu8gnGzDvHhE6oOhdFpCKbUTpDCwSglnRZ GLqz2H7zrLmGtNVI8ENwyqKb78yP1m0B9PCfNv9uW4wbBcrBcBoYyDoaIRmceQ3gitjs Ct3T1jW829TSMMte/Iy5MPR/OxrnSUcyzWEVo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=GQTTTLFlIwQj5PS/hNmJspBp4xt9FEbi2PtBD2IDknWZg9/9zbAcFeGwHZbCUSw4Ex 19yUi3UwUyMiljgPxVC+77b7Ye8sbvc/ah2Km5OOgYyo/xO1UF2bFCBfIBj/WxMP61Gv Givg9snDeFmB3F1aY9breuF3Yon2ZnoIrXJOQ= Received: by 10.141.49.6 with SMTP id b6mr4237722rvk.89.1223409559720; Tue, 07 Oct 2008 12:59:19 -0700 (PDT) Received: by 10.141.70.10 with HTTP; Tue, 7 Oct 2008 12:59:19 -0700 (PDT) Message-ID: <7dd2dc0b0810071259w438223d1x522feacda511908b@mail.gmail.com> Date: Tue, 7 Oct 2008 13:59:19 -0600 To: internals@lists.php.net MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_65944_33353352.1223409559710" Subject: type hint semantics; disagreement between phpt and manual From: quickshiftin@gmail.com ("Nathan Nobbe") ------=_Part_65944_33353352.1223409559710 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline hi all, we are encountering an error in our code due to type hint semantics. php is allowing NULL values through a type hint for a class, however, if i read the manual, NULL, should only be allowed, if and only if, null is given as the default value for the formal parameter that is type-hinted. "PHP 5 introduces Type Hinting. Functions are now able to force parameters to be objects (by specifying the name of the class in the function prototype) or arrays (since PHP 5.1). However, if NULLis used as the default parameter value, it will be allowed as an argument for any later call." now, i have checked our code; there is no NULL default value, and there are no parents which mark a default value of NULL. so why would they be creeping through then.. ? well, i glanced at the phpt test, and its quite clear the tests are allowing NULL, Zend/tests/errmsg_013.phpt:errmsg: default value for parameters with array type hint can only be an array or NULL Zend/tests/errmsg_013.phpt:Fatal error: Default value for parameters with array type hint can only be an array or NULL in %s on line %d looking at the function prototype in this test, NULL is not specefied as the default value, so i dont think NULL should be allowed here anyway.. --TEST-- errmsg: default value for parameters with array type hint can only be an array or NULL --FILE-- --EXPECTF-- Fatal error: Default value for parameters with array type hint can only be an array or NULL in %s on line %d this taken from 5.2.6.RC3 source. it seems to me, either the source or the manual is wrong, but which one is it ?? personally, i would prefer it be the former in this case ;) FWIW, we are currently running php5.2.2 on centos5, but im pretty sure an upgrade to 5.2.6 will not change the semantics, since the phpt tests were the same in both the 5.2.2 & 5.2.6 source. -nathan ------=_Part_65944_33353352.1223409559710--