prestaalba / fop_publishedvulnerabilityscan

Scans your shop searching for any vulnerability published on the FOP security advisories list.
Academic Free License v3.0
17 stars 6 forks source link

[bug] - Cron task - Trying to get property 'id' of non-objec #7

Closed bicipres closed 8 months ago

bicipres commented 8 months ago

Hi @prestaalba,

On Prestashop 1.7.8.11 and PHP 7.4, if I execute the cron task, I have this error display:

Notice: Trying to get property 'id' of non-object in /home/website/www/classes/Tools.php on line 1363

Notice: Trying to get property 'id' of non-object in /home/website/www/classes/Tools.php on line 1363

Notice: Trying to get property 'id' of non-object in /home/website/www/classes/Tools.php on line 1363

Notice: Trying to get property 'id' of non-object in /home/website/www/classes/Tools.php on line 1363

Notice: Trying to get property 'id' of non-object in /home/website/www/classes/Tools.php on line 1363

Notice: Trying to get property 'id' of non-object in /home/website/www/classes/Tools.php on line 1363
1

I tried to empty the cache but nothing change.

Here is the content of '/www/classes/Tools.php' on line 1363:

 public static function getAdminTokenLite($tab, Context $context = null)
    {
        if (!$context) {
            $context = Context::getContext();
        }

        return Tools::getAdminToken($tab . (int) Tab::getIdFromClassName($tab) . (int) $context->employee->id);
    }

Do you have an idea ? I will look about employe permission ..

prestaalba commented 8 months ago

I really don't. This can happen when you tried to get a backoffice link outside of a backoffice context. But cron is a front controller and no backoffice link is generated. Could you please provide the full stack trace??

bicipres commented 8 months ago

Hi @prestaalba, I will close the ticket as I thing is not coming from the module itself but of our installation.

Thanks for your feedback.

Regards,