Bug #70783 [NEW]: Adding a trait to a class produces fatal error

From: Date: Sun, 25 Oct 2015 13:11:32 +0000
Subject: Bug #70783 [NEW]: Adding a trait to a class produces fatal error
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-196794@lists.php.net to get a copy of this message
From:             joel at kociolek dot org
Operating system: Linux / Ubuntu 14.04
PHP version:      5.6.14
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:Adding a trait to a class produces fatal error

Description:
------------
I had perfectly working code. I added a trait to one of the classes and
it started to produce fatal errors. I tried to cut down the complexity
of the code and made the simplest example that I could do. See below.


Test script:
---------------
<?php
class B extends A {}
trait wtf {}
class A {
  use wtf;
}
echo "OK\n";


Expected result:
----------------
Should display OK


Actual result:
--------------
Displays:

Fatal error: Class 'A' not found in /home/joel/php-5.6.14/test.php on
line 2



Please note that removing the "use" line from the sample code above
makes it work (It display "OK").


-- 
Edit bug report at https://bugs.php.net/bug.php?id=70783&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=70783&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=70783&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=70783&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=70783&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=70783&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=70783&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=70783&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=70783&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=70783&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=70783&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=70783&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=70783&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=70783&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70783&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=70783&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=70783&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=70783&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70783&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=70783&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=70783&r=mysqlcfg



Thread (2 messages)

« previous php.bugs (#196794) next »