Page MenuHomePhabricator

Wrong arguments passed to DatabaseOracle::__construct() from OracleInstaller.php
Closed, ResolvedPublic

Description

Issue reported in Topic:Ssi9icj9pkg30z8e:

PHP Catchable fatal error: Argument 1 passed to DatabaseOracle::__construct() must be an array, string given,
called in /mediawiki/app/includes/installer/OracleInstaller.php on line 176 and defined in /mediawiki/app/includes/db/DatabaseOracle.php on line 210

Indeed, constructor of DatabaseOracle is:

function __construct( array $p ) {

but OracleInstaller uses:

$db = new DatabaseOracle(
        $this->getVar( 'wgDBserver' ),
        $this->getVar( '_InstallUser' ),
        $this->getVar( '_InstallPassword' ),
        $this->getVar( '_InstallDBname' ),
        0,
        $this->getVar( 'wgDBprefix' )
);

This happens on MediaWiki 1.25 at least

Event Timeline

Ciencia_Al_Poder raised the priority of this task from to Needs Triage.
Ciencia_Al_Poder updated the task description. (Show Details)
Ciencia_Al_Poder added a subscriber: Ciencia_Al_Poder.
Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald TranscriptNov 11 2015, 9:11 PM

Somebody is working on..? I want to collaborate...! Thanks a lot.

My starting work:

1.- turn string given into array:

$db = new DatabaseOracle(
array('wgDBserver' => $this->getVar( 'wgDBserver' ),
'_InstallUser' => $this->getVar( '_InstallUser' ),
'_InstallPassword' => $this->getVar( '_InstallPassword' ),
'_InstallDBname' => $this->getVar( '_InstallDBname' ),
'0' => 0,
'tablePrefix' => $this->getVar( 'wgDBprefix' ))
);

2.- analyze generated errors:
URL: http://localhost/mediawiki130/mw-config/index.php?page=DBConnect

GIVEN ARRAY: array(6) { ["wgDBserver"]=> string(11) "tnsname.ora" ["_InstallUser"]=> string(4) "WIKI" ["_InstallPassword"]=> string(8) "xxxxxxxxxxx" ["_InstallDBname"]=> string(4) "WIKI" [0]=> int(0) ["wgDBprefix"]=> string(6) "MW130_" }

GENERATED ERR:
Notice: Undefined index: tablePrefix in C:\xampp\htdocs\mediawiki130\includes\db\DatabaseOracle.php on line 55
Notice: Undefined index: tablePrefix in C:\xampp\htdocs\mediawiki130\includes\db\DatabaseOracle.php on line 58
(well, this two were predictable...)
Notice: Undefined index: host in C:\xampp\htdocs\mediawiki130\includes\libs\rdbms\database\Database.php on line 248
Notice: Undefined index: user in C:\xampp\htdocs\mediawiki130\includes\libs\rdbms\database\Database.php on line 249
Notice: Undefined index: password in C:\xampp\htdocs\mediawiki130\includes\libs\rdbms\database\Database.php on line 250
Notice: Undefined index: dbname in C:\xampp\htdocs\mediawiki130\includes\libs\rdbms\database\Database.php on line 251
Notice: Undefined index: schema in C:\xampp\htdocs\mediawiki130\includes\libs\rdbms\database\Database.php on line 253
Notice: Undefined index: cliMode in C:\xampp\htdocs\mediawiki130\includes\libs\rdbms\database\Database.php on line 256
Notice: Undefined index: agent in C:\xampp\htdocs\mediawiki130\includes\libs\rdbms\database\Database.php on line 258
Notice: Undefined index: flags in C:\xampp\htdocs\mediawiki130\includes\libs\rdbms\database\Database.php on line 260
Notice: Undefined index: variables in C:\xampp\htdocs\mediawiki130\includes\libs\rdbms\database\Database.php on line 269
Notice: Undefined index: profiler in C:\xampp\htdocs\mediawiki130\includes\libs\rdbms\database\Database.php on line 275
Notice: Undefined index: trxProfiler in C:\xampp\htdocs\mediawiki130\includes\libs\rdbms\database\Database.php on line 276
Notice: Undefined index: connLogger in C:\xampp\htdocs\mediawiki130\includes\libs\rdbms\database\Database.php on line 277
Notice: Undefined index: queryLogger in C:\xampp\htdocs\mediawiki130\includes\libs\rdbms\database\Database.php on line 278
Notice: Undefined index: errorLogger in C:\xampp\htdocs\mediawiki130\includes\libs\rdbms\database\Database.php on line 279

[228d4e577d07dd5d6bc58cdb] /mediawiki130/mw-config/index.php?page=DBConnect InvalidArgumentException from line 287 of C:\xampp\htdocs\mediawiki130\includes\libs\rdbms\database\Database.php: No database user provided.

BACKTRACE:
#0 C:\xampp\htdocs\mediawiki130\includes\db\DatabaseOracle.php(59): Wikimedia\Rdbms\Database->construct(array)
#1 C:\xampp\htdocs\mediawiki130\includes\installer\OracleInstaller.php(185): DatabaseOracle->
construct(array)
#2 C:\xampp\htdocs\mediawiki130\includes\installer\DatabaseInstaller.php(184): OracleInstaller->openConnection()
#3 C:\xampp\htdocs\mediawiki130\includes\installer\OracleInstaller.php(128): DatabaseInstaller->getConnection()
#4 C:\xampp\htdocs\mediawiki130\includes\installer\WebInstallerDBConnect.php(118): OracleInstaller->submitConnectForm()
#5 C:\xampp\htdocs\mediawiki130\includes\installer\WebInstallerDBConnect.php(34): WebInstallerDBConnect->submit()
#6 C:\xampp\htdocs\mediawiki130\includes\installer\WebInstaller.php(277): WebInstallerDBConnect->execute()
#7 C:\xampp\htdocs\mediawiki130\mw-config\index.php(80): WebInstaller->execute(array)
#8 C:\xampp\htdocs\mediawiki130\mw-config\index.php(39): wfInstallerMain()
#9 {main}

PLEASE: Could anybody point me to includes\libs\rdbms\database\Database.php documentation...? TIA..!

Krinkle added a subscriber: Krinkle.

@Fheredia The generated documentation for that file is at https://doc.wikimedia.org/mediawiki-core/1.30.0/php/classWikimedia_1_1Rdbms_1_1Database.html.

As for the file in Git, it is there, but it is in IDatabase.php instead of Database.php. See libs/rdbms/database/IDatabase.php.

Krinkle moved this task from Untriaged to Rdbms library on the Wikimedia-Rdbms board.
Legoktm assigned this task to aaron.Aug 29 2018, 2:08 AM
Legoktm added a subscriber: Legoktm.

Aaron fixed this in rMW6120c18829d7: Fix bogus DatabaseOracle::__construct() calls in OracleInstaller, so this is only an issue in pre-1.31.

rMW2cfcb390c67a: DatabaseBase constructor cleanups (1.25) introduced the problem, so we also need backports to 1.27 and 1.29.

Change 456077 had a related patch set uploaded (by Legoktm; owner: Aaron Schulz):
[mediawiki/core@REL1_27] Fix bogus DatabaseOracle::__construct() calls in OracleInstaller

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

Change 456076 had a related patch set uploaded (by Legoktm; owner: Aaron Schulz):
[mediawiki/core@REL1_29] Fix bogus DatabaseOracle::__construct() calls in OracleInstaller

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

Change 456075 had a related patch set uploaded (by Legoktm; owner: Aaron Schulz):
[mediawiki/core@REL1_30] Fix bogus DatabaseOracle::__construct() calls in OracleInstaller

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

Change 456075 merged by jenkins-bot:
[mediawiki/core@REL1_30] Fix bogus DatabaseOracle::__construct() calls in OracleInstaller

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

Change 456077 merged by jenkins-bot:
[mediawiki/core@REL1_27] Fix bogus DatabaseOracle::__construct() calls in OracleInstaller

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

Change 456076 merged by jenkins-bot:
[mediawiki/core@REL1_29] Fix bogus DatabaseOracle::__construct() calls in OracleInstaller

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

Legoktm closed this task as Resolved.Aug 29 2018, 7:57 PM