|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-01-28 20:04 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2015-01-28 20:04 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 16 05:00:01 2025 UTC |
Description: ------------ Normally, if file c.php contains class definition, the class is loaded before any global code in file c.php is executed. However, it is not true if class uses trait. If I remove "use C;" from the example below, the code passes. Test script: --------------- ==== ./a.php ==== <?php require_once 'c.php'; ==== ./c.php ==== <?php require_once 'b.php'; trait C {} class A { use C; } ==== ./b.php ==== <?php require_once 'c.php'; class B extends A{} php -f a.php Expected result: ---------------- no error Actual result: -------------- PHP Fatal error: Class 'A' not found in /www/htdocs/www.zini.lv/develjonas/tmp/b.php on line 3