Post by mandom » Wed Aug 13, 2025 8:18 am

Hello,

I have just installed a fresh copy of **OpenCart 4.1.0.3** on PHP 8.1 with no traffic and no extensions/modules installed.

However, my `error.log` is already filling with warnings and errors, even though this is a clean installation. Examples:

```
PHP Warning: Undefined array key "comment" in /catalog/model/account/returns.php on line 44
Error: Opencart\System\Library\DB::escape(): Argument #1 ($value) must be of type string, null given, called in /catalog/model/account/returns.php on line 44

PHP Warning: unlink(/storage4/cache/cache.language....): No such file or directory in /system/library/cache/file.php on line 37
```

It looks like:

* The `addReturn()` method in `catalog/model/account/returns.php` is not checking if `comment` exists before calling `$this->db->escape()`.
* The cache file deletion process in `system/library/cache/file.php` calls `unlink()` without checking if the file exists first.

Why is this happening on a fresh install, and is there a fix or official patch for this in OpenCart 4.x so it’s fully compatible with PHP 8.1?

Thank you.

New member

Posts

Joined
Tue Jun 30, 2015 4:44 pm

Post by khnaz35 » Wed Aug 13, 2025 1:41 pm

Downgrade to OC 3.0.4.1 and then test it with PHP 8.1+

Got a burning question at 3 AM that even Google shrugs at? There’s a not-so-secret inbox that might just have your answer: khnaz35@gmail.com
Breathe in some nature while you're at it. It’s cheaper than therapy. :-*

Feel free to sling a bear my way via PayPal @ khnaz35@gmail.com


User avatar
Active Member
Online

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia

Post by mandom » Wed Aug 13, 2025 10:13 pm

khnaz35 wrote:
Wed Aug 13, 2025 1:41 pm
Downgrade to OC 3.0.4.1 and then test it with PHP 8.1+

You could you explain why? why downgrade.. why is opencart 4 getting warnings.

New member

Posts

Joined
Tue Jun 30, 2015 4:44 pm

Post by khnaz35 » Wed Aug 13, 2025 10:22 pm

One simple answer not stable yet and have allot of bugs any other senior developers will also advice the same.

Got a burning question at 3 AM that even Google shrugs at? There’s a not-so-secret inbox that might just have your answer: khnaz35@gmail.com
Breathe in some nature while you're at it. It’s cheaper than therapy. :-*

Feel free to sling a bear my way via PayPal @ khnaz35@gmail.com


User avatar
Active Member
Online

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia

Post by mandom » Wed Aug 13, 2025 10:26 pm

khnaz35 wrote:
Wed Aug 13, 2025 10:22 pm
One simple answer not stable yet and have allot of bugs any other senior developers will also advice the same.
So many versions and updates and we are already on 4.1.0.3.. hahaha ok ok got it!!! im stil using opencart 3..

Thanks.

New member

Posts

Joined
Tue Jun 30, 2015 4:44 pm

Post by khnaz35 » Thu Aug 14, 2025 2:08 am

Yeah, stick to 3.0.4.1 for now it does support php8+ and is stable

Got a burning question at 3 AM that even Google shrugs at? There’s a not-so-secret inbox that might just have your answer: khnaz35@gmail.com
Breathe in some nature while you're at it. It’s cheaper than therapy. :-*

Feel free to sling a bear my way via PayPal @ khnaz35@gmail.com


User avatar
Active Member
Online

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia
Who is online

Users browsing this forum: ninexus9 and 15 guests