Skip to content

500 Errors from rest calls (primarily) #2

Description

@JamesFX2

We've implemented this on our production environment (Magento 2.4.7-p8) and we're getting occasional errors like,

[2026-01-23T16:47:56.061976+00:00] main.CRITICAL: Warning: Undefined array key "adminhtml" in /home/cloudpanel/htdocs/2026_01_22_3_06_02_branch_m2.4.7-058-Eye-Of-The-Tiger-v2/vendor/colinmollenhour/php-redis-session-abstract/src/Cm/RedisSession/Handler.php on line 975 [] []

That relates to

    /**
     * Remove array elements by key recursively (deep down first and removing empty arrays)
     *
     * @param array $arr1
     * @param array $arr2
     * @return array
     */
    protected function _arrayRemoveRecursive($arr1, $arr2)
    {
        foreach ($arr2 as $key => $item) {
            if (is_array($arr2[$key])) {
                $arr1[$key] = $this->_arrayRemoveRecursive($arr1[$key], $arr2[$key]);

                if (count($arr1[$key]) === 0) {
                    unset($arr1[$key]);
                }
            } else {
                unset($arr1[$key]);
            }
        }

        return $arr1;
    }

I'd also request that you please flag up in the README that implementing this on live without clearing all sessions will cause issues - anyone who had sessions before implementation will have issues because their previous data cannot be unserialized.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions