Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cssurlrewrite.php has faulty regex #1

Closed
katarak opened this issue Feb 1, 2011 · 2 comments
Closed

cssurlrewrite.php has faulty regex #1

katarak opened this issue Feb 1, 2011 · 2 comments

Comments

@katarak
Copy link

katarak commented Feb 1, 2011

line 31 of cssurlrewrite.php has the following line:
fwrite($output, preg_replace_callback('/url(\s_'"['"]?\s_)/i', 'replace_css_url', $css));
unless I'm mistaken the line should be like this:
fwrite($output, preg_replace_callback('/url(\s_['"]?(.?)['"]?\s)/i', 'replace_css_url', $css));
I've added a '?' here: '/url(\s*['"]?

if not anything in the css that is:
url(path/to/img/img.ext)
will not work.

at least it didn't in my tests... the preg would not find them.

not sure what your 'i' does at the end of expression either. removing it didn't change any of my code.

@sergeychernyshev
Copy link
Owner

Yeah, it looks like it has a bug that misses the case when CSS doesn't have quotes around the URL (specifically, it requires first quote).

//i does case insensitive search so if you had URL('...') instead of url('...')

@sergeychernyshev
Copy link
Owner

Hope it fixed it in afc91d2

Please try again.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants