Last modified: 2013-10-23 15:57:36 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 T36801, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 34801 - Function applyDiffStyle uses regexes which do not detect CSS classes appropriately
Function applyDiffStyle uses regexes which do not detect CSS classes appropri...
Status: NEW
Product: MediaWiki
Classification: Unclassified
Recent changes (Other open bugs)
1.19
All All
: Normal normal (vote)
: Future release
Assigned To: Nobody - You can work on this!
: easy
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-02-29 17:50 UTC by Helder
Modified: 2013-10-23 15:57 UTC (History)
1 user (show)

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


Attachments

Description Helder 2012-02-29 17:50:05 UTC
Currently, the function uses the regex
/(<[^>]+)class=(['\"])$class\\2([^>]*>)/
to try to detect the CSS classes. This only works if the element has only one class and fails for some classes (mentioned on bug 34800) which appear at
https://en.wikipedia.org/w/index.php?title=Special:RecentChanges&feed=rss&action=purge
E.g.:
* diff: http://www.rubular.com/r/Q6x0qNBRmo
* diffchange: http://www.rubular.com/r/0ToRFfpvXA

Something like
(<[^>]+)class=(['\"])$class(| .+?)\\2([^>]*>)
would be slightly better:
http://www.rubular.com/r/BGlcrGfRtd
but still wouldn't work in case there is some class before the specified class:
http://www.rubular.com/r/xLWx9MWBSL

Besides, notice that
\"
has only one backslash and
\\2
has two. I don't know what is the proper syntax for this in PHP strings but it is likely that one of the two needs to be fixed.

See also bug 34800 and bug 34798.
Comment 1 Mark A. Hershberger 2012-09-30 16:49:57 UTC
not happening for 1.20 tarball.

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


Navigation
Links