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

Pull Requests

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-2026 The PHP Group
All rights reserved.
Last updated: Tue Oct 06 05:00:01 2026 UTC