richthegeek / phpsass

A compiler for SASS/SCSS written in PHP, brought up to date (approx 3.2) from a fork of PHamlP: http://code.google.com/p/phamlp/
http://phpsass.com/
382 stars 83 forks source link

Using image data URLs emits notices #64

Closed g105b closed 11 years ago

g105b commented 11 years ago

This is not related to SASS-specific syntax, as it is standard CSS functionality.

The following, simple CSS code to produce a speckled background on the body:

body {
    background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAAH5FsI7AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3AsYEAgl1K7FqgAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAABZQSURBVHjafZzZduS2DkUhanb+/0OdjqsklYb7UN70FuLcXiurO3aVRIIYDg4ANl9fX9dxHMGfpmniuq5omqb+rO/7KMdx1F/yw67rou/7uK4rSinxer2i8MumaWKapoiIaNu2/t22bTRNE2UYhtj3PYZhiPM8Y9u2aJomtm2LruvqU7t936Pruti2Lc7zrL/kw/wpfd/Htm0xjmNERHRdF/u+1800TfN+NWtZ1zU+Pj5iWZboui7O86yb7Ps+utfr9X50KbEsS7RtWz/EZtZ1jXKeZwzDEHyBpVzXVf8upUSzrut1nmddz7qu0fd9ffK+72/xfX5+XhERwzBU0fAlnh4RUfIP+BDLGYbh/cGu6+L1ekXTNDGOY30Sp7OuawzDEN1xHHGeZ/R9X/9+vV717Esp0TRNdOd5xjzPERHxer1i3/fIf9Z1fa8RMfCUpmnqFziZZlmWyxuJiBjHMbZtqxuJiOh4Ghu5riv2fa9PR+BlGIb6gWVZqmJYe7Zti84CHoahHt04jnEcR/1w8/X1dbVtW08FNeMQ+NlxHNUSns9ntG1bf36e5484efowDFXWGCWSeb1e0fd9LMtSf9f3/W2vVcmWZbmQFA/OB3ieZ7XPdV2rINEClHEcx/cD2UbTNFUDIiL2fa8P2rbtbbPfJooI1nWtanae59sC0W5O5DiOeL1eVaN40XEc9e+u62JZl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tvWPI9L3nYyXWSevFbRuF+MaA114VzN4AvIDQrkjk3BxoP6HnCyljS15Z59MKBwQwM7+dv31yWmz5RCt+y58htpGAMbJRxuxnbgyn2VZ51A7DmcR427otJ3R9twhTVtxnmvkObN5txRTDfwIdVELgMtvFfxqxmup12msX2XWMeJcnMULMsy5XpeLfW0jzkbMTFaF9H7N/5+i0PVHPKvo4wQ4ychfhqENrn3MPNs0n78r1hZl/sO3+7QxeMaMbFiMGXBE7T9KOBfNH3iAGO3eTti/V8rYgrbIYavt02N1B6NNq3ZDods6YZl3n0Ktc33LTuSRZPqJqg9Xow3XwXLpHe85C3S8V9427WmN/oKPdSE0zcn2yYwyEQpADlhhoucNuNWFvdmeW7i32FqdkhD5+S0VBtMwOeC/p5Bhml8MVh/PkfV8+wJaYmaTQAAAAASUVORK5CYII=);
}

When parsed using phpsass, it emits the following notices:

Notice: Undefined offset: 2 in script/SassScriptLexer.php on line 73
Notice: Undefined offset: 1 in script/SassScriptLexer.php on line 76
g105b commented 11 years ago

While notices can be ignored, the actual CSS functionality is broken (no background is actually assigned).

The parsed css output is the following:

body {
  background-image: ();
}
richthegeek commented 11 years ago

try wrapping the url in quotes?

background-image: url("data-image...");
g105b commented 11 years ago

I can confirm that quotes fixed this - should have tried myself really!