Page MenuHomePhabricator

Error "Class 'MWTimestamp' not found" when upgrading to MW 1.29.0-rc.0
Closed, ResolvedPublic

Description

Setup

  • MediaWiki 1.29.0-rc.0 (c749bf6) 14:52, 25 May 2017
  • PHP 5.6.30-0+deb8u1 (apache2handler)
  • MariaDB 10.0.31-MariaDB-1~jessie

Upgrading from 1.28.1

Steps done:

  1. Pull latest code and checkout code for MediaWiki and installed extensions
  2. Run composer update
  3. Run update.php

Step 3 fails because of

PHP Fatal error:  Class 'Wikimedia\\Timestamp\\ConvertibleTimestamp' not found in /.../w/includes/MWTimestamp.php on line 32

Steps to continue:

  1. Removed "composer.local.json"
  2. Run composer update
  3. run update.php

Wiki is on MW 1.29.0-rc.0 and works.

Steps to continue:

  1. Added "composer.local.json"
  2. Run composer update

Wiki does still continue to run, now with the extra extensions, however when trying to run update.php (for fun) I get

PHP Fatal error:  Class 'MWTimestamp' not found in /.../w/includes/GlobalFunctions.php on line 1996
Fatal error: Class 'MWTimestamp' not found in /.../w/includes/GlobalFunctions.php on line 1996

The log says

PHP Warning:  require(/.../w/vendor/composer/../../includes/compat/Timestamp.php): failed to open stream: No such file or directory in /.../vendor/composer/autoload_real.php on line 66
PHP Fatal error:  require(): Failed opening required '/.../w/vendor/composer/../../includes/compat/Timestamp.php' (include_path='.:/usr/share/php:/usr/share/pear') in /.../w/vendor/composer/autoload_real.php on line 66

So something seems to munch the timestamps stuff.

Event Timeline

Kghbln created this task.May 31 2017, 10:28 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 31 2017, 10:28 PM
Kghbln removed Parent5446 as the assignee of this task.May 31 2017, 10:29 PM
Kghbln updated the task description. (Show Details)
Kghbln updated the task description. (Show Details)
Kghbln added a subscriber: Parent5446.

Can you post the contents of your composer.local.json?

Also to clarify you're installing from git right?

{
        "require": {
                "jeroen/mediawiki-github": "@dev",
                "mediawiki/chameleon-skin": "@dev",
                "mediawiki/graph-viz": "@dev",
                "mediawiki/lingo": "@dev",
                "mediawiki/maps": "@dev",
                "mediawiki/page-forms": "@dev",
                "mediawiki/parser-hooks": "@dev",
                "mediawiki/scribunto": "@dev",
                "mediawiki/summary-cards": "@dev",
                "mediawiki/validator": "@dev",
                "mediawiki/whats-nearby": "@dev",
                "mediawiki/semantic-breadcrumb-links": "@dev",
                "mediawiki/semantic-cite": "@dev",
                "mediawiki/semantic-compound-queries": "@dev",
                "mediawiki/semantic-external-query-lookup": "@dev",
                "mediawiki/semantic-extra-special-properties": "@dev",
                "mediawiki/semantic-forms-select": "@dev",
                "mediawiki/semantic-glossary": "@dev",
                "mediawiki/semantic-interlanguage-links": "@dev",
                "mediawiki/semantic-media-wiki": "@dev",
                "mediawiki/semantic-meta-tags": "@dev",
                "mediawiki/semantic-notifications": "@dev",
                "mediawiki/semantic-result-formats": "@dev",
                "mediawiki/semantic-scribunto": "@dev",
                "mediawiki/semantic-sifter": "@dev",
                "mediawiki/semantic-watchlist": "@dev",
                "phpoffice/phpexcel": "~1"
        },
        "extra": {
                "merge-plugin": {
                        "include": [
                                "extensions/SyntaxHighlight_GeSHi/composer.json"
                        ]
                }
        },
        "config": {
                "preferred-install": "source",
                "optimize-autoloader": true
        }
}
{
        "require": {
                "jeroen/mediawiki-github": "@dev",
                "mediawiki/chameleon-skin": "@dev",
                "mediawiki/graph-viz": "@dev",
                "mediawiki/lingo": "@dev",
                "mediawiki/maps": "@dev",
                "mediawiki/page-forms": "@dev",
                "mediawiki/parser-hooks": "@dev",
                "mediawiki/scribunto": "@dev",
                "mediawiki/summary-cards": "@dev",
                "mediawiki/validator": "@dev",
                "mediawiki/whats-nearby": "@dev",
                "mediawiki/semantic-breadcrumb-links": "@dev",
                "mediawiki/semantic-cite": "@dev",
                "mediawiki/semantic-compound-queries": "@dev",
                "mediawiki/semantic-external-query-lookup": "@dev",
                "mediawiki/semantic-extra-special-properties": "@dev",
                "mediawiki/semantic-forms-select": "@dev",
                "mediawiki/semantic-glossary": "@dev",
                "mediawiki/semantic-interlanguage-links": "@dev",
                "mediawiki/semantic-media-wiki": "@dev",
                "mediawiki/semantic-meta-tags": "@dev",
                "mediawiki/semantic-notifications": "@dev",
                "mediawiki/semantic-result-formats": "@dev",
                "mediawiki/semantic-scribunto": "@dev",
                "mediawiki/semantic-sifter": "@dev",
                "mediawiki/semantic-watchlist": "@dev",
                "phpoffice/phpexcel": "~1"
        },
        "extra": {
                "merge-plugin": {
                        "include": [
                                "extensions/SyntaxHighlight_GeSHi/composer.json"
                        ]
                }
        },
        "config": {
                "preferred-install": "source",
                "optimize-autoloader": true
        }
}

