Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:50474 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36960 invoked from network); 24 Nov 2010 17:28:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Nov 2010 17:28:43 -0000 Authentication-Results: pb1.pair.com smtp.mail=jbafford@zort.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=jbafford@zort.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain zort.net from 96.241.205.2 cause and error) X-PHP-List-Original-Sender: jbafford@zort.net X-Host-Fingerprint: 96.241.205.2 nova.zort.net Received: from [96.241.205.2] ([96.241.205.2:37839] helo=nova.zort.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FB/00-36251-94B4DEC4 for ; Wed, 24 Nov 2010 12:28:42 -0500 Received: from [10.0.1.2] (pulsar.zort.net [96.241.205.6]) (authenticated bits=0) by nova.zort.net (8.14.4/8.14.4) with ESMTP id oAOHScim023080 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Wed, 24 Nov 2010 12:28:39 -0500 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Date: Wed, 24 Nov 2010 12:28:38 -0500 Message-ID: <1DFD5821-B2F2-4212-9CB1-8D434123B101@zort.net> To: PHP Internals Mime-Version: 1.0 (Apple Message framework v1082) X-Mailer: Apple Mail (2.1082) Subject: Add E_STRICT when defining a required function parameter after an optional parameter From: jbafford@zort.net (John Bafford) Hi, I filed a bug report with an attached patch that adds an E_STRICT = warning when defining a function with a required parameter after an = optional function parameter, for example: function foo($optional =3D 1, $required) {} Although doing this works, code written like that is probably making a = faulty assumption somewhere, and emitting this error would help raise = the quality of php code. The bug and patch are here: http://bugs.php.net/bug.php?id=3D53399 The patch applies against both the PHP 5.3 branch, and trunk. I'm not = sure I'd advocate including it in PHP 5.3, but I'd definitely like to = see it in 5.4. The patch also includes two tests, and fixes this problem = in the Zend/tests/call_user_func_005.phpt test, which is the only test I = found that fails as a result. At some point in the future, I would like to make this a more severe = error than an E_STRICT, but I'd rather not immediately break code that = (until now) worked without warning. Thoughts/comments? -John -- John Bafford http://bafford.com/