SimpleBatchUpload icon indicating copy to clipboard operation
SimpleBatchUpload copied to clipboard

Add compatibility with PHP 8.1+

Open tomhughes opened this issue 2 years ago • 1 comments

Setup

  • MW version: 1.37.2
  • PHP version: 8.1.5
  • DB (MySQL etc.): 10.5.15-MariaDB

Issue

PHP 8 reports a fatal error loading the extension:

[09-May-2022 15:23:19 Europe/London] PHP Fatal error:  Uncaught Error: SimpleBatchUpload\SimpleBatchUpload::registerEarlyConfiguration(): Argument #1 ($targetConfiguration) cannot be passed by reference in /srv/wiki.example.com/extensions/SimpleBatchUpload/src/SimpleBatchUpload.php:42
Stack trace:
#0 /srv/wiki.example.com/includes/registration/ExtensionRegistry.php(574): SimpleBatchUpload\SimpleBatchUpload::initCallback()
#1 /srv/wiki.example.com/includes/registration/ExtensionRegistry.php(258): ExtensionRegistry->exportExtractedData()
#2 /srv/wiki.example.com/includes/Setup.php(168): ExtensionRegistry->loadFromQueue()
#3 /srv/wiki.example.com/includes/WebStart.php(90): require_once('...')
#4 /srv/wiki.example.com/index.php(44): require('...')
#5 {main}
  thrown in /srv/wiki.example.com/extensions/SimpleBatchUpload/src/SimpleBatchUpload.php on line 42

Stopping registerEarlyConfiguration trying to take that argument by reference seems to have fixed things for me.

tomhughes avatar May 09 '22 14:05 tomhughes

This is an incompatibility with PHP 8.1+ due to https://php.watch/versions/8.1/GLOBALS-restrictions. Needs some reworking of how configuration is set, plus registration of some other stuff like hooks. Removing the & might get rid of the error, but the extension will also no longer function correctly.

JeroenDeDauw avatar May 09 '22 19:05 JeroenDeDauw