Strange, shows different here https://github.com/wikimedia/mediawiki/blob/REL1_29/composer.json

Well, duh? That's his composer.local.json, not composer.json.

Yeah, installing from git. I know that I pull master versions in on the test wiki. Still ...

Kghbln updated the task description. (Show Details)May 31 2017, 10:45 PM

[For future reference, please summarize the "issue" in the task summary. Thanks. :) ]

Aklapper renamed this task from Issue when upgrading to MW 1.29.0-rc.0 to Error "Class 'MWTimestamp' not found" when upgrading to MW 1.29.0-rc.0:.Jun 1 2017, 9:17 AM
Aklapper added a project: MediaWiki-General.
Seb35 added a subscriber: Seb35.Jun 2 2017, 4:35 PM

I tried with the steps and was not able to reproduce the issue. MediaWiki from REL1_28 (664b1b4) to version 1.29.0-rc.0 (c749bf6) with the specific composer.local.json.

However, after testing, I accidentally came back to REL1_28 (664b1b4) and got these error messages:

Warning: require(/mediawiki/vendor/composer/../../includes/compat/Timestamp.php): failed to open stream: No such file or directory in /mediawiki/vendor/composer/autoload_real.php on line 66
Fatal error: require(): Failed opening required '/mediawiki/vendor/composer/../../includes/compat/Timestamp.php' (include_path='.:/usr/share/php') in /mediawiki/vendor/composer/autoload_real.php on line 66

The Packagist library wikimedia/timestamp (version 1.0.0) is introduced starting from MW 1.29, so executing MediaWiki 1.29 without executing Composer update result in this library missing, with the following message on the Web:

Fatal error: Class 'Wikimedia\Timestamp\ConvertibleTimestamp' not found in /mediawiki/includes/MWTimestamp.php on line 32

So are you sure the update procedure is executed correctly? (e.g. you reused the old composer.json, etc.) Also check the file composer.lock and/or vendor/composer/installed.json and verify there is the library wikimedia/timestamp.

Kghbln updated the task description. (Show Details)Jun 2 2017, 9:04 PM
Kghbln added a comment.EditedJun 2 2017, 9:26 PM

@Seb35 Thanks for trying to reproduce. I followed the procedure exactly as stated above. I understand that after doing a git pull and git checkout that the files are switched to the versions of the respective branch. The log for step 2 seems to support this expectation:

