mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 09:41:40 +09:00
Fix potential type error in editor component XML handling logic
This commit is contained in:
parent
db4e874660
commit
df6fdd3bc3
2 changed files with 9 additions and 7 deletions
|
|
@ -13,15 +13,15 @@ class EditorComponentParser extends BaseParser
|
|||
* @param string $filename
|
||||
* @param string $component_name
|
||||
* @param string $lang
|
||||
* @return object|false
|
||||
* @return ?object
|
||||
*/
|
||||
public static function loadXML(string $filename, string $component_name, string $lang = '')
|
||||
public static function loadXML(string $filename, string $component_name, string $lang = ''): ?object
|
||||
{
|
||||
// Load the XML file.
|
||||
$xml = simplexml_load_string(file_get_contents($filename));
|
||||
if ($xml === false)
|
||||
{
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
// Get the current language.
|
||||
|
|
|
|||
|
|
@ -638,12 +638,14 @@ class EditorModel extends Editor
|
|||
|
||||
$component_name = $component->component_name;
|
||||
|
||||
unset($xml_info);
|
||||
$xml_info = self::getComponentXmlInfo($component_name);
|
||||
if (!$xml_info)
|
||||
{
|
||||
return (object)['enabled' => false];
|
||||
}
|
||||
|
||||
$xml_info->enabled = $component->enabled;
|
||||
|
||||
$xml_info->target_group = array();
|
||||
|
||||
$xml_info->mid_list = array();
|
||||
|
||||
if($component->extra_vars)
|
||||
|
|
@ -690,7 +692,7 @@ class EditorModel extends Editor
|
|||
// Get from cache
|
||||
$cache_key = sprintf('editor:component:%s:%s:%d', $component, $lang_type, $xml_mtime);
|
||||
$info = Rhymix\Framework\Cache::get($cache_key);
|
||||
if ($info !== null && FALSE)
|
||||
if (!empty($info))
|
||||
{
|
||||
return $info;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue