Skip to content

[5.4] Fix PhpRedis’ ZADD - #17832

Merged
taylorotwell merged 3 commits into
laravel:5.4from
tillkruss:zadd-fix
Feb 9, 2017
Merged

taylorotwell merged 3 commits into
laravel:5.4from
tillkruss:zadd-fix

Conversation

@tillkruss

@tillkruss tillkruss commented Feb 8, 2017 •

Copy link
Copy Markdown
Contributor

Fixes #17828.

This PR add compatibility for all 3 Predis signature styles to PhpRedis connections.

Redis::zadd('key', 10, 'member');
Redis::zadd('key', 10, 'member1', 20, 'member2');
Redis::zadd('key', ['member1' => 10, 'member2' => 20]);

The method signature changed, but the functionality is the same.

@tillkruss tillkruss changed the title Fix PhpRedis’ ZADD [5.4] Fix PhpRedis’ ZADD Feb 8, 2017
if (count($dictionary) === 1) {
$dictionary = call_user_func_array('array_merge', call_user_func_array('array_map',
[null, array_values($dictionary[0]), array_keys($dictionary[0])]
));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯wathanized 💥

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH I have no idea what is happening there. lol

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to use a simpler approach that is easier to read on first glance?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, a simple for loop and a temporary variable. I'll push another commit in a few.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: 5de9a67

@taylorotwell
taylorotwell merged commit 57eacff into laravel:5.4 Feb 9, 2017
@tillkruss
tillkruss deleted the zadd-fix branch April 16, 2017 18:06
salmanarshad321 pushed a commit to salmanarshad321/framework that referenced this pull request Sep 23, 2026
* Fix PhpRedis’ zadd adapter

* Formatting

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants