|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-11-05 10:02 UTC] karibou at ribouka dot com
[2013-11-05 13:46 UTC] laruence@php.net
-Status: Open
+Status: Not a bug
[2013-11-05 13:46 UTC] laruence@php.net
[2013-11-09 10:21 UTC] ab@php.net
[2013-11-09 10:21 UTC] ab@php.net
-Status: Not a bug
+Status: Closed
[2014-10-07 23:16 UTC] stas@php.net
[2014-10-07 23:27 UTC] stas@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 00:00:02 2025 UTC |
Description: ------------ I'm on 5.4.14 I won't upgrade to test this, if someone have 5.4.21, can he tests and reports. If you call a constant of a class in a trait (of that class), it works. BUT, if you want to test its existence by 'defined' it's always return false. Test script: --------------- class MyClass{ use MyTrait; const MY_CONST = 'TEST'; } Trait MyTrait{ public function testConst() { echo self::MY_CONST; var_dump(defined(self::MY_CONST)); } } $myClass = new MyClass(); $myClass->testConst(); Expected result: ---------------- Test boolean true Actual result: -------------- Test boolean false