Possible Bug with $language variable - but cannot tell whenn it's happen..
Posted: Wed Jul 20, 2022 9:28 am
hi All
i user at the moment version 1.0.8.5
I had it now twice, that my homepage did show a white page instead of the homepage.
in the error log i found:
[Wed Jul 20 10:05:28.053317 2022] [php7:warn] [pid 158103] [client 172.19.0.7:49064] PHP Warning: require(/var/www/html/includes/languages/de/index.php): failed to open stream: No such file or directory in /var/www/html/index.php on line 15
so what happend is / was, that in the language.php
the $language=de and that's why it didn't found the tempalte, instead of $language = "german"
inkognito tab worked my homepage normal, so something changed my $language=german to $language=de
whenn i put in the browser on the url "?language=de" everything was back to normal and i didn't could reproduce the problem.
does anybody has a idea, how this can happen and how to fix that? one idea is to change the "map_to_translation" function to only accept "german", "english", "french" but that does not fix the prolbem, it's only symtom...
it happends on my browser 3 times in the last 5 days....and 1 on a friends browser while he helped me debugging. One thing we have multiple phoenixcart instances (test / productive) where i switch with my browser, but that shouldn't change the variable...
i user at the moment version 1.0.8.5
I had it now twice, that my homepage did show a white page instead of the homepage.
in the error log i found:
[Wed Jul 20 10:05:28.053317 2022] [php7:warn] [pid 158103] [client 172.19.0.7:49064] PHP Warning: require(/var/www/html/includes/languages/de/index.php): failed to open stream: No such file or directory in /var/www/html/index.php on line 15
so what happend is / was, that in the language.php
Code: Select all
public static function map_to_translation($page, $language = null) {
if (is_null($language)) {
$language = $_SESSION['language'];
}
$page = ('.php' === $page)
? "includes/languages/$language.php"
: "includes/languages/$language/$page";
$Template =& Guarantor::ensure_global('Template');
$translation = $Template->map($page, 'translation')
?? DIR_FS_CATALOG . $page;
return file_exists($translation) ? $translation : DIR_FS_CATALOG . $page;
}inkognito tab worked my homepage normal, so something changed my $language=german to $language=de
whenn i put in the browser on the url "?language=de" everything was back to normal and i didn't could reproduce the problem.
does anybody has a idea, how this can happen and how to fix that? one idea is to change the "map_to_translation" function to only accept "german", "english", "french" but that does not fix the prolbem, it's only symtom...
it happends on my browser 3 times in the last 5 days....and 1 on a friends browser while he helped me debugging. One thing we have multiple phoenixcart instances (test / productive) where i switch with my browser, but that shouldn't change the variable...