mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/16840] Fix s9e test helper
PHPBB3-16840
This commit is contained in:
parent
0b966144f1
commit
ffa4dc0ff3
1 changed files with 12 additions and 1 deletions
|
@ -450,7 +450,18 @@ class phpbb_test_case_helpers
|
|||
|
||||
// Cache the parser and renderer with a key based on this method's arguments
|
||||
$cache = new \phpbb\cache\driver\file($cache_dir);
|
||||
$prefix = '_s9e_' . md5(serialize(func_get_args()));
|
||||
|
||||
// Don't serialize unserializable resource/object arguments
|
||||
// See https://www.php.net/manual/en/function.serialize.php#refsect1-function.serialize-notes
|
||||
$args = func_get_args();
|
||||
foreach ($args as $key => $arg)
|
||||
{
|
||||
if (is_resource($arg) || (is_object($arg) && (!is_a($arg, 'Serializable') && !method_exists($arg, '__serialize'))))
|
||||
{
|
||||
unset($args[$key]);
|
||||
}
|
||||
}
|
||||
$prefix = '_s9e_' . md5(serialize($args));
|
||||
$cache_key_parser = $prefix . '_parser';
|
||||
$cache_key_renderer = $prefix . '_renderer';
|
||||
$container->set('cache.driver', $cache);
|
||||
|
|
Loading…
Add table
Reference in a new issue