Skip to content

Can't seem to operate on the $response to \React\Http\Browser() 's post() #518

Answered by SimonFrings
mig5 asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @mig5, it seems like you forgot to inherit your $endpoint variable inside your closure, should be something like this:

...

)->then(function (Psr\Http\Message\ResponseInterface $response) use ($endpoint) {
    syslog(LOG_INFO, 'Connection Notification sent to ' . $endpoint[url']);
}, function (Exception $e) use ($endpoint) {
    syslog(LOG_DEBUG, 'error on Callback request to ' . $endpoint['url']);
});

....

Without the use () PHP won't know what $endpoint is, thus PHP will throw and error at this point. This all is happening inside a promise and promises are swallowing exceptions and errors in the current version. We're currently working on changing this behavior to detect all unhand…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@mig5
Comment options

Answer selected by mig5
Comment options

You must be logged in to vote
1 reply
@SimonFrings
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants