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
 [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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 09:01:32 2024 UTC