Page MenuHomePhabricator

WebDAV master is broken on PHP7.* CI: Use of undefined constant WEBDAV_AUTH_TOKEN
Open, Needs TriagePublic0 Story Points

Description

🤷🏽‍♂️

There was 1 error:

1) SpecialPageFatalTest::testSpecialPageDoesNotFatal with data set "Preferences" (SpecialPreferences Object (...))

=== Logs generated by test case
[wfDebug] [debug] IP: 127.0.0.1 {"private":false}
[wfDebug] [debug] IP: 127.0.0.1 {"private":false}
[wfDebug] [debug] User: loading options for user 1 from database. {"private":false}
[wfDebug] [debug] Parser: using preprocessor: Preprocessor_DOM {"private":false}
===
Use of undefined constant WEBDAV_AUTH_TOKEN - assumed 'WEBDAV_AUTH_TOKEN' (this will throw an Error in a future version of PHP)

/workspace/src/extensions/WebDAV/includes/WebDAVHooks.php:90
/workspace/src/includes/Hooks.php:174
/workspace/src/includes/Hooks.php:202
/workspace/src/includes/preferences/DefaultPreferencesFactory.php:130
/workspace/src/includes/preferences/DefaultPreferencesFactory.php:1439
/workspace/src/includes/specials/SpecialPreferences.php:113
/workspace/src/includes/specials/SpecialPreferences.php:90
/workspace/src/tests/phpunit/includes/specials/SpecialPageExecutor.php:108
/workspace/src/tests/phpunit/includes/specials/SpecialPageExecutor.php:36
/workspace/src/tests/phpunit/structure/SpecialPageFatalTest.php:34
/workspace/src/tests/phpunit/MediaWikiTestCase.php:427
/workspace/src/maintenance/doMaintenance.php:96

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 13 2019, 7:21 PM
hashar renamed this task from WebDAV master is broken on PHP7.* CI to WebDAV master is broken on PHP7.* CI: Use of undefined constant WEBDAV_AUTH_TOKEN.Apr 14 2019, 7:43 AM
hashar updated the task description. (Show Details)
hashar added subscribers: Umherirrender, hashar.

That extension used to pass CI tests. In mediawiki/core there is a recentish structure test to ensure that special pages do not fatal. On Feb 19th @Umherirrender enhanced that test to to also fail when a notice is thrown: rMW4743ab9efc9c: Do not suppress php notices in SpecialPageFatalTest. Which is good!

Note that is apparently broken under HHVM which happily pass the test, but that is a different bug/task really.

The reason for the lack of WEBDAV_AUTH_TOKEN is that the extension depends on the SabreDAV library. See docs/README.txt:

MediaWiki prequisites

You will need to install the SabreDAV library. You can do this using 'composer'.
Execute
composer install
in the extension root directory.
See [http://sabre.io/dav/install/] for details.
At the moment we use the version 1.8 of SabreDAV, because 2.x is not compatible
to PHP versions lower than 5.4. Unfortunately some of our customers still use
5.3 and can not be updated in a short term.

Which could be refreshed :)

Then:

composer.json
{
    "require": {
        "composer/installers": "~1.0",
        "sabre/dav": "~3"
    },
}

So we just need to switch CI from vendor jobs to composer based job and it should be fine.

side note: really we should just always default to use composer and only use vendor for repos deployed on the wikimedia cluster. But that is yet another task

hashar moved this task from Backlog to Repo setup on the Continuous-Integration-Config board.

And indeed the WebDAV extension is quite old. That was an effort by Jack Bates then a student, it might have been a one off experiment or maybe that is used by its university. It is not on any public wiki (based on https://wikiapiary.com/wiki/Extension:WebDAV ).

Its original author seems to be https://github.com/jablko . He might have more informations/details.

So potentially, we could just archive that extension via hmm yet another task in Cleanup :]

The repo of this extension was created in February, so I would not assume this is an old extension. I may look old due to imports, but there must be a fresh request to get this extension and cleanup seems not the best approve when it stays only 2 month here.

Change 503727 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[integration/config@master] [WebDAV] Switch to composer based quibble

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

Change 503727 merged by jenkins-bot:
[integration/config@master] [WebDAV] Switch to composer based quibble

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

hashar closed this task as Resolved.Apr 15 2019, 1:34 PM
hashar claimed this task.

Works now :)

Umherirrender reopened this task as Open.Apr 15 2019, 4:53 PM

It's the same error on https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/WebDAV/+/503287/ with composer jobs, so this seems to have another issue

Sorry I just assumed WEBDAV_AUTH_TOKEN or WEBDAV_AUTH_MW defines were being provided by the composer dependency sabre/dav. I should have checked that.

I also found the hard way that https://www.mediawiki.org/wiki/Extension:WebDAV is obsolete. The repository has been taken over and all the legacy code removed! So the code is entirely different from what the wiki page describe ..

Anyway @Osnard and @Pwirth should be able to find what is supposed to provide the missing constants WEBDAV_AUTH_TOKEN and WEBDAV_AUTH_MW :)

@hashar Sorry that I missed this! Hallo Welt team has published this extension just recently. You are right it is a complete rewrite. I did not have the time to update the extension description page. We have published the latest version from our internal git repository. Unfortunately since introduction of extension.json there is no good way to define contants anymore [1]. We will need to switch to swing literals.

In our setups we add those constants in the LocalSettings.php

define( "WEBDAV_AUTH_NONE", 0 );
define( "WEBDAV_AUTH_TOKEN", 1 ); 
define( "WEBDAV_AUTH_MW", 2 );

I am goint to update the extension description page and hopefully soon switch to string literals for configuration.

[1] https://discourse-mediawiki.wmflabs.org/t/how-to-define-constants-from-extension-code/1209

Change 504363 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/WebDAV@master] Define constants in extension.json callback

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

I have uploaded a workaround for CI, than you have to time to change this

hashar removed hashar as the assignee of this task.Apr 17 2019, 11:40 AM
Osnard claimed this task.Apr 18 2019, 3:52 PM

Change 504363 abandoned by Umherirrender:
Define constants in extension.json callback under $wgWikimediaJenkinsCI

Reason:
Keep broken

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