Last modified: 2013-12-24 20:19:51 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 T37128, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 35128 - Forward slashes in template/form names cause error: patch for suggested fix attached
Forward slashes in template/form names cause error: patch for suggested fix a...
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
SemanticForms (Other open bugs)
unspecified
All All
: Normal major (vote)
: ---
Assigned To: Yaron Koren
: patch, patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-10 14:28 UTC by Andru
Modified: 2013-12-24 20:19 UTC (History)
4 users (show)

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


Attachments
Patch to replace / delimiter with a variable $preg_delim (6.97 KB, patch)
2012-03-10 14:28 UTC, Andru
Details

Description Andru 2012-03-10 14:28:04 UTC
Currently, forward slashes within template or form names will make semantic forms behave in an unexpected mannor. I encountered this with the preg_replace code around lines 1430-1460 of SF_FormPrinter.php, but there are many instances of code throughout where the forward slash is used as a delimiter without escaping forward slashes in variables included in the expression.

This patch replaces all preg delimiters with the varaible $preg_delim, which has been set to :, a less common character for mediawiki titles & pages, but could easily be changed to anything else if a conflict is found.

An alternative to this proposed patch could be to always escape forward slashes in any preg expressions which contain variable data, however that has a potentially high processing cost. This is a simpler solution but not without flaws, it currently assumes the % will not be used within a variable expression - potentially as dangerous as assuming / will not be used, but it does at least introduce a means to quickly change all regular expressions to use a different delimiter.
Comment 1 Andru 2012-03-10 14:28:38 UTC
Created attachment 10212 [details]
Patch to replace / delimiter with a variable $preg_delim
Comment 2 Sumana Harihareswara 2012-03-10 18:26:33 UTC
Thanks for the patch, Andru.
Comment 3 Mark A. Hershberger 2012-03-15 00:45:34 UTC
changing to "new" since this has a patch
Comment 4 Yaron Koren 2013-12-24 20:19:51 UTC
I believe this was fixed at some point (by escaping characters - the "slow" way); and I can't reproduce it now. I'm marking this as "fixed".

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


Navigation
Links