Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89037 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75256 invoked from network); 2 Nov 2015 11:12:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Nov 2015 11:12:37 -0000 Authentication-Results: pb1.pair.com smtp.mail=lisachenko.it@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=lisachenko.it@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.171 as permitted sender) X-PHP-List-Original-Sender: lisachenko.it@gmail.com X-Host-Fingerprint: 209.85.217.171 mail-lb0-f171.google.com Received: from [209.85.217.171] ([209.85.217.171:34101] helo=mail-lb0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 97/64-42726-22547365 for ; Mon, 02 Nov 2015 06:12:35 -0500 Received: by lbbwb3 with SMTP id wb3so85513779lbb.1 for ; Mon, 02 Nov 2015 03:12:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=KwgC34MxaKvDOluudWZSWxW2DqDC02HqOgpk5K441ds=; b=Lab/PUhLFewUKLNeZac5e3FCjxz7qR0hHkn0blyOUO4sGAmiD35H8FKQ3s2ycMwmg9 wX/DKpnNisGJuPG/xJF5Yj6Y4ttJ5cspDWEaIcSrjVC9EcwmiWRVgh9Fcwx8GRWsvkCo vWuVcWJtrrNZvB5/orDFPlNwRYUW8lw2YEdh1OOOb+iGbIqewJkdsF8yf6DBDMIEkIRr nMfrBLNaojtPVaBaoE/PKEmuEmDdc8OV0MDxZMekOQuyQp3oHlKhH2I2kUAtKPOnUPU8 bZPIfZ+5Z65repZCjZrcqP4gcMB2EN4GmNqxzlUmdxB5nZj26sDJiP58Rix7JP2roXDk YnWg== MIME-Version: 1.0 X-Received: by 10.112.72.201 with SMTP id f9mr10078529lbv.62.1446462751824; Mon, 02 Nov 2015 03:12:31 -0800 (PST) Received: by 10.25.152.133 with HTTP; Mon, 2 Nov 2015 03:12:31 -0800 (PST) In-Reply-To: <56372B62.1000206@gmail.com> References: <56372B62.1000206@gmail.com> Date: Mon, 2 Nov 2015 14:12:31 +0300 Message-ID: To: Rowan Collins Cc: PHP internals list Content-Type: multipart/alternative; boundary=001a11c2400080e49505238cda24 Subject: Re: [PHP-DEV] [Question] Variadic method signature compatibility between 5.6 and 7.0 From: lisachenko.it@gmail.com (Alexander Lisachenko) --001a11c2400080e49505238cda24 Content-Type: text/plain; charset=UTF-8 2015-11-02 12:22 GMT+03:00 Rowan Collins : > Should they? func_get_args() can be used to simulate any function > signature, so you could equally say that the following are "compatible": Hello! Thank you for the answer. However, question is not about func_get_args() at all, it can be removed to simplify an example. However, I still have a doubts that these two signatures are not compatible. First definition declares exactly one single parameter, which can be absent during the method call, so I can even write public static function test() {} Second definition defines zero or more arguments, so it can be also described by the same signature: public static function test() {} Signature with variadic args will be incompatible if the first definition requires additional arguments before optional and second signature doesn't respect this, see https://3v4l.org/5Fsou (this behaviour is correct and warnings are expected). But if the number of required parameters are matching, then whole signature should be matching. PHP5.6 with HHVM prove this fact, see: https://3v4l.org/YCmPS, and PHP7.0 probably doesn't play well. If you think, that the new logic in PHP7.0 is correct, then it should be nice to have a small notice in BC change with PHP5.6 logic, somewhere in http://php.net/manual/en/migration70.incompatible.php#migration70.incompatible.other.func-parameters . --001a11c2400080e49505238cda24--