php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67938 Segfault when extending interface method with variadic
Submitted: 2014-08-30 17:24 UTC Modified: 2014-08-30 17:41 UTC
From: lisachenko dot it at gmail dot com Assigned: nikic (profile)
Status: Closed Package: Reproducible crash
PHP Version: 5.6.0 OS: Windows 7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: lisachenko dot it at gmail dot com
New email:
PHP Version: OS:

 

 [2014-08-30 17:24 UTC] lisachenko dot it at gmail dot com
Description:
------------
For traditional OOP code it's possible to add an "extra" optional arguments to the method defined somewhere in interface without violating it:

interface TestInterface {
    public function foo();
}
class Test implements TestInterface {
    public function foo($extraArgs=null) {}
}

$obj = new Test;
$obj->foo();

For PHP5.6 variadics can be used nicely for that, but this results in the segfault. See: http://3v4l.org/9bcEJ

Test script:
---------------
interface TestInterface {
    public function foo();
}

class Test implements TestInterface {
    public function foo(...$extraArgs) {

    }
}

$obj = new Test;
$obj->foo();

Expected result:
----------------
Normal termination of script

Actual result:
--------------
Exit code 139, Segmentation fault

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-08-30 17:41 UTC] nikic@php.net
-Status: Open +Status: Verified -Assigned To: +Assigned To: nikic
 [2014-08-30 18:46 UTC] nikic@php.net
Automatic comment on behalf of nikic
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d7368c2531ad1268d43c894b8422a61b70c70e5a
Log: Fix bug #67938: Segfault when extending interface method with variadic
 [2014-08-30 18:46 UTC] nikic@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri May 29 20:01:24 2020 UTC