Jump to content

Topic on Project:Support desk

Issue with inserting images on VisualEditor

9
209.50.140.229 (talkcontribs)

I'm trying to use the VisualEditor insert tool to upload a new image (instead of using the direct uploads page.) However, when clicking "upload", a red box pops up saying "Invalid response from the server." This is on MediaWiki 1.39.3, VisualEditor 0.1.2.


Checking the logs reveals the following error:

"PHP message: PHP Fatal error:  Declaration of Wikimedia\ParamValidator\Util\UploadedFile::getStream() must be compatible with Psr\Http\Message\UploadedFileInterface::getStream(): Psr\Http\Message\StreamInterface in /var/www/html/w/includes/libs/ParamValidator/Util/UploadedFile.php on line 86"


Uploading via Special:Upload works as expected. Not sure if this is an extension issue or a MW issue.

209.50.140.229 (talkcontribs)

I fixed this issue by reinstalling MediaWiki. I'm not sure what happened, but somehow a file must have been corrupt somewhere.

Bawolff (talkcontribs)

This is a known bug that can be caused by running composer (there is an error in mediawiki's composer.json file). It will be fixed in the next release of mediawiki, but reinstalling will also fix it.

User44868732 (talkcontribs)

@Bawolff Do you happen to know the specific error in the composer.json file? I would like to fix it on all of my 1.39.4 LTS wikis since many users have complained that uploading images on pages is not working due to the error described by OP. (I use MsUpload too allow multi-file-uploads)

Bawolff (talkcontribs)
Squeak24 (talkcontribs)

I have added that line of code into my composer.json, but I still get the same error where I can't upload images. The PHP error I get is:


Backend fatal error: PHP Fatal error:  Declaration of Wikimedia\\ParamValidator\\Util\\UploadedFile::getStream() must be compatible with Psr\\Http\\Message\\UploadedFileInterface::getStream(): Psr\\Http\\Message\\StreamInterface in /home/username/public_html/wiki/includes/libs/ParamValidator/Util/UploadedFile.php on line 86\n, referer: https://domain.com/wiki/index.php/Special:FormEdit/Form_name/Page_name

Is this open on phabricator? Just wondering if it's something that needs to be raised.

I have thought if it maybe a PHP8.1 issue? I did try and revert back to PHP 7.4 but I couldn't due to composer dependencies needing PHP 8.1

Bawolff (talkcontribs)

You have to run the command composer update after changing the file.


It shouldn't matter what version of php

Squeak24 (talkcontribs)

Thanks Bawolff, for some reason it was still broken.


After investiagtion it turned out it was the SemanticExtraSpecialProperties was also causing a problem

143.215.230.88 (talkcontribs)

This solution fixed the same problem for me. The first step of the semantic installation modified the composer.json and I wound up with an http-message version 2.0 in my composer.lock & Special:Versions but no http-message version in my composer.json.

Reply to "Issue with inserting images on VisualEditor"