1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-06 08:47:45 +02:00

[ticket/17535] Address code review comments

PHPBB-17535
This commit is contained in:
rxu
2025-07-28 22:51:14 +07:00
parent 788e408ceb
commit 7056bcba91
6 changed files with 30 additions and 42 deletions

View File

@@ -31,11 +31,6 @@ abstract class base implements \phpbb\cache\driver\driver_interface
try try
{ {
$iterator = new \DirectoryIterator($this->cache_dir); $iterator = new \DirectoryIterator($this->cache_dir);
}
catch (\Exception $e)
{
return;
}
foreach ($iterator as $fileInfo) foreach ($iterator as $fileInfo)
{ {
@@ -58,6 +53,11 @@ abstract class base implements \phpbb\cache\driver\driver_interface
$this->remove_file($fileInfo->getPathname()); $this->remove_file($fileInfo->getPathname());
} }
} }
}
catch (\Exception $e)
{
// Do not return, to purge vars cached in memory
}
unset($this->vars); unset($this->vars);
unset($this->sql_rowset); unset($this->sql_rowset);

View File

@@ -50,18 +50,7 @@ abstract class memory extends \phpbb\cache\driver\base
*/ */
function purge() function purge()
{ {
unset($this->vars); parent::purge();
unset($this->sql_rowset);
unset($this->sql_row_pointer);
if (function_exists('opcache_reset'))
{
@opcache_reset();
}
$this->vars = [];
$this->sql_rowset = [];
$this->sql_row_pointer = [];
$this->is_modified = true; $this->is_modified = true;

View File

@@ -74,10 +74,10 @@ class phpbb_auth_provider_apache_test extends phpbb_database_test_case
->will($this->returnValue(true)); ->will($this->returnValue(true));
$this->request->expects($this->exactly(2)) $this->request->expects($this->exactly(2))
->method('server') ->method('server')
->willReturnCallback(fn(string $arg) => match(true) { ->willReturnMap([
$arg === 'PHP_AUTH_USER' => 'foobar', ['PHP_AUTH_USER', 'foobar'],
$arg === 'PHP_AUTH_PW' => 'example', ['PHP_AUTH_PW', 'example']
}); ]);
$expected = array( $expected = array(
'status' => LOGIN_SUCCESS, 'status' => LOGIN_SUCCESS,

View File

@@ -255,7 +255,6 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case
$form = $crawler->selectButton('Submit')->form(); $form = $crawler->selectButton('Submit')->form();
$form['minimum_stability']->select('dev'); $form['minimum_stability']->select('dev');
$form['enable_packagist']->select('1');
$form['repositories'] = 'https://satis.phpbb.com/'; $form['repositories'] = 'https://satis.phpbb.com/';
$crawler = self::submit($form); $crawler = self::submit($form);
$this->assertContainsLang('CONFIG_UPDATED', $crawler->filter('div[class="successbox"] > p')->text()); $this->assertContainsLang('CONFIG_UPDATED', $crawler->filter('div[class="successbox"] > p')->text());

View File

@@ -61,7 +61,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case
$user->style = array('style_id' => 1); $user->style = array('style_id' => 1);
$user->expects($this->any()) $user->expects($this->any())
-> method('__get')->with('lang')->willReturn([ ->method('__get')->with('lang')->willReturn([
'NO_POLL_TITLE' => 'You have to enter a poll title.', 'NO_POLL_TITLE' => 'You have to enter a poll title.',
'POLL_TITLE_TOO_LONG' => 'The poll title must contain fewer than 100 characters.', 'POLL_TITLE_TOO_LONG' => 'The poll title must contain fewer than 100 characters.',
'POLL_TITLE_COMP_TOO_LONG' => 'The parsed size of your poll title is too large, consider removing BBCodes or smilies.', 'POLL_TITLE_COMP_TOO_LONG' => 'The parsed size of your poll title is too large, consider removing BBCodes or smilies.',