diff options
-rw-r--r-- | phpBB/phpbb/textformatter/s9e/factory.php | 9 | ||||
-rw-r--r-- | phpBB/phpbb/textformatter/s9e/renderer.php | 2 | ||||
-rw-r--r-- | tests/text_formatter/s9e/factory_test.php | 1 | ||||
-rw-r--r-- | tests/text_formatter/s9e/renderer_test.php | 2 |
4 files changed, 4 insertions, 10 deletions
diff --git a/phpBB/phpbb/textformatter/s9e/factory.php b/phpBB/phpbb/textformatter/s9e/factory.php index a0817a9a4f..a7cf2d89b8 100644 --- a/phpBB/phpbb/textformatter/s9e/factory.php +++ b/phpBB/phpbb/textformatter/s9e/factory.php @@ -314,13 +314,8 @@ class factory implements \phpbb\textformatter\cache // Cache the parser as-is $this->cache->put($this->cache_key_parser, $parser); - // We need to cache the name of the renderer's generated class so that we can load the class - // before the renderer is unserialized. That's why we save them together, with the renderer - // in serialized form - $renderer_data = array( - 'class' => get_class($renderer), - 'renderer' => serialize($renderer) - ); + // We need to cache the name of the renderer's generated class + $renderer_data = array('class' => get_class($renderer)); if (isset($censor)) { $renderer_data['censor'] = $censor; diff --git a/phpBB/phpbb/textformatter/s9e/renderer.php b/phpBB/phpbb/textformatter/s9e/renderer.php index 7b2fef5f4b..71c207e6fc 100644 --- a/phpBB/phpbb/textformatter/s9e/renderer.php +++ b/phpBB/phpbb/textformatter/s9e/renderer.php @@ -77,7 +77,7 @@ class renderer extends \phpbb\textformatter\renderer if (class_exists($class, false)) { - $renderer = unserialize($renderer_data['renderer']); + $renderer = new $class; } if (isset($renderer_data['censor'])) diff --git a/tests/text_formatter/s9e/factory_test.php b/tests/text_formatter/s9e/factory_test.php index d78765b7d5..a1378514b4 100644 --- a/tests/text_formatter/s9e/factory_test.php +++ b/tests/text_formatter/s9e/factory_test.php @@ -94,7 +94,6 @@ class phpbb_textformatter_s9e_factory_test extends phpbb_database_test_case $renderer_data = $this->cache->get('_foo_renderer'); $this->assertEquals($parser, $this->cache->get('_foo_parser'), 'The parser was not cached'); $this->assertEquals(get_class($renderer), $renderer_data['class']); - $this->assertEquals(serialize($renderer), $renderer_data['renderer']); $this->assertInstanceOf('s9e\\TextFormatter\\Plugins\\Censor\\Helper', $renderer_data['censor']); $file = $this->get_cache_dir() . get_class($renderer) . '.php'; diff --git a/tests/text_formatter/s9e/renderer_test.php b/tests/text_formatter/s9e/renderer_test.php index 17d358c3ce..248b38206a 100644 --- a/tests/text_formatter/s9e/renderer_test.php +++ b/tests/text_formatter/s9e/renderer_test.php @@ -34,7 +34,7 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case $cache->expects($this->once()) ->method('get') ->with('_foo_renderer') - ->will($this->returnValue(array('class' => 'renderer_foo', 'renderer' => serialize($mock)))); + ->will($this->returnValue(array('class' => 'renderer_foo'))); $factory = $this->getMockBuilder('phpbb\\textformatter\\s9e\\factory') ->disableOriginalConstructor() |