Page MenuHomePhabricator

Wrong declaration of MWCallbackStream::write error still happening in MediaWiki 1.43
Open, Needs TriagePublic

Description

On random occasions, it seems like the issue from T335073: PHP Fatal error: Declaration of MWCallbackStream::write($string) must be compatible with Psr\Http\Message\StreamInterface::write(string $string): int in /var/www/mediawiki/includes/http/MWCallbackStream.php on line 49 with guzzlehttp/psr7 2.5.0 is still happening in MediaWiki 1.43.9 (freshly downloaded), with those versions:

psr/container    1.1.2 Common Container Interface (PHP FIG PSR-11)
psr/http-client  1.0.3 Common interface for HTTP clients
psr/http-factory 1.1.0 PSR-17: Common interfaces for PSR-7 HTTP message factories
psr/http-message 1.1   Common interface for HTTP messages
psr/log          1.1.4 Common interface for logging libraries

I even tried to pin it to 1.0, but then there's this:

Problem 1
  - Root composer.json requires psr/http-message 1.0.1 (exact version match: 1.0.1 or 1.0.1.0), found psr/http-message[1.0.1] but these were not loaded, likely because it conflicts with another require.
Problem 2
  - guzzlehttp/guzzle is locked to version 7.12.3 and an update of this package was not requested.
  - guzzlehttp/guzzle 7.12.3 requires guzzlehttp/psr7 ^2.12.3 -> satisfiable by guzzlehttp/psr7[2.13.0].
  - guzzlehttp/psr7 2.13.0 requires psr/http-message ^1.1 || ^2.0 -> found psr/http-message[1.1, 2.0] but it conflicts with your root composer.json require (1.0.1).

It seems like this was missed or something: https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1239187

This is happening with a freshly downloaded bundle without anything added in composer.local.json.

Event Timeline

There's also

Fatal error: Declaration of MediaWiki\Rest\StringStream::close() must be compatible with Psr\Http\Message\StreamInterface::close(): void in /var/www/REDACTED/1.43.9/includes/Rest/StringStream.php on line 46

Freshly downloaded bundle https://releases.wikimedia.org/mediawiki/1.43/mediawiki-1.43.9.zip, without any composer.local.json definitions.

@Reedy Can you help with sorting this out, please? :)

This is happening with a freshly downloaded bundle without anything added in composer.local.json.

Is it though?

Are you installing any other extensions where you have run composer in the extensions dir itself?

For example, these are the same:

https://github.com/wikimedia/mediawiki/blob/REL1_43/includes/Rest/StringStream.php#L102
https://github.com/wikimedia/mediawiki-vendor/blob/REL1_43/psr/http-message/src/StreamInterface.php#L117

So wouldn't cause an error by default

Are you installing any other extensions where you have run composer in the extensions dir itself?

No

Maybe this could help? This is output from composer show -t run from root of MediaWiki installation:

I didn't run composer update or anything like that; MediaWiki 1.43.9 is downloaded from releases.wikimedia.org (mediawiki-1.43.9.zip, the one with bundled extensions/skins).

composer/semver 3.4.3 Semver library that offers utilities, version constraint parsing and validation.
└──php ^5.3.2 || ^7.0 || ^8.0
guzzlehttp/guzzle 7.12.3 Guzzle is a PHP HTTP client library
├──ext-json *
├──guzzlehttp/promises ^2.5
│  ├──php ^7.2.5 || ^8.0
│  └──symfony/deprecation-contracts ^2.5 || ^3.0
│     └──php >=7.1
├──guzzlehttp/psr7 ^2.12.3
│  ├──php ^7.2.5 || ^8.0
│  ├──psr/http-factory ^1.0
│  │  ├──php >=7.1
│  │  └──psr/http-message ^1.0 || ^2.0
│  │     └──php ^7.2 || ^8.0
│  ├──psr/http-message ^1.1 || ^2.0
│  │  └──php ^7.2 || ^8.0
│  ├──ralouphie/getallheaders ^3.0
│  │  └──php >=5.6
│  ├──symfony/deprecation-contracts ^2.5 || ^3.0
│  │  └──php >=7.1
│  └──symfony/polyfill-php80 ^1.25
├──php ^7.2.5 || ^8.0
├──psr/http-client ^1.0
│  ├──php ^7.0 || ^8.0
│  └──psr/http-message ^1.0 || ^2.0
│     └──php ^7.2 || ^8.0
├──symfony/deprecation-contracts ^2.5 || ^3.0
│  └──php >=7.1
└──symfony/polyfill-php80 ^1.25
justinrainbow/json-schema 5.3.1 A library to validate a json schema.
└──php >=7.1
liuggio/statsd-php-client v1.0.18 Statsd (Object Oriented) client library for PHP
└──php >=5.3.2
mck89/peast v1.17.4 Peast is PHP library that generates AST for JavaScript code
├──ext-mbstring *
└──php >=5.4.0
monolog/monolog 2.9.3 Sends your logs to files, sockets, inboxes, databases and various web services
├──php >=7.2
└──psr/log ^1.0.1 || ^2.0 || ^3.0
   └──php >=5.3.0
