php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69164 Wrong error message when a trait extends another trait
Submitted: 2015-03-02 20:07 UTC Modified: 2018-01-15 11:42 UTC
From: sebastian@php.net Assigned: nikic (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: Irrelevant OS: Irrelevant
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: sebastian@php.net
New email:
PHP Version: OS:

 

 [2015-03-02 20:07 UTC] sebastian@php.net
Description:
------------
The error message for "trait extends trait" is wrong.

Test script:
---------------
<?php
trait t1
{
}

trait t2 extends t1
{
}


Expected result:
----------------
PHP Fatal error:  A trait (t2) cannot extend a trait. Traits can only be composed from other traits with the 'use' keyword. Error in /home/sb/test.php on line 7

Actual result:
--------------
PHP Fatal error:  A trait (t2) cannot extend a class. Traits can only be composed from other traits with the 'use' keyword. Error in /home/sb/test.php on line 7

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-03-03 15:01 UTC] laruence@php.net
This should only be in version 5.x..
 [2015-03-03 15:09 UTC] sebastian@php.net
Yes, seems like the error message was changed for PHP 7: http://3v4l.org/k33mV

Would be nice, though, to have this in all supported branches.
 [2018-01-15 11:42 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2018-01-15 11:42 UTC] nikic@php.net
5.x is no longer supported, so closing this. In 7.x this is a parse error.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 01:01:28 2024 UTC