Bug 2097578

Summary: MediaWiki package ships broken version combination of guzzlehttp/guzzle and guzzlehttp/psr7
Product: [Fedora] Fedora Reporter: Felix Friedlander <felix>
Component: mediawikiAssignee: Michael Cronenworth <mike>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 36CC: Axel.Thimm, extras-qa, john.droe, mike, orion, puiterwijk
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: mediawiki-1.37.2-1.fc36 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1935879 Environment:
Last Closed: 2022-06-26 01:19:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Felix Friedlander 2022-06-16 03:18:06 UTC
Description of problem:

This is the same underlying issue as Bug #1935879. When a MediaWiki extension invokes the guzzle method GuzzleHttpRequest->execute(), it ultimately tries to call the deprecated psr7 function GuzzleHttp\Psr7\stream_for(), which while present in psr7 1.7.0, is for some reason not callable.

Below is a stack trace of this behaviour, instigated by a third-party extension DiscordRCFeed:

[exception] [bc1f88685d29b1a3c9e771e1] /api.php   Error: Call to undefined function GuzzleHttp\Psr7\stream_for()
#0 /usr/share/mediawiki/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(59): GuzzleHttp\Handler\CurlFactory->applyHandlerOptions()
#1 /usr/share/mediawiki/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php(43): GuzzleHttp\Handler\CurlFactory->create()
#2 /usr/share/mediawiki/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php(28): GuzzleHttp\Handler\CurlHandler->__invoke()
#3 /usr/share/mediawiki/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php(48): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}()
#4 /usr/share/mediawiki/vendor/guzzlehttp/guzzle/src/Middleware.php(240): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}()
#5 /usr/share/mediawiki/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php(64): GuzzleHttp\Middleware::GuzzleHttp\{closure}()
#6 /usr/share/mediawiki/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php(55): GuzzleHttp\PrepareBodyMiddleware->__invoke()
#7 /usr/share/mediawiki/vendor/guzzlehttp/guzzle/src/Middleware.php(61): GuzzleHttp\RedirectMiddleware->__invoke()
#8 /usr/share/mediawiki/vendor/guzzlehttp/guzzle/src/HandlerStack.php(75): GuzzleHttp\Middleware::GuzzleHttp\{closure}()
#9 /usr/share/mediawiki/vendor/guzzlehttp/guzzle/src/Client.php(331): GuzzleHttp\HandlerStack->__invoke()
#10 /usr/share/mediawiki/vendor/guzzlehttp/guzzle/src/Client.php(107): GuzzleHttp\Client->transfer()
#11 /usr/share/mediawiki/vendor/guzzlehttp/guzzle/src/Client.php(123): GuzzleHttp\Client->sendAsync()
#12 /usr/share/mediawiki/includes/http/GuzzleHttpRequest.php(204): GuzzleHttp\Client->send()
#13 /usr/share/mediawiki/extensions/DiscordRCFeed/includes/DiscordRCFeedEngine.php(44): GuzzleHttpRequest->execute()
#14 /usr/share/mediawiki/includes/rcfeed/FormattedRCFeed.php(66): MediaWiki\Extension\DiscordRCFeed\DiscordRCFeedEngine->send()
#15 /usr/share/mediawiki/extensions/DiscordRCFeed/includes/DiscordRCFeedEngine.php(104): FormattedRCFeed->notify()
#16 /usr/share/mediawiki/includes/changes/RecentChange.php(581): MediaWiki\Extension\DiscordRCFeed\DiscordRCFeedEngine->notify()
#17 /usr/share/mediawiki/includes/changes/RecentChange.php(498): RecentChange->notifyRCFeeds()
#18 /usr/share/mediawiki/includes/changes/RecentChange.php(780): RecentChange->save()
#19 /usr/share/mediawiki/includes/deferred/MWCallableUpdate.php(38): RecentChange::{closure}()
#20 /usr/share/mediawiki/includes/deferred/DeferredUpdates.php(515): MWCallableUpdate->doUpdate()
#21 /usr/share/mediawiki/includes/deferred/DeferredUpdates.php(391): DeferredUpdates::attemptUpdate()
#22 /usr/share/mediawiki/includes/deferred/DeferredUpdates.php(221): DeferredUpdates::run()
#23 /usr/share/mediawiki/includes/deferred/DeferredUpdatesScope.php(267): DeferredUpdates::{closure}()
#24 /usr/share/mediawiki/includes/deferred/DeferredUpdatesScope.php(196): DeferredUpdatesScope->processStageQueue()
#25 /usr/share/mediawiki/includes/deferred/DeferredUpdates.php(242): DeferredUpdatesScope->processUpdates()
#26 /usr/share/mediawiki/includes/MediaWiki.php(1141): DeferredUpdates::doUpdates()
#27 /usr/share/mediawiki/includes/MediaWiki.php(851): MediaWiki->restInPeace()
#28 /usr/share/mediawiki/api.php(125): MediaWiki->doPostOutputShutdown()
#29 /usr/share/mediawiki/api.php(45): wfApiMain()
#30 {main}

Version-Release number of selected component (if applicable):

mediawiki-1.37.1-2.fc36.noarch

While this error is technically triggered by a third-party extension, this API function is commonly used by MediaWiki extensions - seen here with DiscordRCFeed, the same occurred in Bug #1935879 with the SpamBlacklist extension.

I believe (from memory) that upgrading to psr7 1.8.5 (which is the version Composer would install if `composer update` was run) resolves this. Alternatively, the following one-line patch to guzzle will fix this:

--- a/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php
+++ b/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php
@@ -397,7 +397,7 @@ class CurlFactory implements CurlFactoryInterface
         }
         $sink = $options['sink'];
         if (!\is_string($sink)) {
-            $sink = \GuzzleHttp\Psr7\stream_for($sink);
+            $sink = \GuzzleHttp\Psr7\Utils::streamFor($sink);
         } elseif (!\is_dir(\dirname($sink))) {
             // Ensure that the directory exists before failing in curl.
             throw new \RuntimeException(\sprintf('Directory %s does not exist for sink value of %s', \dirname($sink), $sink));

Comment 1 Michael Cronenworth 2022-06-17 01:03:23 UTC
Looks like the 1.37.2 update ships a newer dependency. This is in the new compose.json.

"guzzlehttp/psr7": "1.8.5"

I'll ship the update.

Comment 2 Fedora Update System 2022-06-17 04:36:06 UTC
FEDORA-2022-69bc42d6cf has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-69bc42d6cf

Comment 3 Fedora Update System 2022-06-18 01:40:25 UTC
FEDORA-2022-69bc42d6cf has been pushed to the Fedora 36 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-69bc42d6cf`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-69bc42d6cf

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 4 Fedora Update System 2022-06-26 01:19:00 UTC
FEDORA-2022-69bc42d6cf has been pushed to the Fedora 36 stable repository.
If problem still persists, please make note of it in this bug report.