WyriHaximus / ReactGuzzle

ReactPHP HttpClient Adapter for Guzzle
MIT License
34 stars 5 forks source link

Call to undefined method React\Promise\Promise::getStatusCode() #12

Open opb opened 10 years ago

opb commented 10 years ago

Hi there I'm receiving the following error:

PHP Fatal error:  Call to undefined method React\Promise\Promise::getStatusCode() in /vagrant/vendor/guzzlehttp/guzzle/src/Subscriber/Redirect.php on line 89
PHP Stack trace:
PHP   1. {main}() /vagrant/sanctions:0
PHP   2. Symfony\Component\Console\Application->run() /vagrant/sanctions:13
PHP   3. Symfony\Component\Console\Application->doRun() /vagrant/vendor/symfony/console/Symfony/Component/Console/Application.php:124
PHP   4. Symfony\Component\Console\Application->doRunCommand() /vagrant/vendor/symfony/console/Symfony/Component/Console/Application.php:193
PHP   5. Symfony\Component\Console\Command\Command->run() /vagrant/vendor/symfony/console/Symfony/Component/Console/Application.php:889
PHP   6. SS\Commands\IndexCommand->execute() /vagrant/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:252
PHP   7. SS\Indexer\SanctionListsIndexer->indexAll() /vagrant/SS/Commands/IndexCommand.php:30
PHP   8. SS\Indexer\SanctionListsIndexer->indexSites() /vagrant/SS/Indexer/SanctionListsIndexer.php:58
PHP   9. SS\Indexer\SanctionListsIndexer->indexSite() /vagrant/SS/Indexer/SanctionListsIndexer.php:162
PHP  10. SS\Scrapers\TOBScraper->run() /vagrant/SS/Indexer/SanctionListsIndexer.php:173
PHP  11. React\EventLoop\StreamSelectLoop->run() /vagrant/SS/Scrapers/TOBScraper.php:69
PHP  12. React\EventLoop\Tick\FutureTickQueue->tick() /vagrant/vendor/react/event-loop/StreamSelectLoop.php:175
PHP  13. call_user_func:{/vagrant/vendor/react/event-loop/Tick/FutureTickQueue.php:46}() /vagrant/vendor/react/event-loop/Tick/FutureTickQueue.php:46
PHP  14. WyriHaximus\React\Guzzle\HttpClient\Request->WyriHaximus\React\Guzzle\HttpClient\{closure}() /vagrant/vendor/react/event-loop/Tick/FutureTickQueue.php:46
PHP  15. GuzzleHttp\Event\RequestEvents::emitComplete() /vagrant/vendor/wyrihaximus/react-guzzle/src/HttpClient/Request.php:290
PHP  16. GuzzleHttp\Event\Emitter->emit() /vagrant/vendor/guzzlehttp/guzzle/src/Event/RequestEvents.php:75
PHP  17. GuzzleHttp\Subscriber\Redirect->onComplete() /vagrant/vendor/guzzlehttp/guzzle/src/Event/Emitter.php:105

I'm not 100% sure where the issue is, but it's an undefined method in React\Promise\Promise called by Guzzle, so I thought with ReactGuzzle being the connection between the two, it might be best placed here. Please let me know if you need any further details.

Many thanks!

WyriHaximus commented 10 years ago

Hey @opb,

This issue is related to #3, Guzzle calls the adapter again after the redirect. If #3 can and is resolved this shouldn't be an issue anymore. (I'll give it a try on the train home later today, just moved into a new house without internet connection so it might take a few days.)

opb commented 10 years ago

Cool, thanks :)

SergeC commented 10 years ago

Confirm, same here: screen shot 2014-09-27 at 10 48 00

WyriHaximus commented 10 years ago

@SergeC yeah I know the exact cause of this. Currently playing with generators to see if there is a work around. Might end up using Recoil since I'm hitting a dead end with generators at the moment, but also not sure. Will post an update when I know more.