Page MenuHomePhabricator

Cannot upload media through the WikiEditor - Invalid Response from server
Closed, InvalidPublicBUG REPORT

Description

2022-04-21_09-34-52.png (394×552 px, 24 KB)

Getting the error message "Invalid Response from server" when uploading media through the WikiEditor. No issues when uploading through the "Upload file" tool.

Product Version
MediaWiki 1.36.1
PHP 7.4.19
MySQL 5.5.62
ICU 65.1
WikiEditor 0.5.3

Has anyone run into this issue? Appreciate any information you can provide.

Event Timeline

Reedy subscribed.

Do you get any errors in your browser console etc when you try and upload?

Not that it should affect this issue specifically, but you're not using the latest point release for the 1.36 branch.

@Reedy No, no errors on the browser console.

However, when I enable wgShowExceptionDetails I get the following in the Network -> Response tab In developer tools.

<div class="errorbox mw-content-ltr"><p>[YmGWkLppKx0JbdkIylIdwwAAAAU] /libokhist.w/api.php Error: Call to a member function setHeader() on null</p><p>Backtrace:</p><p>from /srv/www/domainname/html/libokhist.w/api.php(52)

I'm guessing if you visit the API yourself on your wiki it is also broken?

Also, something seems wrong with your api.php...

https://github.com/wikimedia/mediawiki/blob/REL1_36/api.php#L52

There's no setHeader call on that line, nor anywhere in the file

Error: Call to a member function setHeader() on null
from /srv/www/domainname/html/libokhist.w/api.php(52)

That seems dodgy, because

  1. the only matches for the string header in api.php are a header() call and a $wgRequest->getHeader() call (lines 57 and 102, respectively, as of the REL1_36 branch)
  2. as far as I'm aware of and as far as some quick digging through code history shows, there isn't nor ever was a setHeader call in api.php

Can you pastebin your api.php file? It sounds like there might be an undocumented core hack or some other unofficial patch that's very much related to this issue.

@ashley here you go, https://pastebin.com/5qnGkxJW

@Reedy No, I can access the api.php file and it is not broken.. I compared the REL1_36 branch version and ours and it is in fact different

Thanks all for your assistance so far!

What is $kgReq? No idea where that's defined...

It's obvious it's the local modifications that are causing problems. Generally we would advise to not change core files like this...

@Reedy removing the core hacks fixed the issue. Thanks for the pointers, all.