diff --git a/HTTP/Request2/Observer/Log.php b/HTTP/Request2/Observer/Log.php index 548f04e..3a74132 100644 --- a/HTTP/Request2/Observer/Log.php +++ b/HTTP/Request2/Observer/Log.php @@ -129,6 +129,9 @@ public function __construct($target = 'php://output', array $events = []) */ public function update(SplSubject $subject) { + if (!$subject instanceof HTTP_Request2) { + return; + } $event = $subject->getLastEvent(); if (!in_array($event['name'], $this->events)) { return; diff --git a/HTTP/Request2/Observer/UncompressingDownload.php b/HTTP/Request2/Observer/UncompressingDownload.php index 48fbb70..7b03580 100644 --- a/HTTP/Request2/Observer/UncompressingDownload.php +++ b/HTTP/Request2/Observer/UncompressingDownload.php @@ -178,15 +178,17 @@ public function __construct($stream, $maxDownloadSize = null) /** * Called when the request notifies us of an event. * - * @param HTTP_Request2 $request The HTTP_Request2 instance + * @param HTTP_Request2 $subject The HTTP_Request2 instance * * @return void * @throws HTTP_Request2_MessageException */ - public function update(SplSubject $request) + public function update(SplSubject $subject) { - /* @var $request HTTP_Request2 */ - $event = $request->getLastEvent(); + if (!$subject instanceof HTTP_Request2) { + return; + } + $event = $subject->getLastEvent(); $encoded = false; /* @var $event['data'] HTTP_Request2_Response */