Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84300 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12322 invoked from network); 4 Mar 2015 19:08:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Mar 2015 19:08:24 -0000 Authentication-Results: pb1.pair.com header.from=marcio.web2@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=marcio.web2@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.179 as permitted sender) X-PHP-List-Original-Sender: marcio.web2@gmail.com X-Host-Fingerprint: 209.85.217.179 mail-lb0-f179.google.com Received: from [209.85.217.179] ([209.85.217.179:45637] helo=mail-lb0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0F/B7-56703-72857F45 for ; Wed, 04 Mar 2015 14:08:23 -0500 Received: by lbiz12 with SMTP id z12so18527640lbi.12 for ; Wed, 04 Mar 2015 11:08:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=5phdS2f1koiacGZlE0jnkXBhyKfWSXYrqruF12C9Jrk=; b=RyDikJyTDWrGcFmRWEgaKvqWbyFumG5LlyQrEkQYnJGM6HEL3RHk1VkcIRYTsVf6aN Vkuq3KYG6ttNEL0MUUyIDJqOUX2PXnB7iwpZTBbl/tqs+NTncUunVC8ydLyTPBUsmEce gIrHpD3uQt0DSDB7uWnkE6kWh5EYMnlMK+6G+162hwYivoyyMMztUjoHN0Fg3krt1Ahz sMUGJot4DL06t2CV3WMMkC4KEPthjZk2h5s2tmwRO4Jv5KE1X0ZGnf2LhYJ+wIKWdhME uIUvn4BY4yuvLaqOQ9kbe/d00rFNylznkTJIu5R6Kksmeus+Mw6+IE1v57zF/ZmLJBcK o/uQ== X-Received: by 10.152.26.201 with SMTP id n9mr4699484lag.29.1425496099732; Wed, 04 Mar 2015 11:08:19 -0800 (PST) MIME-Version: 1.0 Received: by 10.152.118.193 with HTTP; Wed, 4 Mar 2015 11:07:58 -0800 (PST) Reply-To: marcio3w@gmail.com In-Reply-To: References: Date: Wed, 4 Mar 2015 16:07:58 -0300 Message-ID: To: Yasuo Ohgaki Cc: PHP internals Content-Type: multipart/alternative; boundary=089e0160a706a7435305107b2c8a Subject: Re: [PHP-DEV][RFC][DISCUSSION] Strict Argument Count From: marcio.web2@gmail.com (Marcio Almada) --089e0160a706a7435305107b2c8a Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, 2015-03-03 16:48 GMT-03:00 Yasuo Ohgaki : > Hi Marcio, > > I understand your reasons. Compatibility is important, but detecting > function body contents and > suppressing errors by engine is too hacky. Raising E_DEPRECATE/E_STRICT b= y > function definition seems > the way to go. IMO. > > Just one correction, we are not "suppressing" the warning. It just emits the warning conditionally and that's not hacky at all. We already have other situations where warnings are emitted just when certain conditions are met. > [yohgaki@dev github-php-src]$ php -r 'function f(...$a) {var_dump($a);}; > f(1,2,3);' > array(3) { > [0]=3D> > int(1) > [1]=3D> > int(2) > [2]=3D> > int(3) > } > [yohgaki@dev github-php-src]$ php -r 'function f($a) {var_dump($a);}; > f(1,2,3);' > int(1) > > is current behavior. The latter would be > > [yohgaki@dev github-php-src]$ php -r 'function f($a) {var_dump($a);}; > f(1,2,3);' > Deprecated: Excessive argument for f() without "...", called in Command > line code on line 1 and defined in Command line code on line 1 > int(1) > > Using only the function signatures, overlooking *func_get_args()*, would be in practice an indirect deprecation of* func_get_args()* and that's not negotiable at all, at least on this RFC. We simply can't do this now because it would be an enormous BC break and PHP 5.5, which has no "first class" variadics, is still supported. I understand the reasons you want to do it, but I think we should wait a bit more before discussing a possible *func_get_args* deprecation (if it will ever be deprecated). That's not the point addresses by this RFC. > User may have a lot of E_DEPRECATED errors anyway if strict scalar type > hint passes. > That's highly speculative. We don't even know if the proposal of scalar typehints with BC breaks will ever get voted, neither if it will pass. It's not a good idea to take decisions based upon that. Don't you think so? > I like the idea. Please use function definition for errors. (E_DEPRECTED > or E_STRICT whichever > is suitable) > > I'm proposing a warning because currently PHP internal functions already use a warning to indicate wrong argument count. Using E_STRICT or whichever would look inconsistent IMMO at a first sight. But I think that E_STRICT || E_WARNING || E_DEPRECATED is a very debatable topic. Regards, > > -- > Yasuo Ohgaki > yohgaki@ohgaki.net > > M=C3=A1rcio. --089e0160a706a7435305107b2c8a--