oojs/oojs-ui v0.51.2 Provides library of common widgets, layouts, and windows.
└──php >=7.4.3
pear/mail v2.0.0 Class that provides multiple interfaces for sending emails.
├──pear/pear-core-minimal ~1.9
│  ├──pear/console_getopt ~1.4
│  ├──pear/pear_exception ~1.0
│  │  └──php >=5.2.0
│  └──php >=5.4
└──php >=5.2.1
pear/mail_mime 1.10.12 Mail_Mime provides classes to create MIME messages
├──pear/pear-core-minimal *
│  ├──pear/console_getopt ~1.4
│  ├──pear/pear_exception ~1.0
│  │  └──php >=5.2.0
│  └──php >=5.4
└──php >=5.2.0
pear/net_smtp 1.12.1 An implementation of the SMTP protocol
├──pear/net_socket @stable
│  └──pear/pear_exception *
│     └──php >=5.2.0
├──pear/pear-core-minimal @stable
│  ├──pear/console_getopt ~1.4
│  ├──pear/pear_exception ~1.0
│  │  └──php >=5.2.0
│  └──php >=5.4
└──php >=5.4.0
psr/container 1.1.2 Common Container Interface (PHP FIG PSR-11)
└──php >=7.4.0
psr/http-message 1.1 Common interface for HTTP messages
└──php ^7.2 || ^8.0
psr/log 1.1.4 Common interface for logging libraries
└──php >=5.3.0
ralouphie/getallheaders 3.0.3 A polyfill for getallheaders.
└──php >=5.6
symfony/polyfill-php82 v1.37.0 Symfony polyfill backporting some PHP 8.2+ features to lower PHP versions
└──php >=7.2
symfony/polyfill-php83 v1.37.0 Symfony polyfill backporting some PHP 8.3+ features to lower PHP versions
└──php >=7.2
symfony/polyfill-php84 v1.37.0 Symfony polyfill backporting some PHP 8.4+ features to lower PHP versions
└──php >=7.2
symfony/polyfill-php85 v1.37.0 Symfony polyfill backporting some PHP 8.5+ features to lower PHP versions
└──php >=7.2
symfony/yaml v5.4.52 Loads and dumps YAML files
├──php >=7.2.5
├──symfony/deprecation-contracts ^2.1|^3
│  └──php >=7.1
└──symfony/polyfill-ctype ^1.8
wikimedia/assert v0.5.1 Provides runtime assertions
└──php >=7.2.9
wikimedia/at-ease v3.0.0 Safe replacement to @ for suppressing warnings.
└──php >=7.4
wikimedia/base-convert v2.0.2 Convert an arbitrarily-long string from one numeric base to another, optionally zero-padding to a minimum column width.
└──php >=7.2.9
wikimedia/bcp-47-code v2.0.0 Simple interface representing languages which have a BCP 47 code
└──php >=7.4.3
wikimedia/cdb 3.0.0 Constant Database (CDB) wrapper library for PHP. Provides pure-PHP fallback when dba_* functions are absent.
└──php >=7.4.0
wikimedia/cldr-plural-rule-parser v3.0.0 Evaluates plural rules specified in the CLDR project notation.
└──php >=8.1
wikimedia/common-passwords v0.5.0 List of the 100,000 most commonly used passwords
└──php >=7.4.3
wikimedia/composer-merge-plugin v2.1.0 Composer plugin to merge multiple composer.json files
├──composer-plugin-api ^1.1||^2.0
└──php >=7.2.0
wikimedia/css-sanitizer v6.2.1 Classes to parse and sanitize CSS
├──ext-iconv *
├──ext-mbstring *
├──php >=8.1
├──wikimedia/scoped-callback 3.0.0 || 4.0.0 || 5.0.0
│  └──php >=7.4
└──wikimedia/utfnormal ^3.0.1 || ^4.0.0
   ├──ext-mbstring *
   └──php >=7.4.3
