SncRedisBundle: The Proxy for Redis::scan passes the $iterator by value [bug]

Hello,

\Redis::scan takes its first parameter by reference. However the LazyObject implementation accidentally passes all arguments by value via argument unpacking.

    public function scan(&$i_iterator, $str_pattern = null, $i_count = null)
    {
        if (isset($this->lazyObjectState)) {
            return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->scan(...\func_get_args());
        }

        return parent::scan(...\func_get_args());
    }

Scan relies on the iterator to traverse all of the memory blocks Redis has allocated. Finding no matching keys in the first block isn’t a guarantee that no matching keys will be found in subsequent blocks. Hence this bug hinders functionality.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 2
  • Comments: 17 (2 by maintainers)

Commits related to this issue

Most upvoted comments