Page MenuHomePhabricator

ApiStashEdit::checkCache doesn't convert arrays properly when doing DB select
Closed, DuplicatePublic

Description

We've run into the following back trace several times a day:

A database query error has occurred. This may indicate a bug in the software.
•	Query:
SELECT 1 FROM `page` WHERE (Array) OR (Array) OR (Array) LIMIT 1
•	Function: ApiStashEdit::checkCache
•	Error: 1054 Unknown column 'Array' in 'where clause' (DBSERVER)
Backtrace:
#0 .../includes/db/Database.php(1205): DatabaseBase->reportQueryError('Unknown column ...', 1054, 'SELECT  1  FROM...', 'ApiStashEdit::c...', false)
#1 .../includes/db/Database.php(1726): DatabaseBase->query('SELECT  1  FROM...', 'ApiStashEdit::c...')
#2 .../includes/db/Database.php(1394): DatabaseBase->select('page', '1', '(Array) OR (Arr...', 'ApiStashEdit::c...', Array)
#3 .../includes/api/ApiStashEdit.php(289): DatabaseBase->selectField('page', '1', '(Array) OR (Arr...', 'ApiStashEdit::c...')
#4 .../includes/page/WikiPage.php(2083): ApiStashEdit::checkCache(Object(Title), Object(WikitextContent), Object(User))
#5 .../includes/page/WikiPage.php(1757): WikiPage->prepareContentForEdit(Object(WikitextContent), NULL, Object(User), 'text/x-wiki')
#6 [internal function]: WikiPage->doEditContent(Object(WikitextContent), '/* External lin...', 102, false, NULL, 'text/x-wiki')
#7 .../includes/page/Article.php(2016): call_user_func_array(Array, Array)
#8 .../includes/EditPage.php(1921): Article->__call('doEditContent', Array)
#9 .../includes/EditPage.php(1921): Article->doEditContent(Object(WikitextContent), '/* External lin...', 102, false, NULL, 'text/x-wiki')
#10 .../includes/EditPage.php(1305): EditPage->internalAttemptSave(Array, false)
#11 .../includes/EditPage.php(539): EditPage->attemptSave(Array)
#12 .../includes/actions/EditAction.php(56): EditPage->edit()
#13 .../includes/actions/SubmitAction.php(40): EditAction->show()
#14 .../includes/MediaWiki.php(395): SubmitAction->show()
#15 .../includes/MediaWiki.php(273): MediaWiki->performAction(Object(Article), Object(Title))
#16 .../includes/MediaWiki.php(566): MediaWiki->performRequest()
#17 .../includes/MediaWiki.php(414): MediaWiki->main()
#18 .../index.php(41): MediaWiki->run()
#19 {main}

Note that when I turned on debug logging, the error wouldn't show up, so I turned off the debug logging and turned on tracebacks in prod.

The above error occured twice when trying to save the same page. The third time the save was successful.

Note that '(Array)' shows up where there should be a condition.