Skip to content

Commit

Permalink
Explicitly check that $subject is an instance of HTTP_Request2
Browse files Browse the repository at this point in the history
No idea why this wasn't done from the very beginning
  • Loading branch information
sad-spirit committed Oct 31, 2023
1 parent 09e2232 commit 4d683b1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions HTTP/Request2/Observer/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 6 additions & 4 deletions HTTP/Request2/Observer/UncompressingDownload.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 4d683b1

Please sign in to comment.