Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84358 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8589 invoked from network); 5 Mar 2015 21:37:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Mar 2015 21:37:23 -0000 Authentication-Results: pb1.pair.com smtp.mail=marcio.web2@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=marcio.web2@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.48 as permitted sender) X-PHP-List-Original-Sender: marcio.web2@gmail.com X-Host-Fingerprint: 209.85.215.48 mail-la0-f48.google.com Received: from [209.85.215.48] ([209.85.215.48:45460] helo=mail-la0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C9/0C-40418-29CC8F45 for ; Thu, 05 Mar 2015 16:37:23 -0500 Received: by labge10 with SMTP id ge10so53957834lab.12 for ; Thu, 05 Mar 2015 13:37: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=sgL25v+xllDjqm9u488VC96spvu/3X9FTdrhX2FB8xY=; b=IQerXIEnu5kB2N6oG/vTUB0HkDVDAQvKohr7YE8Vd/CYVnebtZdceW80PZGuOFT/OE DPsTwtPrSrHn1VdfRHkKFzCL4wFYyXGjSZJT8tyuLopHOyTwqTEQrXJoyyUT/C8rj5Hn L0fX9rXJHnUGYjBQE+x3fSwSmX0zxB1LMYaeTEpylpIeFVvUFPAPpins+eZ7qTkA6ncu cBZhqQ1QqX58ygOGZkGNEjHImOYMPhQf1tuZZVZm0dZQS8GQLyfNrCPGfm7g6Fk10C6G MXCbT070KZaoxhGEe81+1M0BxH3jvxnzIVcd/1gSSTvXgRVemnOA0P9hHsWZj+S6SQvH 82iQ== X-Received: by 10.112.54.165 with SMTP id k5mr9345557lbp.57.1425591439235; Thu, 05 Mar 2015 13:37:19 -0800 (PST) MIME-Version: 1.0 Received: by 10.152.118.193 with HTTP; Thu, 5 Mar 2015 13:36:58 -0800 (PST) Reply-To: marcio3w@gmail.com In-Reply-To: References: Date: Thu, 5 Mar 2015 18:36:58 -0300 Message-ID: To: Yasuo Ohgaki Cc: PHP internals Content-Type: multipart/alternative; boundary=001a11c3fc78549fd40510915f40 Subject: Re: [PHP-DEV][RFC][DISCUSSION] Strict Argument Count From: marcio.web2@gmail.com (Marcio Almada) --001a11c3fc78549fd40510915f40 Content-Type: text/plain; charset=UTF-8 Hi, 2015-03-04 21:51 GMT-03:00 Yasuo Ohgaki : > > I don't think we need to deprecate func_get_args(). We may have > > function f($a, ...) { > var_dump(func_get_args()); > } > > f(1,2,3); > ?> > > "...$a" packs arguments. Using "..." as variable parameter indication may > be allowed. > Strictly speaking, it's not needed, though. > > I think you are missing a "detail" here. Even if we add "..." to the language, people on PHP 5.5 would not be able to have it because this new syntax would be available only on PHP 7.0+ . We still have to account for func_get_args otherwise people maintaining packages for both PHP 7 and 5.5 will have no alternative to fix the warning. Do you get me? > >> >> 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 >> > > I don't care much about error types, because I change code so that any > errors are not raised anyway. > E_WARNING in this case makes sense because users made obvious errors. > > Great, so warning seems ok and it's good to keep consistency with other already well established language behaviors. > I understand you would like to address errors in older code with compiler > change. We don't have to > care much for older broken code. IMO. I understand importance of argument > count check. Your > wordpress research clearly shows that we must raise error for wrong > number of arguments. > > It's not "old broken code", it's PHP 5.5+ code and I already told you that this would be a bad BC break because: 1. people still have to support PHP 5.5, emit a warning ignoring func_get_args will only cause pain and won't these people. 2. this would impede the RFC to pass because we would now have a major BC break instead of a minor helpful one, and the RFC was proposed to help people, you saw the uses cases on the RFC. > Looking into function body and checking certain function existence seems > just too much for a > language. However, I don't have too strong opinion for this. I would like > to have comments from engine > developers. Any thoughts? > It would be nothing new or weird. It's just a simple compile time check. We already "inspect" code in many other situations while compiling and a lot of behaviors during execution already depend on compile time checks. I don't think this is "too much". It might sound unusual, at first, but there is nothing wrong with this. > Regards, > > -- > Yasuo Ohgaki > yohgaki@ohgaki.net > > --001a11c3fc78549fd40510915f40--