[BUGFIX] Static access to Enumeration constants 44/33244/2
authorSascha Egerer <sascha.egerer@dkd.de>
Mon, 25 Aug 2014 14:46:23 +0000 (16:46 +0200)
committerMarkus Klein <klein.t3@reelworx.at>
Fri, 10 Oct 2014 10:01:40 +0000 (12:01 +0200)
To get all available constants for a TYPO3\CMS\Core\Type\Enumeration
an instance of the Enumeration is required. This is changed by
defining the `getConstants` method as static and using
`get_called_class()` instead of `get_class($this)`.

Resolves: #61090
Releases: master,6.2
Change-Id: I45e8241c6f41a23a1748e620c000b6dd59d6f389
Reviewed-on: http://review.typo3.org/33244
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/core/Classes/Type/Enumeration.php

index f77f23e..67370ac 100644 (file)
@@ -159,8 +159,8 @@ abstract class Enumeration implements TypeInterface {
         * @param boolean $include_default
         * @return array
         */
-       public function getConstants($include_default = FALSE) {
-               $enumConstants = static::$enumConstants[get_class($this)];
+       static public function getConstants($include_default = FALSE) {
+               $enumConstants = static::$enumConstants[get_called_class()];
                if (!$include_default) {
                        unset($enumConstants['__default']);
                }