peteboere / css-crush

CSS preprocessor.
http://the-echoplex.net/csscrush
MIT License
537 stars 51 forks source link

Some inital issues for me #44

Closed Bornhall closed 11 years ago

Bornhall commented 11 years ago

I'm currently analyzing CssCrush and in implementing it into an existing project, I've encountered a few initial issues:

  1. Running PHP 5.2.0, I got errors from io.php:write(), file_put_contents (at line 251). The $stream variable was complained about not being string or array. I know 5.2.0 isn't immediately supported by CssCrush, but simply doing "".$stream, it is forced into a string and all seems well.
  2. For various reasons, the old IIS test server (hence PHP 5.2.0) we keep around, points to another server, i.e. $_SERVER['SCRIPT_FILENAME'] begins with \{ip-address}{path}, which won't work when you replace all back- and forward slashes (single and double) with forward slash. I rewrote code in Core.php:setDocRoot() and Util.php:normalizePath() to leave initial \ alone, and all seems well so far.
  3. Related to the above, in Core.php:setDocRoot() you compare the paths (line 114 or so) of SCRIPT_NAME and SCRIPT_FILENAME, to set doc root. In my case the paths are not very similar at all, especially since the scripts actually reside on another server, and a different path from the sub-path (virtual directory) specified in IIS. For example: SCRIPT_NAME = /virtual1234/file.php SCRIPT_FILENAME = \192.168.0.1\www\virtual\file.php I think you can see what I'm getting at here; these paths will never match, and CssCrush will fall back to using $_SERVER['DOCUMENT_ROOT'].
  4. Which leads me to the next issue; DOCUMENT_ROOT is not set on our old IIS server (5.1), hence PHP throws a Notice that may be displayed on screen if Notices are shown (shouldn't be, but hey). A more robust solution would be to check with isset() if it is actually set or not. As it is now, it throws a Notice and realpath() defaults to current directory – which is not really a good way and hides a potentially wrong root directory. It is, for me, seemingly usable like that, but should be investigated.

This was just what I encountered while trying to include it and process an existing css file, I haven't even started using any CssCrush features yet :)

Hope this helps!

.p

peteboere commented 11 years ago

Thanks for taking the time to report these issues in detail.

Unfortunately I can't make any promises about fixing these since 5.2.0 is an early release for an end of life version of PHP. From my experience early point versions of PHP are usually a bit buggy (there is an issue for this project recorded against PHP 5.3.0, also status 'wont fix').

It's a small team working on this project; basically just me working in my free time with the occasional input from Github users like yourself so scope for supporting un-common versions is just not feasible.

The project is tested in a recent 5.2.x version, and in recent IIS, so if you can upgrade I expect it would probably cover all the issues you've encountered.

Bornhall commented 11 years ago

Hi,

Most likely it works flawless on later versions, and you may already be aware of these things, but I thought why not – if no one comes in with bug reports, development stalls :)

As for the issue with \ in the beginning of the real path, I think that might fall outside of the "too-old-php-version", but I'm well aware it's an edge case anyway :)

Will keep investigating CssCrush further, but not until sometime next week ;D

.p

On Fri, Feb 15, 2013 at 2:27 PM, Pete Boere notifications@github.comwrote:

Thanks for taking the time to report these issues in detail.

Unfortunately I can't make any promises about fixing these since 5.2.0 is an early release for an end of life version of PHP. From my experience early point versions of PHP are usually a bit buggy (there is an issue for this project recorded against PHP 5.3.0, also status 'wont fix').

It's a small team working on this project; basically just me working in my free time with the occasional input from Github users like yourself so scope for supporting un-common versions is just not feasible.

The project is tested in a recent 5.2.x version, and in recent IIS, so if you can upgrade I expect it would probably cover all the issues you've encountered.

— Reply to this email directly or view it on GitHubhttps://github.com/peteboere/css-crush/issues/44#issuecomment-13606363.