[BUGFIX] DebuggerUtility changes global blacklist 51/50451/3
authorChristian Kuhn <lolli@schwarzbu.ch>
Mon, 31 Oct 2016 10:28:02 +0000 (11:28 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 31 Oct 2016 10:40:56 +0000 (11:40 +0100)
This is a partial backport of master issue #78499 fixing an issue
in extbase DebuggerUtility to properly reset two static class
variables after use.

Change-Id: I50dba402f1232f86ead88ffbd506043b4673e5d1
Resolves: #78511
Related: #78499
Related: #72407
Releases: 7.6
Reviewed-on: https://review.typo3.org/50451
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/extbase/Classes/Utility/DebuggerUtility.php
typo3/sysext/extbase/Tests/Unit/Utility/DebuggerUtilityTest.php

index 94880cd..84fbc81 100644 (file)
@@ -418,9 +418,11 @@ class DebuggerUtility
         if ($ansiColors === true) {
             $title = '\e[1m' . $title . '\e[0m';
         }
+        $backupBlacklistedClassNames = self::$blacklistedClassNames;
         if (is_array($blacklistedClassNames)) {
             self::$blacklistedClassNames = $blacklistedClassNames;
         }
+        $backupBlacklistedPropertyNames = self::$blacklistedPropertyNames;
         if (is_array($blacklistedPropertyNames)) {
             self::$blacklistedPropertyNames = $blacklistedPropertyNames;
         }
@@ -466,6 +468,8 @@ class DebuggerUtility
                        </div>
                        ';
         }
+        self::$blacklistedClassNames = $backupBlacklistedClassNames;
+        self::$blacklistedPropertyNames = $backupBlacklistedPropertyNames;
         if ($return === true) {
             return $css . $output;
         } else {
index 0ab2724..a204544 100644 (file)
@@ -22,16 +22,6 @@ use TYPO3\CMS\Extbase\Utility\DebuggerUtility;
 class DebuggerUtilityTest extends UnitTestCase
 {
     /**
-     * @var \TYPO3\CMS\Extbase\Utility\DebuggerUtility
-     */
-    protected $debugger;
-
-    protected function setUp()
-    {
-        $this->debugger = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Utility\DebuggerUtility::class, ['dummy']);
-    }
-
-    /**
      * @test
      */
     public function debuggerRewindsInstancesOfIterator()
@@ -43,7 +33,7 @@ class DebuggerUtilityTest extends UnitTestCase
             $obj->property = $i;
             $objectStorage->attach($obj);
         }
-        $this->debugger->var_dump($objectStorage, null, 8, true, false, true);
+        DebuggerUtility::var_dump($objectStorage, null, 8, true, false, true);
         $this->assertTrue($objectStorage->valid());
     }
 
@@ -62,7 +52,7 @@ class DebuggerUtilityTest extends UnitTestCase
         $arguments = $this->getMock(\TYPO3\CMS\Fluid\Core\ViewHelper\Arguments::class, ['dummy'], ['arguments' => $parameters]);
 
         $arguments->expects($this->never())->method('rewind');
-        $this->debugger->var_dump($arguments, null, 8, true, false, true);
+        DebuggerUtility::var_dump($arguments, null, 8, true, false, true);
     }
 
     /**
@@ -72,7 +62,7 @@ class DebuggerUtilityTest extends UnitTestCase
     {
         $testObject = new \stdClass();
         $testObject->foo = 'bar';
-        $result = $this->debugger->var_dump($testObject, null, 8, true, false, true);
+        $result = DebuggerUtility::var_dump($testObject, null, 8, true, false, true);
         $this->assertRegExp('/foo.*bar/', $result);
     }