1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-01-17 14:18:24 +01:00

[ticket/10824] Add missing imports and adjust json sanitizer imports

This way the imports will also be a bit more explicit to the fact
that this is only a json sanitizer.

PHPBB3-10824
This commit is contained in:
Marc Alexander 2021-01-18 21:06:58 +01:00
parent cf8f79356d
commit c93da86f83
No known key found for this signature in database
GPG Key ID: 50E0D2423696F995
5 changed files with 12 additions and 10 deletions

View File

@ -13,7 +13,7 @@
namespace phpbb\cache;
use phpbb\json\sanitizer;
use phpbb\json\sanitizer as json_sanitizer;
/**
* Class for grabbing/handling cached entries
@ -357,7 +357,7 @@ class service
{
// Re-parse cfg file
$json = file_get_contents($filename);
$parsed_array = sanitizer::decode($json);
$parsed_array = json_sanitizer::decode($json);
$parsed_array['filetime'] = @filemtime($filename);
$this->driver->put('_cfg_' . $style['style_path'], $parsed_array);

View File

@ -13,7 +13,7 @@
namespace phpbb\db\migration\data\v310;
use phpbb\json\sanitizer;
use phpbb\json\sanitizer as json_sanitizer;
class style_update_p1 extends \phpbb\db\migration\migration
{
@ -85,7 +85,7 @@ class style_update_p1 extends \phpbb\db\migration\migration
else if (file_exists($fileinfo->getPathname() . '/composer.json'))
{
$json = file_get_contents($fileinfo->getPathname() . '/composer.json');
$style_data = sanitizer::decode($json);
$style_data = json_sanitizer::decode($json);
if (isset($style_data['extra']['phpbb-version']) && version_compare($style_data['extra']['phpbb-version'], '4.0.0-dev', '>='))
{
// 4.x style

View File

@ -13,7 +13,8 @@
namespace phpbb\language;
use phpbb\json\sanitizer;
use DomainException;
use phpbb\json\sanitizer as json_sanitizer;
use Symfony\Component\Finder\Finder;
/**
@ -55,7 +56,7 @@ class language_file_helper
foreach ($finder as $file)
{
$json = $file->getContents();
$data = sanitizer::decode($json);
$data = json_sanitizer::decode($json);
$available_languages[] = $this->get_language_data_from_json($data);
}
@ -72,7 +73,7 @@ class language_file_helper
public function get_language_data_from_composer_file(string $path): array
{
$json_data = file_get_contents($path);
return $this->get_language_data_from_json(sanitizer::decode($json_data));
return $this->get_language_data_from_json(json_sanitizer::decode($json_data));
}
/**

View File

@ -14,6 +14,7 @@
namespace phpbb;
use phpbb\exception\version_check_exception;
use phpbb\json\sanitizer as json_sanitizer;
/**
* Class to handle version checking and comparison
@ -390,7 +391,7 @@ class version_helper
}
// Sanitize any data we retrieve from a server
$info = json\sanitizer::decode($info);
$info = json_sanitizer::decode($info);
if (empty($info['stable']) && empty($info['unstable']))
{

View File

@ -11,7 +11,7 @@
*
*/
use phpbb\json\sanitizer;
use phpbb\json\sanitizer as json_sanitizer;
class phpbb_json_sanitizer_test extends phpbb_test_case
{
@ -30,6 +30,6 @@ class phpbb_json_sanitizer_test extends phpbb_test_case
*/
public function test_decode_data($input, $output)
{
$this->assertEquals($output, sanitizer::decode($input));
$this->assertEquals($output, json_sanitizer::decode($input));
}
}