php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70958 Invalid opcode while using ::class as trait method paramater default value
Submitted: 2015-11-23 04:58 UTC Modified: 2015-11-23 05:00 UTC
From: laruence@php.net Assigned: laruence (profile)
Status: Closed Package: *General Issues
PHP Version: 7.0.0RC7 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: laruence@php.net
New email:
PHP Version: OS:

 

 [2015-11-23 04:58 UTC] laruence@php.net
Description:
------------
See test script

Test script:
---------------
<?php

trait Foo
{
    function bar($a = self::class) {}
}

class B {
    use Foo;
}

$b = new B;

$b->bar();

Expected result:
----------------
string(1) "C"

Actual result:
--------------
PHP-5.6: Fatal error: Invalid opcode 64/8/2. in /tmp/1.php on line 5
PHP-7.0: NULL
[Mon Nov 23 12:39:01 2015]  Script:  '/tmp/1.php'
/home/huixinchen/opensource/php-7.0/Zend/zend_string.h(121) :  Freeing 0x7FFFF8059B80 (32 bytes), script=/tmp/1.php
=== Total 1 memory leaks detected ===

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-11-23 05:00 UTC] laruence@php.net
-Assigned To: +Assigned To: laruence
 [2015-11-23 05:00 UTC] laruence@php.net
a quick fix is here: http://pastebin.com/iWZksF59

however, the reflection and other similar functions which exporting fucntion declaration function should also be fixed later
 [2015-11-23 10:35 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a2b85ddecf666281717e50246950fd6d153bb0a8
Log: Fixed bug #70958 (Invalid opcode while using ::class as trait method paramater default value)
 [2015-11-23 10:36 UTC] laruence@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jan 02 11:01:29 2025 UTC