laminas / laminas-feed

Consume and generate Atom and RSS feeds, and interact with Pubsubhubbub.

Home Page:https://docs.laminas.dev/laminas-feed/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PubSubHubbub/Publisher not sending requests to hubs

jabinb opened this issue · comments

commented

Bug Report

Q A
Version(s) 2.14.0

Summary

It seems like the publishing always fails, and the requests to the hubs are never sent.

Current behavior

Calling $publisher->notifyAll(); results in no requests being sent.

How to reproduce

I've created a repository to reproduce the bug here: https://github.com/jabinb/laminas-feed-bug
To run it:

$ composer install
$ php -S localhost:9090 server.php
# another terminal window
$ php test.php

You'll notice no requests get sent to the built-in webserver.

Outside of the repository the steps are pretty simple, try to follow the documentation and use notifyHub or notifyAll and set a breakpoint to inspect the $response object -- you'll see it's an empty response.

Expected behavior

The Publisher class sends the proper requests.

Fix

foreach ($hubs as $url) {
$client->setUri($url);
$response = $client->getResponse();
if ($response->getStatusCode() !== 204) {
$this->errors[] = [
'response' => $response,
'hubUrl' => $url,
];
}
}

Seems like on line 258 there's a missing call to $client->send() to actually trigger the request (adding it fixes the problem). Instead they just grab an empty request and return it immediately.