Bug #68931 [Opn->Nab]: Class with Trait is not contained in get_declared_classes()

From: Date: Wed, 28 Jan 2015 16:01:20 +0000
Subject: Bug #68931 [Opn->Nab]: Class with Trait is not contained in get_declared_classes()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190274@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68931&edit=1 ID: 68931 Updated by: nikic@php.net Reported by: bastian dot schneider at commerce-plus dot com Summary: Class with Trait is not contained in get_declared_classes() -Status: Open +Status: Not a bug Type: Bug Package: Class/Object related Operating System: Windows 7 x64 PHP Version: 5.6.5 Block user comment: N Private report: N New Comment: You check get_declared_classes() before the class is defined ... Classes using traits are not early-bound. Previous Comments: ------------------------------------------------------------------------ [2015-01-28 10:57:09] bastian dot schneider at commerce-plus dot com Description: ------------ Problem - "TestClass" is not contained in get_declared_classes() Circumstances - the class uses a Trait - get_declared_classes() is called before the declaration of the class Test script: --------------- trait CAS {} // with use CAS = 135 classes // without use CAS = 136 classes var_dump(sizeof(get_declared_classes())); class TestClass { use CAS; } Expected result: ---------------- I would always expect 136 classes Actual result: -------------- 135 classes, TestClass is not contained ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68931&edit=1

« previous php.bugs (#190274) next »