Jump to content
thirty bees forum

Help resolving PHP error for 8.x upgrade


x97wehner

Recommended Posts

Hi,

I have a module with a php 8 error that I just can't figure out how to resolve. I'm sure it's very easy, but I'm struggling. Anyone know how to resolve? @datakick?

 

This is the error:

image.png.b90bca14cd4a0b713c73767b547bb9bd.png

This is the code snippet causing issue:

    public function __get($name)
{
    if ($name === 'module') {
        return $this->module = Module::getInstanceByName('rg_smartpopup');
    }
 
    if ($name === 'popup') {
        if (!(int) $this->id_popup) {
            throw new PrestaShopException('The property `id_popup` is required.');
        }
 
        return $this->popup = new RgSpPopup((int) $this->id_popup, (int) $this->id_lang);
    }
 
    return parent::__get($name); // Ensure compatibility with ObjectModelCore
}
Link to comment
Share on other sites

One more question for you @datakick. I've updated to PHP 8.3 now and all is functioning correctly. When I review error logs though, I have many deprecation warnings around controllers::$admin_webpath making dynamic properties. Is there an easy fix to resolve those? Here is an example of just one:

image.thumb.png.9dbf380997eba7cede777b4524617494.png

image.png.753cb5033e2b9f328cebf3550c7ebabd.png

Link to comment
Share on other sites

There is some (probably module/override) code that access this property on front-office controllers. You have to figure out what code is that, and fix it -- it should probably work with back-office controllers only.

Look at stacktrace for this error to figure out what code attempts to access the property.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...