Page MenuHomePhabricator

Make FileBackend code that scrapes PHP warning robust
Closed, ResolvedPublic

Description

FileBackendIntegrationTest::testGetFileList fails when null is returned instead of [], which happens if the locale in not English. Printing the suppressed PHP warnings, in my case, yields:

"failed to open dir: Aucun fichier ou dossier de ce type"

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Does this happen even if $wgShellLocale is set to the default of C.UTF8? We call setlocale() in Setup.php, and I think it should always be C.UTF8 or en_US.UTF8, there's not much justification for changing it.

It's possible to use socket_strerror(SOCKET_ENOENT). A bit of a hack maybe, but it should work, as long as the extension is available.

Change 643605 had a related patch set uploaded (by Tim Starling; owner: Tim Starling):
[mediawiki/core@master] Fix English/*nix specific error messages in FSFileBackend

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

Change 645361 had a related patch set uploaded (by Reedy; owner: Tim Starling):
[mediawiki/core@REL1_35] Fix English/*nix specific error messages in FSFileBackend

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

Change 645362 had a related patch set uploaded (by Reedy; owner: Tim Starling):
[mediawiki/core@REL1_31] Fix English/*nix specific error messages in FSFileBackend

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

Change 643605 merged by jenkins-bot:
[mediawiki/core@master] Fix English/*nix specific error messages in FSFileBackend

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

Change 645361 merged by jenkins-bot:
[mediawiki/core@REL1_35] Fix English/*nix specific error messages in FSFileBackend

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

aaron claimed this task.

Does this happen even if $wgShellLocale is set to the default of C.UTF8? We call setlocale() in Setup.php, and I think it should always be C.UTF8 or en_US.UTF8, there's not much justification for changing it.

C.UTF8 works fine. As of master, "fr_FR.UTF-8" works fine too.

Change 645362 abandoned by Reedy:
[mediawiki/core@REL1_31] Fix English/*nix specific error messages in FSFileBackend

Reason:

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