composer update --no-dev --prefer-source
> ComposerHookHandler::onPreUpdate
Loading composer repositories with package information
Updating dependencies
Package operations: 2 installs, 7 updates, 0 removals
  - Updating wikimedia/composer-merge-plugin (v1.3.1 => v1.4.0):  Checking out ca453f9f13
  - Updating cssjanus/cssjanus (v1.1.2 => v1.2.0):  Checking out 0fd44d8a3f
  - Updating oojs/oojs-ui (v0.17.10 => v0.21.1):  Checking out 59965a94e1
  - Updating oyejorge/less.php (v1.7.0.10 => v1.7.0.14):     The package has modified files:
    M bin/lessc
    Discard changes [y,n,v,d,s,?]? y
 Checking out 42925c5a01
  - Installing wikimedia/remex-html (1.0.1): Cloning 3c596e5c66
  - Installing wikimedia/timestamp (v1.0.0): Cloning 880660a2fb
  - Updating psr/log (1.0.0 => 1.0.2):  Checking out 4ebe3a8bf7
  - Updating mediawiki/scribunto dev-master (9094f68 => 2da4504):  Checking out 2da4504279
  - Updating mediawiki/page-forms dev-master (d732e00 => d6ce2f9):  Checking out d6ce2f9b08
Writing lock file
Generating optimized autoload files

So I indeed got "wikimedia/timestamp" which I verified after being asked about it on IRC. Cannot explain why I was supposed to have modified files for "oyejorge/less.php" but that's most probably another unrelated story.

From current "composer.lock":

{
    "name": "wikimedia/timestamp",
    "version": "v1.0.0",
    "source": {
        "type": "git",
        "url": "https://github.com/wikimedia/Timestamp.git",
        "reference": "880660a2fbc6e577d381225812c255008d58e0cc"
    },
    "dist": {
        "type": "zip",
        "url": "https://api.github.com/repos/wikimedia/Timestamp/zipball/880660a2fbc6e577d381225812c255008d58e0cc",
        "reference": "880660a2fbc6e577d381225812c255008d58e0cc",
        "shasum": ""
    },
    "require": {
        "php": ">=5.5.9"
    },
    "require-dev": {
        "jakub-onderka/php-parallel-lint": "0.9.2",
        "mediawiki/mediawiki-codesniffer": "0.7.2",
        "phpunit/phpunit": "4.8.24"
    },
    "type": "library",
    "autoload": {
        "classmap": [
            "src/"
        ],
        "files": [
            "src/defines.php"
        ]
    },
    "notification-url": "https://packagist.org/downloads/",
    "license": [
        "GPL-2.0+"
    ],
    "authors": [
        {
            "name": "Tyler Romeo",
            "email": "tylerromeo@gmail.com"
        }
    ],
    "description": "Creation, parsing, and conversion of timestamps",
    "homepage": "https://www.mediawiki.org/wiki/Timestamp",
    "time": "2016-09-30T10:00:56+00:00"
},

From current "installed.json":

{
    "name": "wikimedia/timestamp",
    "version": "v1.0.0",
    "version_normalized": "1.0.0.0",
    "source": {
        "type": "git",
        "url": "https://github.com/wikimedia/Timestamp.git",
        "reference": "880660a2fbc6e577d381225812c255008d58e0cc"
    },
    "dist": {
        "type": "zip",
        "url": "https://api.github.com/repos/wikimedia/Timestamp/zipball/880660a2fbc6e577d381225812c255008d58e0cc",
        "reference": "880660a2fbc6e577d381225812c255008d58e0cc",
        "shasum": ""
    },
    "require": {
        "php": ">=5.5.9"
    },
    "require-dev": {
        "jakub-onderka/php-parallel-lint": "0.9.2",
        "mediawiki/mediawiki-codesniffer": "0.7.2",
        "phpunit/phpunit": "4.8.24"
    },
    "time": "2016-09-30T10:00:56+00:00",
    "type": "library",
    "installation-source": "source",
    "autoload": {
        "classmap": [
            "src/"
        ],
        "files": [
            "src/defines.php"
        ]
    },
    "notification-url": "https://packagist.org/downloads/",
    "license": [
        "GPL-2.0+"
    ],
    "authors": [
        {
            "name": "Tyler Romeo",
            "email": "tylerromeo@gmail.com"
        }
    ],
    "description": "Creation, parsing, and conversion of timestamps",
    "homepage": "https://www.mediawiki.org/wiki/Timestamp"
},