wikimedia/cssjanus v2.3.0 Convert CSS stylesheets between left-to-right and right-to-left.
└──php >=7.4.0
wikimedia/html-formatter 4.1.0 Performs transformations of HTML by wrapping around libxml2 and working around its countless bugs.
├──ext-dom *
├──ext-libxml *
├──ext-mbstring *
└──php >=7.4.3
wikimedia/ip-utils 5.0.0 Parse, match, and analyze IP addresses and CIDR ranges
├──php >=7.4.3
└──wikimedia/base-convert ^2.0.0
   └──php >=7.2.9
wikimedia/json-codec v4.0.0 Interfaces to serialize and deserialize PHP objects to/from JSON
├──php >=8.1.0
└──psr/container ^1.1.2|^2.0.2
   └──php >=7.4.0
wikimedia/less.php v5.5.0 PHP port of the LESS processor
└──php >=8.1
wikimedia/minify 2.9.0 Minification of JavaScript code and CSS stylesheets.
├──ext-fileinfo *
├──ext-json *
├──ext-mbstring *
├──pear/net_url2 ~2.2.2
│  └──php >=5.1.4
└──php >=7.4.3
wikimedia/normalized-exception v2.0.0 A helper for making exceptions play nice with PSR-3 logging
└──php >=7.4
wikimedia/object-factory v5.0.1 Construct objects from configuration instructions
├──php >=7.4.3
└──psr/container ~1.1.1 || ~2.0.2
   └──php >=7.4.0
wikimedia/parsoid v0.20.8 Parsoid, a bidirectional parser between wikitext and HTML5
├──composer-runtime-api ^2.0
├──composer/semver ^3.4.0
│  └──php ^5.3.2 || ^7.0 || ^8.0
├──ext-dom *
├──ext-json *
├──liuggio/statsd-php-client ^1.0.18
│  └──php >=5.3.2
├──php >=8.1.0
├──psr/container ~1.1.2 || ~2.0.2
│  └──php >=7.4.0
├──psr/log ^1.1.4 || ^3.0.0
│  └──php >=5.3.0
├──wikimedia/assert ^0.5.1
│  └──php >=7.2.9
├──wikimedia/bcp-47-code ^2.0.0
│  └──php >=7.4.3
├──wikimedia/idle-dom 2.0.1 || ^2.1.0
│  └──php >=8.1
├──wikimedia/ip-utils ^5.0.0
│  ├──php >=7.4.3
│  └──wikimedia/base-convert ^2.0.0
│     └──php >=7.2.9
├──wikimedia/json-codec ^3.0.2 || ^4.0.0 || ^5.0.0
│  ├──php >=8.1.0
│  └──psr/container ^1.1.2|^2.0.2
│     └──php >=7.4.0
├──wikimedia/object-factory ^5.0.1
│  ├──php >=7.4.3
│  └──psr/container ~1.1.1 || ~2.0.2
│     └──php >=7.4.0
├──wikimedia/remex-html ^4.1.2 || ^5.1.0
│  ├──ext-dom *
│  ├──ext-mbstring *
│  ├──php >=7.4
│  └──wikimedia/utfnormal ^3.0.1 || ^4.0.0
│     ├──ext-mbstring *
│     └──php >=7.4.3
├──wikimedia/wikipeg ^4.0.0
│  ├──ext-json *
│  ├──ext-mbstring *
│  └──php >=7.4.3
└──wikimedia/zest-css ^3.0.1 || ^4.1.0
   ├──ext-mbstring *
   ├──ext-xml *
   └──php >=7.4
wikimedia/php-session-serializer v3.0.0 Provides methods like PHP's session_encode and session_decode that don't mess with $_SESSION
├──php >=7.4.0
└──psr/log ^1.0
   └──php >=5.3.0
wikimedia/purtle v2.0.0 Fast streaming RDF serializer
├──ext-json *
└──php >=7.4
wikimedia/relpath 4.0.1 Work with file paths to join or find the relative path
└──php >=7.4.3
wikimedia/remex-html 4.1.2 Fast HTML 5 parser
├──ext-dom *
├──ext-mbstring *
├──php >=7.4
└──wikimedia/utfnormal ^3.0.1 || ^4.0.0
   ├──ext-mbstring *
   └──php >=7.4.3
wikimedia/request-timeout 2.0.0 Request timeout library for Excimer with plain PHP fallback
├──php >=7.4
└──wikimedia/normalized-exception 1.0.1 || 2.0.0
   └──php >=7.4
