|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2016-08-15 15:15 UTC] info at nepda dot eu
  [2016-08-15 15:25 UTC] laruence@php.net
  [2016-08-15 15:25 UTC] laruence@php.net
 
-Status: Open
+Status: Closed
  [2016-10-17 10:09 UTC] bwoebi@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 07:00:01 2025 UTC | 
Description: ------------ If you have any namespace (e.g. "Some") and a (abstract or concrete) class (e.g. "A") with some constants in it and a class (e.g. "B") extending "A", the reflection class is not able to get the constant values of an array constant with constant values in it. See example code. Output with PHP 7.0.9: see "Actual result:" with PHP 5.6.24 it's working: see "Expected result:" Without the namespace, it's working on both versions. Test script: --------------- <?php namespace Some { abstract class A { const ONE = '1'; const TWO = '2'; const CONST_NUMBERS = [ self::ONE, self::TWO, ]; const NUMBERS = [ '1', '2', ]; } class B extends A { } $ref = new \ReflectionClass('Some\B'); var_dump($ref->getConstant('ONE')); var_dump($ref->getConstant('CONST_NUMBERS')); var_dump($ref->getConstant('NUMBERS')); } Expected result: ---------------- string(1) "1" array(2) { [0]=> string(1) "1" [1]=> string(1) "2" } array(2) { [0]=> int(10) [1]=> int(11) } Actual result: -------------- string(1) "1" UNKNOWN:0 array(2) { [0]=> string(1) "1" [1]=> string(1) "2" }