From 47edbfe8fc6a012305f21d340c5f43c34f833b5e Mon Sep 17 00:00:00 2001 From: Hamish Friedlander Date: Fri, 22 Mar 2013 14:26:48 +1300 Subject: [PATCH] FIX ConfigStaticManifest persisting access level after parsing a static --- core/manifest/ConfigStaticManifest.php | 9 +++++---- tests/core/manifest/ConfigStaticManifestTest.php | 4 +++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/core/manifest/ConfigStaticManifest.php b/core/manifest/ConfigStaticManifest.php index 2387e4c63..faa27c708 100644 --- a/core/manifest/ConfigStaticManifest.php +++ b/core/manifest/ConfigStaticManifest.php @@ -80,7 +80,7 @@ class SS_ConfigStaticManifest { if ($static['access'] != T_PRIVATE) { Deprecation::notice('3.2.0', "Config static $class::\$$name must be marked as private", Deprecation::SCOPE_GLOBAL); // Don't warn more than once per static - $static['access'] = T_PRIVATE; + $this->statics[$class][$name]['access'] = T_PRIVATE; } return $static['value']; @@ -231,11 +231,12 @@ class SS_ConfigStaticManifest_Parser { else if($type == T_PUBLIC || $type == T_PRIVATE || $type == T_PROTECTED) { $access = $type; } - else if($type == T_STATIC) { - if($class && $depth == $clsdepth) $this->parseStatic($access, $namespace ? $namespace.'\\'.$class : $class); + else if($type == T_STATIC && $class && $depth == $clsdepth) { + $this->parseStatic($access, $namespace ? $namespace.'\\'.$class : $class); + $access = 0; } else { - $access = ''; + $access = 0; } } } diff --git a/tests/core/manifest/ConfigStaticManifestTest.php b/tests/core/manifest/ConfigStaticManifestTest.php index 5655599f6..a062b09c1 100644 --- a/tests/core/manifest/ConfigStaticManifestTest.php +++ b/tests/core/manifest/ConfigStaticManifestTest.php @@ -12,6 +12,7 @@ class ConfigStaticManifestTest extends SapphireTest { static public $public2; static protected $protected2; static private $private2; + static $nolevel_after_private; // Assigning values static $snone; @@ -96,7 +97,8 @@ DOC; 'protected' => T_PROTECTED, 'protected2' => T_PROTECTED, 'private' => T_PRIVATE, - 'private2' => T_PRIVATE + 'private2' => T_PRIVATE, + 'nolevel_after_private' => null ); foreach($levels as $var => $level) {