0

I get this error and is affecting my modules from working properly. I am not sure how to fix it. Most of the help sites said that they got the error after they upgraded but since I did not upgrade I am not sure why I got this error.

Error Message: Warning: Creating default object from empty value in ..../aac/administrator/components/com_poweradmin/helpers/history.php on line 125.

The below starts from line 116 to 154.

Line 125: "$listPage->params = (isset($listPage->params)) ? str_replace('&', '&', $listPage->params) : '';"

Codes used:

 private static function updateHistoryState($post)
{
    if (!isset($_COOKIE['jsn-poweradmin-list-page']))
        return;

    $listPage = json_decode($_COOKIE['jsn-poweradmin-list-page']);
    if ($listPage == NULL)
        $listPage = json_decode(stripslashes($_COOKIE['jsn-poweradmin-list-page']));

    $listPage->params = (isset($listPage->params)) ? str_replace('&', '&', $listPage->params) : '';
    $id = array();

    if (isset($post['id']) && is_numeric($post['id']))
        $id[] = $post['id'];
    else if (isset($post['id']) && is_array($post['id']))
        $id = array_merge($id, $post['id']);

    if (isset($post['cid']) && is_numeric($post['cid']))
        $id[] = $post['cid'];
    else if (isset($post['cid']) && is_array($post['cid']))
        $id = array_merge($id, $post['cid']);

    $isDelete = (int)preg_match('/\.?(delete|remove|trash)$/i', $post['task']);

    if (count ($id) && (is_numeric($id) || is_array($id))) {
        // Bypass if any of id list is not a number
        if (is_array($id)) {
            foreach ($id as $i) {
                if (!is_numeric($i)) {
                    return;
                }
            }
        }

        $dbo = JFactory::getDBO();
        $dbo->setQuery("UPDATE #__jsn_poweradmin_history SET is_deleted={$isDelete} WHERE list_page_params LIKE '{$listPage->params}' AND object_id IN (".implode(',', $id).")");
        @$dbo->query();
    }
}

1 Answer 1

0

This is not really an error but a warning.

It appears that JSON you are trying to decode is malformed and that json_decode does not manage to return you an object of type stdClass. Probably json_decode returns NULL.

Basically the warning is about trying to assign a property to a variable has not been initialized as a stdClass object.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.