Page MenuHomePhabricator

PHP Warning: Illegal string offset 'value' and 'providedby' in extension.json with invalid values
Closed, InvalidPublicBUG REPORT

Description

I am using MediaWiki 1.35-rc3. Opening MediaWiki for the first time after a longer period of not using it, MediaWiki always gives me two PHP Warnings:

PHP Warning:  Illegal string offset 'value' in includes/registration/ExtensionProcessor.php on line 686 and 
PHP Warning:  Illegal string offset 'providedby' in includes/registration/ExtensionProcessor.php on line 701

The error originates from function extractConfig2(), which assumes that the array keys $data['value'] and $data['providedby'] = $info['name']; would be set. However, they obviously are not; at least not in my case.

Maybe all it needs is a check, whether $data['value'] and $data['providedby'] are actually set, before they are used.

The complete error log is below.

PHP Warning:  Illegal string offset 'value' in includes/registration/ExtensionProcessor.php on line 686
PHP Stack trace:
PHP   1. {main}() index.php:0
PHP   2. require() index.php:44
PHP   3. require_once() includes/WebStart.php:89
PHP   4. ExtensionRegistry->loadFromQueue() includes/Setup.php:161
PHP   5. ExtensionRegistry->readFromQueue() includes/registration/ExtensionRegistry.php:229
PHP   6. ExtensionProcessor->extractInfo() includes/registration/ExtensionRegistry.php:394
PHP   7. ExtensionProcessor->extractConfig2() includes/registration/ExtensionProcessor.php:227
PHP Warning:  Illegal string offset 'providedby' in includes/registration/ExtensionProcessor.php on line 701
PHP Stack trace:
PHP   1. {main}() index.php:0
PHP   2. require() index.php:44
PHP   3. require_once() includes/WebStart.php:89
PHP   4. ExtensionRegistry->loadFromQueue() includes/Setup.php:161
PHP   5. ExtensionRegistry->readFromQueue() includes/registration/ExtensionRegistry.php:229
PHP   6. ExtensionProcessor->extractInfo() includes/registration/ExtensionRegistry.php:394
PHP   7. ExtensionProcessor->extractConfig2() includes/registration/ExtensionProcessor.php:227
PHP Warning:  session_name(): Cannot change session name when headers already sent in includes/Setup.php on line 713
(...)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 23 2020, 6:56 PM
Reedy added a subscriber: Reedy.Sep 23 2020, 8:48 PM

https://github.com/wikimedia/mediawiki/blob/REL1_35/includes/registration/ExtensionProcessor.php#L686
https://github.com/wikimedia/mediawiki/blob/REL1_35/includes/registration/ExtensionProcessor.php#L701

TBH, it sounds like you've got an extension that is saying it's manifest_version 2, but it isn't. So whichever extension isn't following the spec (and therefore doesn't validate against it). See maintenance/validateRegistrationFile.php

See also https://github.com/wikimedia/mediawiki/blob/REL1_35/docs/extension.schema.v2.json#L1039-L1041

						"value": {
							"required": true
						},

Thanks for the hint!

In fact there was an extension, which used non-unique @comment keys. This did not validate.

Ammarpad renamed this task from Make sure string offset exists before using it in extractConfig2() - PHP Warning: Illegal string offset 'value' and 'providedby' to PHP Warning: Illegal string offset 'value' and 'providedby' in extension.json with invalid values.Sep 28 2020, 1:08 PM
Joergi123 closed this task as Resolved.Oct 1 2020, 5:46 PM
Aklapper changed the task status from Resolved to Invalid.Oct 1 2020, 5:55 PM