wikimedia/running-stat v2.1.0 PHP implementations of online statistical algorithms
└──php >=7.2.0
wikimedia/scoped-callback v5.0.0 Make a callback run when a dummy object leaves the scope.
└──php >=7.4
wikimedia/services 4.0.0 Generic service to manage named services using lazy instantiation based on instantiator callback functions
├──php >=7.4.3
├──psr/container ^1.1 || ^2.0
│  └──php >=7.4.0
└──wikimedia/scoped-callback ^3.0 || ^4.0 || ^5.0
   └──php >=7.4
wikimedia/shellbox 4.1.1 Library and server for containerized shell execution
├──ext-hash *
├──ext-json *
├──guzzlehttp/guzzle ^7.9.2
│  ├──ext-json *
│  ├──guzzlehttp/promises ^2.5
│  │  ├──php ^7.2.5 || ^8.0
│  │  └──symfony/deprecation-contracts ^2.5 || ^3.0
│  │     └──php >=7.1
│  ├──guzzlehttp/psr7 ^2.12.3
│  │  ├──php ^7.2.5 || ^8.0
│  │  ├──psr/http-factory ^1.0
│  │  │  ├──php >=7.1
│  │  │  └──psr/http-message ^1.0 || ^2.0
│  │  │     └──php ^7.2 || ^8.0
│  │  ├──psr/http-message ^1.1 || ^2.0
│  │  │  └──php ^7.2 || ^8.0
│  │  ├──ralouphie/getallheaders ^3.0
│  │  │  └──php >=5.6
│  │  ├──symfony/deprecation-contracts ^2.5 || ^3.0
│  │  │  └──php >=7.1
│  │  └──symfony/polyfill-php80 ^1.25
│  ├──php ^7.2.5 || ^8.0
│  ├──psr/http-client ^1.0
│  │  ├──php ^7.0 || ^8.0
│  │  └──psr/http-message ^1.0 || ^2.0
│  │     └──php ^7.2 || ^8.0
│  ├──symfony/deprecation-contracts ^2.5 || ^3.0
│  │  └──php >=7.1
│  └──symfony/polyfill-php80 ^1.25
├──monolog/monolog ^2.0.0
│  ├──php >=7.2
│  └──psr/log ^1.0.1 || ^2.0 || ^3.0
│     └──php >=5.3.0
├──php >=7.4.3
├──psr/log ~1.1.3
│  └──php >=5.3.0
├──wikimedia/base-convert 2.0.2
│  └──php >=7.2.9
└──wikimedia/wikipeg ^4.0.0
   ├──ext-json *
   ├──ext-mbstring *
   └──php >=7.4.3
wikimedia/timestamp v4.1.1 Creation, parsing, and conversion of timestamps
└──php >=7.4.0
wikimedia/utfnormal 4.0.0 Contains Unicode normalization routines, including both pure PHP implementations and automatic use of the 'intl' PHP extension when present
├──ext-mbstring *
└──php >=7.4.3
wikimedia/wait-condition-loop v2.0.2 Wait loop that reaches a condition or times out
└──php >=7.2.9
wikimedia/wrappedstring v4.0.1 Automatically compact sequentially-outputted strings that share a common prefix / suffix pair.
└──php >=7.2.9
wikimedia/xmp-reader 0.10.2 Reader for XMP data containing properties relevant to images
├──ext-iconv *
├──ext-libxml *
├──ext-xml *
├──ext-xmlreader *
├──php >=8.1
├──psr/log ^1.0
│  └──php >=5.3.0
├──wikimedia/scoped-callback ^1.0 || ^2.0 || ^3.0 || ^4.0 || ^5.0
│  └──php >=7.4
└──wikimedia/timestamp ^1.0 || ^2.0 || ^3.0 || ^4.0 || ^5.0
   └──php >=7.4.0
zordius/lightncandy v1.2.6 An extremely fast PHP implementation of handlebars ( http://handlebarsjs.com/ ) and mustache ( http://mustache.github.io/ ).
└──php >=7.1.0

On a clean install from HEAD of the REL1_43 branch from git, I see no issues, fatals etc.

But as per all the instances of these bugs, it's when something is installing version 2 of the psr libraries, which MW (at least in 1.43) does not ship.

But as per all the instances of these bugs, it's when something is installing version 2 of the psr libraries, which MW (at least in 1.43) does not ship.

There's nothing installing version 2 of the psr libraries for me, I would like to apply your patches to try, but there are merge conflicts.