Last modified: 2009-12-19 23:45:21 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 T22286, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 20286 - Encoding of + in “further results” URL does not work
Encoding of + in “further results” URL does not work
Status: ASSIGNED
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Markus Krötzsch
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-08-17 10:28 UTC by lmout1982
Modified: 2009-12-19 23:45 UTC (History)
0 users

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


Attachments

Description lmout1982 2009-08-17 10:28:54 UTC
The link “more results” at the bottom of the table: The Special:Ask doesn’t found a result. The inline query is {{#ask: [[Catégorie:Communes]] [[Commune lorrain::+]] … }} and if I edit the query in the special page, I found : [[Catégorie:Communes]] [[Commune lorrain::_]]. The “+” is replaced with “_”.

The problem can be viewed online at: http://wiki.culture-langues-lorraine.org/Test

Version of SMW used: 1.4.2
Version of MW used: 1.15.1
Server setup used: PHP 5.2.6 (cgi), MySQL 4.0.27
The problem is not reproducible on a test page on the sandbox site.
Comment 1 Markus Krötzsch 2009-09-09 09:45:26 UTC
This seems to be a configuration problem with your site/server/wiki. The further results URL that is generated is correct:

http://wiki.culture-langues-lorraine.org/Sp%C3%A9cial:Ask/-5B-5BCat%C3%A9gorie:Communes-5D-5D-20-5B-5BCommune-20lorrain::%2B-5D-5D/-3FLatitude/-3FLongitude

It contains a properly encoded "+" (the "%2B" after "lorrain::"). However, when trying to call this URL on your site, the "%2B" is substituted by an underscore, leading to a broken query. I can see that one would substitute "+" with "_" in some cases, since "+" was used to encode space in old MediaWiki versions. But there is no reason to also substitute "%2B" with "_". 

I am not sure what causes this problem. Your MW and SMW versions are fairly recent. Maybe there is a configuration option for MW to fornce this behavior? But the problem could also be in your webserver configuration: if the webserver somehow decodes "%2B" into "+" earlier, then MW would probably do the undesired replacement of "+" with "_" thereafter.
Comment 2 lmout1982 2009-12-05 22:52:13 UTC
The problem seems to come from the mod_rewrite. It automatically decodes the urlencoded URL, so if you pass in %2B, PHP sees it as "+", a space that mediawiki converts to an underscore. If I double encode "+" (%252B), mod_rewrite decodes the first one, and PHP receives the second one (which is now %2B). Example:

[http://wiki.culture-langues-lorraine.org/Sp%C3%A9cial:Ask/-5B-5BCat%C3%A9gorie:Communes-5D-5D-20-5B-5BCommune-20sobriquet-20lorrain::%252B-5D-5D/-3FCode-20postal/-3FCommune-20sobriquet-20lorrain%3DSobriquet%28s%29]

(In reply to comment #1)
> This seems to be a configuration problem with your site/server/wiki. The
> further results URL that is generated is correct:
> 
> http://wiki.culture-langues-lorraine.org/Sp%C3%A9cial:Ask/-5B-5BCat%C3%A9gorie:Communes-5D-5D-20-5B-5BCommune-20lorrain::%2B-5D-5D/-3FLatitude/-3FLongitude
> 
> It contains a properly encoded "+" (the "%2B" after "lorrain::"). However, when
> trying to call this URL on your site, the "%2B" is substituted by an
> underscore, leading to a broken query. I can see that one would substitute "+"
> with "_" in some cases, since "+" was used to encode space in old MediaWiki
> versions. But there is no reason to also substitute "%2B" with "_". 
> 
> I am not sure what causes this problem. Your MW and SMW versions are fairly
> recent. Maybe there is a configuration option for MW to fornce this behavior?
> But the problem could also be in your webserver configuration: if the webserver
> somehow decodes "%2B" into "+" earlier, then MW would probably do the undesired
> replacement of "+" with "_" thereafter.
Comment 3 lmout1982 2009-12-19 23:45:21 UTC
As I haven’t found a good solution with Apache, I have fixed temporary the problem by modifying the source code of the function SMWInfolink:: encodeParameters(…), line 264 : 
$value = str_replace(array('-', '#', "\n", ' ', '/', '[', ']', '<', '>', '&lt;', '&gt;', '&amp;', '\'\'', '|', '&', '%', '?', '+'),
		     array('-2D', '-23', '-0A', '-20', '-2F', '-5B', '-5D', '-3C', '-3E', '-3C', '-3E', '-26', '-27-27', '-7C', '-26', '-25', '-3F', '-2B'), $value);

I think you should add a global variable to parametrize this ?

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


Navigation
Links