I recently upgraded the OC version from 3.0.3.6 to 3.0.3.9. All went normal without any issues, and I also updated the Journal theme without any issues.
But, when I switch my PHP version from 8.0 to 8.1/8.2, then I get 3 errors every time of launching the front end store. Apart from that don't see any other major issues.
Things to notice:
-Storage folders under the system are placed outside the public_html path.
-Storage folders has the permission 755 as well.
-Issue not only related to Journal theme, but also on the main site.
-No errors on the Admin panel
-If the PHP version switched back to 8.0, the errors are gone, no issues.
PHP version: 8.2
OC version: 3.0.3.9
Journal Theme: 3.1.13
Error Logs:
2024-01-27 13:32:16 - PHP Unknown: Return type of Twig\Markup::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/ux2501/domains/website.com/public_html/system/storageux2501/vendor/twig/twig/src/Markup.php on line 35
2024-01-27 13:32:16 - PHP Unknown: Return type of Twig\Markup::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/ux2501/domains/website.com/public_html/system/storageux2501/vendor/twig/twig/src/Markup.php on line 40
2024-01-27 13:32:16 - PHP Unknown: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/ux2501/domains/website.com/public_html/catalog/controller/journal3/seo.php on line 74
Any help or suggestions will be much appreciated.
My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
Need a solution for the following errors at least.
2024-01-27 13:32:16 - PHP Unknown: Return type of Twig\Markup::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/ux2501/domains/website.com/public_html/system/storageux2501/vendor/twig/twig/src/Markup.php on line 35
2024-01-27 13:32:16 - PHP Unknown: Return type of Twig\Markup::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/ux2501/domains/website.com/public_html/system/storageux2501/vendor/twig/twig/src/Markup.php on line 40
My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
This info is applicable to all users who are trying to switch the PHP version from 8.0 to 8.1 and 8.2.
PHP has deprecated these functions: count(); jsonSerialize() and trim()
So, in short if any of your files has these functions, you may have to edit the php files using your control panel.
I have posted some of the examples below for reference, this may need to be modified based on the file you have them as reference.
Error for count()
2024-01-27 13:32:16 - PHP Unknown: Return type of Twig\Markup::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/ux2501/domains/website.com/public_html/system/storageux2501/vendor/twig/twig/src/Markup.php on line 35
Go to the file Markup.php as mentioned in the above path and change the following function on line 35:
Code: Select all
public function count()
{
return mb_strlen($this->content, $this->charset);
}
Code: Select all
public function [b]count(): int[/b]
{
return mb_strlen($this->content, $this->charset);
}
2024-01-27 13:32:16 - PHP Unknown: Return type of Twig\Markup::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/ux2501/domains/website.com/public_html/system/storageux2501/vendor/twig/twig/src/Markup.php on line 40
Go to the file Markup.php as mentioned in the above path and change the following function on line 40:
Code: Select all
public function jsonSerialize()
{
return $this->content;
}
Code: Select all
public function [b]jsonSerialize(): mixed[/b]
{
return $this->content;
}
Error for trim()
2024-01-27 9:27:28 - PHP Unknown: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/ux2501/domains/website.com/public_html/catalog/controller/journal3/seo.php on line 74
Go to the respective seo.php file as mentioned in the above path and change the following function on line 74:
Code: Select all
$tags['twitter:site'] = array(
'type' => 'name',
'content' => '@' . trim($this->journal3->settings->get('seoTwitterCardsTwitterUser'), '@'),
);
Code: Select all
$tags['twitter:site'] = array(
'type' => 'name',
'content' => '@' . trim($this->journal3->settings->get('seoTwitterCardsTwitterUser')[b] ?? [/b]'@'),
);
Remember, these are PHP deprecated functions, it has nothing to do with the paid products like Journal, or other extensions. You may have to go through the errors in your website logs and modify them accordingly as mentioned above. For more reference, go to Stack Overflow.
I don't get any of these errors on OC 3.0.3.9 using PHP 8.3. Hence it looks like the Journal3 framework uses some obscure twig functions causing your errors, which wouldn't surprise me given that the Journal3 framework isn't based on a proper MVC design. It has too much controller logic embedded in it's twig templates and javascripts where it doesn't belong!
Try it on a standard OC 3.0.3.9 to see whether it still results in the same errors or not.
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
3.0.3.9 has the suppressor in.
https://github.com/opencart/opencart/bl ... hp#L38-L39
Users browsing this forum: No registered users and 4 guests