Page MenuHomePhabricator

PHP fatal/ Js exception TypeError: haystack is undefined in stringEndsWith
Closed, ResolvedPublic3 Estimated Story Points

Description

https://logstash.wikimedia.org/app/kibana#/doc/logstash-*/logstash-2020.10.21/clienterror/?id=AXVKaqHh2lgCwKx7Ipnm

at stringEndsWith URL1:487:442
at mw.libs.advancedSearch.QueryCompiler.prototype.removeCompiledQueryFromSearch URL1:487:706
at URL1:526:89
at mightThrow URL1:53:149
at resolve/</process< URL1:53:808

URL1: https://commons.wikimedia.org/w/load.php?lang=en&modules=Spinner%2CdataValues%2Cjquery%2Coojs%2Coojs-router%2Coojs-ui-core%2Coojs-ui-widgets%2Coojs-ui-windows%2Csite%7CdataValues.DataValue%7Cext.advancedSearch.elements%2Cinit%2Cstyles%7Cext.centralNotice.geoIP%7Cext.centralauth.ForeignApi%2Ccentralautologin%7Cext.eventLogging%2CnavigationTiming%2CwikimediaEvents%7Cext.tmh.OgvJsSupport%7Cext.uls.common%2Ccompactlinks%2Cinit%2Cinterface%2Cpreferences%2Cwebfonts%7Cext.wikimediaEvents.wikibase%7Cjquery.client%2Ccookie%2CembedPlayer%2ChighlightText%2CloadingSpinner%2CmwEmbedUtil%2Csuggestions%2CtextSelection%2CtriggerQueueCallback%2Cui%7Cjquery.uls.data%7Cmediawiki.ForeignApi%2CString%2CTitle%2CUri%2Capi%2Cbase%2Ccldr%2Ccookie%2Cexperiments%2CjqueryMsg%2Clanguage%2CsearchSuggest%2Cstorage%2Ctemplate%2Cuser%2Cutil%2Cwidgets%7Cmediawiki.ForeignApi.core%7Cmediawiki.editfont.styles%7Cmediawiki.libs.pluralruleparser%7Cmediawiki.page.ready%7Cmediawiki.special.search%7Cmediawiki.template.mustache%2Cmustache%2Bdom%7Cmediawiki.ui.icon%7Cmediawiki.widgets.SearchInputWidget%2Cstyles%7Cmmv.bootstrap%2Chead%7Cmmv.bootstrap.autostart%7Cmw.EmbedPlayer.loader%7Cmw.MediaWikiPlayer.loader%7Cmw.MwEmbedSupport%2CPopUpMediaTransform%7Cmw.MwEmbedSupport.style%7Cmw.PopUpMediaTransform.styles%7Cmw.TimedText.loader%7Coojs-ui-core.icons%2Cstyles%7Coojs-ui-widgets.icons%7Coojs-ui-windows.icons%7Coojs-ui.styles.icons-content%2Cicons-interactions%2Cicons-layout%2Cindicators%7Cskins.vector.legacy.js%7Cuser.defaults%7Cutil.inherit%7Cwikibase.api.RepoApi%7Cwikibase.datamodel%7Cwikibase.mediainfo.base%2Csearch&skin=vector&version=i20to

https://commons.wikimedia.org/w/index.php?search=kelp%5C+filetype%3Abitmap+filew%3A%3E2000&title=Special:Search&profile=advanced&fulltext=1&advancedSearch-current=%7B%22fields%22%3A%7B%22filetype%22%3A%22bitmap%22%2C%22filew%22%3A%5B%22%3E%22%2C%222000%22%5D%7D%7D&ns0=1&ns6=1&ns12=1&ns14=1&ns100=1&ns106=1

The page also fatals in this situation.

Event Timeline

Change 636165 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/CirrusSearch@master] T266163

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

Change 636165 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/CirrusSearch@master] Fix mismatch between KeywordParser & NonPhraseParser

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

Change 636166 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/AdvancedSearch@master] Stop initialization when there is no search form

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

thiemowmde set the point value for this task to 2.
thiemowmde added a subscriber: thiemowmde.

The fatal is in CirrusSearch. Stacktrace:

#0 /srv/mediawiki/php-1.36.0-wmf.14/extensions/CirrusSearch/includes/Parser/QueryStringRegex/QueryStringRegexParser.php(632): Wikimedia\Assert\Assert::precondition(boolean, string)
#1 /srv/mediawiki/php-1.36.0-wmf.14/extensions/CirrusSearch/includes/Parser/QueryStringRegex/QueryStringRegexParser.php(369): CirrusSearch\Parser\QueryStringRegex\QueryStringRegexParser->nextToken()
#2 /srv/mediawiki/php-1.36.0-wmf.14/extensions/CirrusSearch/includes/Parser/QueryStringRegex/QueryStringRegexParser.php(326): CirrusSearch\Parser\QueryStringRegex\QueryStringRegexParser->expression()
#3 /srv/mediawiki/php-1.36.0-wmf.14/extensions/CirrusSearch/includes/Search/SearchQueryBuilder.php(130): CirrusSearch\Parser\QueryStringRegex\QueryStringRegexParser->parse(string)
#4 /srv/mediawiki/php-1.36.0-wmf.14/extensions/CirrusSearch/includes/CirrusSearch.php(238): CirrusSearch\Search\SearchQueryBuilder::newFTSearchQueryBuilder(CirrusSearch\SearchConfig, string, class@anonymous

The trigger is the backslash in kelp\ filetype:bitmap filew:>2000. It escapes the space before the filetype: keyword, which means this is not a valid keyword but plain text, and functionally identical to "kelp filetype:bitmap" filew:>2000. Two parser steps in the CirrusSearch codebase disagree about this. I uploaded a fix.

Change 636166 merged by jenkins-bot:
[mediawiki/extensions/AdvancedSearch@master] Stop initialization when there is no search form

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

Change 636165 merged by jenkins-bot:
[mediawiki/extensions/CirrusSearch@master] Fix mismatch between KeywordParser & NonPhraseParser

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

thiemowmde changed the point value for this task from 2 to 3.
thiemowmde moved this task from Sprint Backlog to Demo on the WMDE-QWERTY-Sprint-2020-10-21 board.