Last modified: 2012-11-07 03:36:57 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T43746, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 41746 - api.php?action=ask with query containing || (disjunction) returns unexpected result
api.php?action=ask with query containing || (disjunction) returns unexpected ...
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
master
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
http://semantic-mediawiki.org/w/api.p...
: patch, patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-11-03 18:36 UTC by Maxim Dubovik
Modified: 2012-11-07 03:36 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Maxim Dubovik 2012-11-03 18:36:51 UTC
If I try to use api.php?action=ask with query witch contains || (disjunction) then script returns unexpected result. I fix it with little patch:

File: /extensions/SemanticMediaWiki/includes/api/ApiAsk.php
Line: 21
Replace: $rawParams = explode( '|', $params['query'] );
With: $rawParams = preg_split("/(?<=[^\|])\|(?=[^\|])/", $params['query']);

Description: this happens because script tries to split query string with pipe char, but it can contain doblepipe char to concat results (e.g. [[Category:First||Second]]), so it would be better to use preg_split as I propose.
Comment 1 Andre Klapper 2012-11-05 14:17:47 UTC
Hi Maxim, thanks for the report and the solution!

You are welcome to use Developer access
  https://www.mediawiki.org/wiki/Developer_access
to submit this as a Git branch directly into Gerrit:
  https://www.mediawiki.org/wiki/Git/Tutorial

Putting your branch in Git makes it easier for us to review it quickly.
Thanks again! We appreciate your contribution.
Comment 2 MWJames 2012-11-07 03:36:57 UTC
Jeroen included the patch 
https://gerrit.wikimedia.org/r/#/c/31742/

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links