Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.x RemoteExecutor#143 Call to a member function fail() on null #84

Closed
Dhu-kmw opened this issue Oct 24, 2023 · 0 comments
Closed

1.x RemoteExecutor#143 Call to a member function fail() on null #84

Dhu-kmw opened this issue Oct 24, 2023 · 0 comments

Comments

@Dhu-kmw
Copy link

Dhu-kmw commented Oct 24, 2023

Hi,
Thanks for your handy library.
With the newest 1.x version we found a (possible) bug:

Call to a member function fail() on null
in /var/www/html/vendor/amphp/redis/src/RemoteExecutor.php at line 143

https://github.com/amphp/redis/blob/1.x/src/RemoteExecutor.php#L135C17-L145C18
introduced with
ed5555e

/*#135*/ } finally {
/*#136*/     $temp = $queue;
/*#137*/     $queue = [];
/*#138*/     $connect = null;
/*#139*/     $socket->close();
/*#140*/ 
/*#141*/     while ($temp) {
/*#142*/         $deferred = \array_shift($queue);
/*#143*/         $deferred->fail($error);
/*#144*/     }
/*#145*/ }

If I understand correctly:
$queue is emptied in #137, but the old reference is stored in $temp.
In the while-loop the array_shift call on (now empty) $queue will always return null.
I don't know the bigger picture with the $temp dereferencing, but only with the local context, I guess in #142 it should use $temp instead of $queue.

trowski added a commit that referenced this issue Oct 26, 2023
@Dhu-kmw Dhu-kmw closed this as completed Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant