Page MenuHomePhabricator

CSSMin url() value remapping not working in certain obscure cases (braces in comments inside declarations: background: /*{test}*/ url(image.png) )
Closed, ResolvedPublic

Details

Reference
bz60077

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 2:55 AM
bzimport set Reference to bz60077.
Fomafix created this task.Jan 15 2014, 9:33 AM

Change 108040 had a related patch set uploaded by Gerrit Patch Uploader:
Embed background images in jquery.ui.theme.css correctly

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

The problem is in mediawiki/core in file
resources/jquery.ui/themes/default/jquery.ui.theme.css

This actually looks like a core CSSMin bug to me: the url() value is not recognized and thus not processed as it should be (fixing the patch).

For the record, one of the problematic rules is below:

.ui-widget-content { border: 1px solid #aaaaaa/*{borderColorContent}*/; background: #ffffff/*{bgColorContent}*/ url(images/ui-bg_flat_75_ffffff_40x100.png)/*{bgImgUrlContent}*/ 50%/*{bgContentXPos}*/ 50%/*{bgContentYPos}*/ repeat-x/*{bgContentRepeat}*/; color: #222222/*{fcContent}*/; }

The braces in comments make this regex from CSSMin.php not match:

const URL_REGEX = 'url\(\s*[\'"]?(?P<file>[^\?\)\'"]*?)(?P<query>\?[^\)\'"]*?|)[\'"]?\s*\)';
$pattern = '/(?:^|[;{])\K[^;{}]*' . CSSMin::URL_REGEX . '[^;}]*(?=[;}]|$)/';

Not sure if we want to contort this regex even further to support this…
comments, anyone?

Probably caused by https://gerrit.wikimedia.org/r/#/c/94511/ .

  • Bug 63688 has been marked as a duplicate of this bug. ***

Change 138286 had a related patch set uploaded by Foxtrott:
fix bug 60077 (CSSMin url() value remapping not working in certain obscure cases)

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

Change 138286 had a related patch set uploaded by Foxtrott:
Fix "CSSMin url() value remapping not working in certain obscure cases"

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

Change 108040 abandoned by Bartosz Dziewoński:
Embed background images in jquery.ui.theme.css correctly

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

Change 138286 merged by jenkins-bot:
Fix "CSSMin url() value remapping not working in certain obscure cases"

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

I can't find details of what actually broke anywhere.

My best guess right now is that it is a resource problem. Adding those new alterntives pushes preg_match over some limit for large files.

Niklas, the symptom was that Vector's CSS disappeared from http://en.wikipedia.beta.wmflabs.org/.

Change 139268 had a related patch set uploaded by Foxtrott:
Fix "CSSMin url() value remapping not working in certain obscure cases"

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

Change 139268 merged by jenkins-bot:
Fix CSSMin url() remapping when comments in CSS contain curly braces

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

I hope this works better now. Thanks again!

Quasar` on irc just now is experiancing this bug on 1.23.2, which suggests the fix should be backported.

If you want to backport this, that would be appreciated. Cherry picking didn't work.