drupal_build_css_cache() cannot deal with a url() statement not surrounded by spaces.

dalin - December 29, 2008 - 11:28
Project:Drupal
Version:6.x-dev
Component:base system
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

drupal_build_css_cache() attempts to resolve paths to background images with this statement:

<?php
$data
.= preg_replace_callback('/url\([\'"]?(?![a-z]+:|\/+)([^\'")]+)[\'"]?\)/i', '_drupal_build_css_path', $contents);
?>

This works fine for a shorthand background CSS statement like:
background: #00B1D4 url(some/path.jpg) no-repeat;
But not with the following (The match sent into _drupal_build_css_path() is something real ugly):
background-image:url(some/path.jpg);
To make it work you need to enclose url() in spaces:
background-image: url(some/path.jpg) ;

I don't have the regex chops to be able to know what's going on or how to fix it.

 
 

Drupal is a registered trademark of Dries Buytaert.