-
Notifications
You must be signed in to change notification settings - Fork 2.5k
HttpClient: adapter always reachable through getter if specified on contructor #4925
Conversation
@@ -205,6 +205,10 @@ public function setAdapter($adapter) | |||
*/ | |||
public function getAdapter() | |||
{ | |||
if ($this->adapter == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!$this->adapter) {
Looks good to me |
HttpClient: adapter always reachable through getter if specified on contructor
It seems that $this->getAdapter() on line 819 in /Zend/Http/Client.php is not called when send() is called statically from /zendoauth/library/ZendOAuth/Client.php line 201: return parent::send($request); Therefore it can create a fatal error as mentioned by @Stiffel |
@fkoevoets That's not a static call; that's an extension call, and, as such, it maintains the scope of |
@weierophinney Thanks for the reply. I've opened an issue for this #5074. |
@weierophinney I am sorry then. But in my case it does not run the getAdapter() from Http/Client.php . So does it run the getAdapter() from ZendOAuth/Client.php?? I see @Stiffel opened the issue for it. |
@fkoevoets I see what you were saying now. The issue is that ZendOAuth/Client.php has extended Zend/Http/Client.php and thus the call to $this->getAdapter() in the send() function of Zend/Http/Client.php is actually running the function getAdapter() in the ZendOAuth/Client.php function which returns null because $this->adapter is not set. If I update the the call to getAdapter() in Zend/Http/Client.php to refer to its own getAdapter() function with self::getAdapter(); it works correctly. (Keeping in mind @weierophinney comment above that self::getAdapter() is not a static call and is really just saying $this) I'll add this to the ticket I made as a suggested fix. |
Don't you mean in Also |
…fix/client-adapter HttpClient: adapter always reachable through getter if specified on contructor
No description provided.