What wonders me:

  1. Why does it work when I remove "composer.local.json" and uninstall the respective software? (Steps 4 to 5)
  2. Why do I get the error notices when tying to run update.php after I added "composer.local.json" and installed the respective software again? (Steps 6 and 7) Note that "wikimedia/timestamp" is indeed present as excepts from the files above show.
Seb35 added a comment.Jun 7 2017, 8:30 AM

Hmm, I now have this issue - not sure why I didn’t have previously.

I remark there is a 'vendor' directory (as a Git submodule) in branch REL1_29 and in tag 1.29.0-rc.0, this is new compared to previous versions and linked to T137564. Note sure if the previous procedure "git clone + composer update" should remain the same.

Hmm, I now have this issue - not sure why I didn’t have previously.

I am somewhat relieved that you were able to reproduce too.

Well, I think that is should be possible to run "composer update" and any time no matter of the circumstances otherwise we do not actually need Composer. No?

demon added a subscriber: demon.Jun 14 2017, 5:06 PM

Note sure if the previous procedure "git clone + composer update" should remain the same.

It should not. Should I have documented this somewhere? Submodules were added in T137564.

If this is a documentation fix, let's fix it right away so we can proceed with 1.29

I just vomited all over the place.

Kghbln renamed this task from Error "Class 'MWTimestamp' not found" when upgrading to MW 1.29.0-rc.0: to Error "Class 'MWTimestamp' not found" when upgrading to MW 1.29.0-rc.0.Jun 14 2017, 6:46 PM
Kghbln closed this task as Declined.
Kghbln triaged this task as Lowest priority.
Kghbln updated the task description. (Show Details)
Kghbln removed subscribers: demon, Reception123, Seb35 and 5 others.
Aklapper updated the task description. (Show Details)
Aklapper added subscribers: demon, Reception123, Seb35 and 4 others.

Restoring previously removed (meta)data and asking for different wording in the future. Thanks in advance.

demon reopened this task as Open.Jun 14 2017, 7:16 PM
demon raised the priority of this task from Lowest to Unbreak Now!.

Basically this bug needs me to undo the madness I started on in T137564.

Restricted Application added subscribers: Jay8g, TerraCodes. · View Herald TranscriptJun 14 2017, 7:16 PM
demon added a comment.Jun 14 2017, 7:17 PM

Basically this bug needs me to undo the madness I started on in T137564.

At the very least, to drop vendor from that. Extensions/skins are probably fine still.

Seb35 added a comment.Jun 15 2017, 8:26 AM

I’m no more sure how I did to see the error, I guess it is a very specific state.

Anyway I saw the commit rMWa57b64436 and specifically rMWa57b64436#523dcc49 and its counterpart in composer.json, hence possibly it’s unrelated to the vendor thing but very specific to the library. @Legoktm perhaps you have more experience (class_alias-related) ?

I suspect some extension uses the old class alias and possibly it is not loaded at some point -- I was in the train yesterday when I tested it, without Internet and hence not in the same conditions as the composer.local.json.

Seb35 added a comment.Jun 16 2017, 1:51 PM

I found the task T164896 recently closed, possibly similar to this one (class_alias issue).

Given that we've been unable to reliably reproduce this, I'm going to remove it from the 1.29 blockers for now.

Krinkle lowered the priority of this task from Unbreak Now! to Medium.Jun 23 2017, 1:09 AM
Krinkle edited projects, added Timestamp; removed MediaWiki-General.
Kghbln closed this task as Resolved.Jun 20 2018, 12:17 PM

Well, I am now on MW 1.31.0 via 1.30.0 and 1.29.0 and I no longer have this issue during upgrades. Thank you for fixing this whoever did this.