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

$info parameter isn't passed to <transport>.after_request hook on non-blocking requests #321

Closed
johnbillion opened this issue Mar 30, 2018 · 2 comments · Fixed by #680
Closed

Comments

@johnbillion
Copy link
Member

The fsockopen.after_request and curl.after_request hooks don't receive an $info parameter when a non-blocking request is sent.

This means the hook signature differs depending on whether the request is blocking or not, and conflicts with the hook docs.

Possible solution: Pass an empty array as the $info parameter for these hooks when a non-blocking request is performed.

Since #206.

@jrfnl
Copy link
Member

jrfnl commented Nov 25, 2021

@johnbillion I've done a full review of the Hooks documentation today, with PR #646 as a result. While this doesn't change the way the hook is being dispatched, it does update the documentation to be more informative regarding this.

If you have the time, would be great if you could look the PR over and give your opinion.

@jrfnl
Copy link
Member

jrfnl commented Dec 8, 2021

This proposal is being discussed in #646. Copying the relevant parts of that conversation here for visibility:

@schlessera:

Hmm, still on the fence about this one, as I'm not yet sure whether the documentation for the optional $info args is sufficient here. It might be more robust to go with @johnbillion's suggestion and provide an $info array in all cases, with an empty one being used for non-blocking requests. I'll think about this some more...

@jrfnl:

Deciding whether or not to always pass $info is a different issue and if/when it is so decided, the documentation can be further updated to reflect that change.

Generally speaking I'm in favour of John's suggestion and would recommend for hooks to have the same number of arguments every time they are called, however, making this change now could be considered a breaking change as functions which "hook in" very likely will need updating (callbacks may have a different default value set - null - for the optional parameter from the empty array we would pass, callbacks may use isset() on the result of function_get_args() for this parameter, which would break, etc).

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

Successfully merging a pull request may close this issue.

2 participants