Page MenuHomePhabricator

REST API loads route files relative to the current directory
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Install MediaWiki outside the document root
  • Have a /w/rest.php wrapper file in the document root with require '/path/to/rest.php';
  • Navigate to /w/rest.php

What happens?:

The response is:

{"message":"Error: exception of type MediaWiki\\Rest\\PathTemplateMatcher\\ModuleConfigurationException","reqId":"085ee9048dd6c7c3b7413ea2","httpCode":500,"httpReason":"Internal Server Error"}

In the error logs:

PHP Warning:  file_get_contents(includes/Rest/coreRoutes.json): Failed to open stream: No such file or directory in /workspace/mediawiki/core/includes/Rest/Module/Module.php on line 522

What should have happened instead?:

It should have worked. The correct base path for MediaWiki source files is MW_INSTALL_PATH, not the working directory.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

  • 1.46.0-alpha (d2091a9)

Details

Event Timeline

Change #1276118 had a related patch set uploaded (by Tim Starling; author: Tim Starling):

[mediawiki/core@master] Rest: Load route files from MW_INSTALL_PATH

https://gerrit.wikimedia.org/r/1276118

Change #1276118 merged by jenkins-bot:

[mediawiki/core@master] Rest: Load route files from MW_INSTALL_PATH

https://gerrit.wikimedia.org/r/1276118

Patch merged. Marking this as Resolved.