Topic on Project:Support desk

Fatal PHP error when running update.php

11
Erikjsci (talkcontribs)

Hi,

I'm testing an upgrade of a MediaWiki 1.15.1 to 1.21.0 on a locally installed virtual web server. I'm using Apache 2.2.22, PHP 5.3.17, and MySQL 5.5.30. After copying the new files over the old ones I run the maintenance/update.php from the command line. It gets part way through the update process then fails with the following error: ...batch conversion of user_options: PHP Fatal error: Unsupported operand types in /web/wiki/htdocs/languages/Language.php on line 495 Any idea what might be going wrong?

Thanks.

Erik

88.130.120.224 (talkcontribs)

Hi Erik,

I just wanted to ask you what code you have in languages/Language.php on line 495, but I think I already know what your problem might be:

When you are on the shell, what PHP version do you have there? You wrote you would have version 5.3.17, but you might have a different (possibly way older) version on the shell. Use php -v to find out...

Erikjsci (talkcontribs)

php -v also results in PHP 5.3.17. If it helps I can add that I'm running an Oracle VM virtual box with OpenSUSE 12.3 "Dartmouth" Kernel 3.7.10-1.1-desktop. Thanks.

Erik

Erikjsci (talkcontribs)

This bit of code is in the public function getNamespaces()

495 $this->namespaceNames = $wgExtraNamespaces + $this->namespaceNames + $validNamespaces;

It's the fifth line inside the function.

Erik

88.130.67.109 (talkcontribs)

So you get an error "unsupported operand types" when using "+" on variables... Maybe they / some of them do not have the type, which was expected (e.g. array vs. string)?

Erikjsci (talkcontribs)

Probably so. Any suggestions for troubleshooting the problem?

Erik

88.130.98.228 (talkcontribs)
Erikjsci (talkcontribs)

I changed the line to use array_merge() instead and tried it again. Now it reports a warning and moves on to another error:

...batch conversion of user_options: PHP Warning: array_merge(): Argument #1 is not an array in /web/wiki/htdocs/languages/Language.php on line 495 PHP Notice: Undefined offset: 5 in /web/wiki/htdocs/languages/Language.php on line 501 A database query syntax error has occurred. The last attempted database query was: "SELECT rev_id,rev_page,rev_text_id,rev_timestamp,rev_comment,rev_user_text,rev_user,rev_minor_edit,rev_deleted,rev_len,rev_parent_id,rev_sha1,page_namespace,page_title,page_id,page_latest,page_is_redirect,page_len,user_name FROM `revision` INNER JOIN `page` ON ((page_id = rev_page)) LEFT JOIN `user` ON ((rev_user != 0) AND (user_id = rev_user)) WHERE page_id = '8' AND rev_id = '32' LIMIT 1 " from within function "Revision::fetchFromConds". Database returned error "1054: Unknown column 'rev_sha1' in 'field list' (db1)"

Erikj36 (talkcontribs)

I eventually found the offending bit of code on my own. I had the following directive in my LocalSettings.php:

$wgExtraNamespaces = NULL;

This did not cause a problem in the older version of MediaWiki, but was catastrophic for upgrading! All went well after removing it.

88.130.97.34 (talkcontribs)
$wgExtraNamespaces = NULL;

was documented as default for that setting. But that is blatantly wrong! I have just fixed the wrong description.

Erikj36 (talkcontribs)

I also had to manually add the missing rev_shaw table to the database with the following command: (note to substitute (prefix)_ with whatever if any table prefix you use.)

ALTER TABLE (prefix)_revision ADD rev_sha1 varbinary(32) NOT NULL default ;

Reply to "Fatal PHP error when running update.php"