Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Some inital issues for me #44

Closed
Bornhall opened this Issue · 2 comments

2 participants

@Bornhall

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
Owner

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
@peteboere peteboere closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.