Page MenuHomePhabricator

ORA-00936: PHP Warning: strpos() expects parameter 1 to be string, object given in DatabaseOracle.php
Closed, DeclinedPublic

Description

There are 2 reports now on Project:Support desk for MediaWiki 1.23 [1] and 1.22 [2] about the same error message in Oracle:

MediaWiki 1.23:

PHP Warning: strpos() expects parameter 1 to be string, object given in /var/www/html/devinsample/mediawiki-1.23.1/includes/db/DatabaseOracle.php on line 1308
PHP Warning: strpos() expects parameter 1 to be string, object given in /var/www/html/devinsample/mediawiki-1.23.1/includes/db/DatabaseOracle.php on line 1304

MediaWiki 1.22:

PHP Warning: strpos() expects parameter 1 to be string, object given in /var/www/mediawiki/includes/db/DatabaseOracle.php on line 1146
PHP Warning: strpos() expects parameter 1 to be string, object given in /var/www/mediawiki/includes/db/DatabaseOracle.php on line 1142

Both lines correspond in both versions to removeIdentifierQuotes and isQuotedIdentifier methods of class DatabaseOracle

With those 2 reports of different people and versions I doubt this is just a coincidence or configuration issue.


[1] https://www.mediawiki.org/wiki/Thread:Project:Support_desk/Syntax_errors_after_installation_when_accessing_the_mainpage._Database:_Oracle
[2] https://www.mediawiki.org/wiki/Thread:Project:Support_desk/Upload_File_not_working_with_Oracle


Version: 1.24rc
Severity: major
URL: https://www.mediawiki.org/wiki/Thread:Project:Support_desk/Syntax_errors_after_installation_when_accessing_the_mainpage._Database:_Oracle

Details

Reference
bz68874

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:37 AM
bzimport set Reference to bz68874.
bzimport added a subscriber: Unknown Object (MLST).

From the first thread, there's a stack trace of the error:

Caught exception DBQueryError: A database error has occurred. Did you forget to run maintenance/update.php after upgrading? See: https://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script
Query: INSERT INTO /*Q*/L10N_CACHE (lc_lang,lc_key,lc_value) VALUES (:lc_lang, :lc_key, )
Function: DatabaseOracle::insertOneRow
Error: 936 ORA-00936: missing expression

#0 /var/www/html/devinsample/mediawiki-1.23.1/includes/db/DatabaseOracle.php(709): DatabaseOracle->reportQueryError('ORA-00936: miss...', 936, 'INSERT INTO /*Q...', 'DatabaseOracle:...')
#1 /var/www/html/devinsample/mediawiki-1.23.1/includes/db/DatabaseOracle.php(576): DatabaseOracle->insertOneRow('l10n_cache', Array, 'LCStoreDB::set')
#2 /var/www/html/devinsample/mediawiki-1.23.1/includes/cache/LocalisationCache.php(1229): DatabaseOracle->insert('l10n_cache', Array, 'LCStoreDB::set')
#3 /var/www/html/devinsample/mediawiki-1.23.1/includes/cache/LocalisationCache.php(963): LCStoreDB->set('messages:nov', 'nov')
#4 /var/www/html/devinsample/mediawiki-1.23.1/includes/cache/LocalisationCache.php(452): LocalisationCache->recache('da')
#5 /var/www/html/devinsample/mediawiki-1.23.1/includes/cache/LocalisationCache.php(326): LocalisationCache->initLanguage('da')
#6 /var/www/html/devinsample/mediawiki-1.23.1/includes/cache/LocalisationCache.php(260): LocalisationCache->loadItem('da', 'fallback')
#7 /var/www/html/devinsample/mediawiki-1.23.1/languages/Language.php(4146): LocalisationCache->getItem('da', 'fallback')
#8 /var/www/html/devinsample/mediawiki-1.23.1/languages/Language.php(237): Language::getFallbacksFor('da')
#9 /var/www/html/devinsample/mediawiki-1.23.1/languages/Language.php(196): Language::newFromCode('da')
#10 /var/www/html/devinsample/mediawiki-1.23.1/maintenance/eval.php(81) : eval()'d code(1): Language::factory('da')
#11 /var/www/html/devinsample/mediawiki-1.23.1/maintenance/eval.php(81): eval()
#12 {main}

In LocalisationCache.php it does:

$this->batch[] = array(
'lc_lang' => $this->currentLang,
'lc_key' => $key,
'lc_value' => $this->dbw->encodeBlob( serialize( $value ) ) );

if ( count( $this->batch ) >= 100 ) {
$this->dbw->insert( 'l10n_cache', $this->batch, METHOD );
$this->batch = array();
}

DatabaseOracle.php has:

function encodeBlob( $b ) {
return new Blob( $b );
}

So it returns an object (Database.php returns just the same $b untouched)

insertOneRow has the call to $this->isQuotedIdentifier( $val ), which has the call to strpos() of that value, which is a Blob() object

  • This bug has been marked as a duplicate of bug 64970 ***

Seems that the patch from the other bug doesn't address comment 1 and so does not fix this bug.

Reopening

  • Bug 68877 has been marked as a duplicate of this bug. ***
  • Bug 71251 has been marked as a duplicate of this bug. ***

Heads-up: As per RFC discussion in August 2019, the previously experimental support for using Oracle or MSSQL as database backends in MediaWiki core has been removed in MediaWiki 1.34, so this task might end up as declined in the future.