Page 1 of 1

Wrong language in the URL should redirect to default language

Posted: Sun May 04, 2025 12:27 am
by CedSha
Hello there,
( In OC V4.1.0.3 )
I had some malformed URL to my site which lead to an error message, recorded in the log file.
Trying to access array offset on value of type null in .../catalog/controller/common/language.php on line 53
I think instead it should redirect to the default language.
Here one sample of malformed request :
/index.php?route=product/product&language=../&manufacturer_id=11&product_id=183&page=7
I updated code like this :
after this code - Near line 35 /catalog/controller/common/language.php

Code: Select all

$code = $data['code'];
I put

Code: Select all

// If the code not in array we fallback to default language
if (!isset($data['languages'][$code]['code'])) {
    $code = $this->config->get('config_language');
}
HTH

Re: Wrong language in the URL should redirect to default language

Posted: Mon May 05, 2025 3:16 pm
by CedSha
BTW - I opened an issue on Github > #14852

Re: Wrong language in the URL should redirect to default language

Posted: Mon May 05, 2025 6:03 pm
by by mona
@CedSha Thankyou
+1