Closed GoogleCodeExporter closed 9 years ago
Can you try 2.1.2beta? (upgrade is pretty simple)
http://groups.google.com/group/minify/browse_thread/thread/8add5761eb27d67d
With that in place (and FirePHP logging enabled) we can sprinkle in some
Minify::logError() in the CSS minifier and figure out what's going wrong.
Original comment by mrclay....@gmail.com
on 26 Jan 2009 at 9:43
Can you run test_environment.php directly to see if it gives more info?
Also, using the test_Minify_Cache_File.php from R283 (just committed) may make
your
cache file tests pass. It now uses the path you specify in /min/config.php.
Original comment by mrclay....@gmail.com
on 26 Jan 2009 at 10:11
Trying out 2.1.2beta - got the same results for the url listed above
****
/../images/fieldset-bg.gif
****
Results of test_environment:
PASS: environment : DOCUMENT_ROOT should not end in trailing slash (1 of 1
tests run
so far have passed)
PASS: environment : DOCUMENT_ROOT should be real path and contain this test
file (2
of 2 tests run so far have passed)
!FAIL: environment : PHP/server does not auto-HTTP-encode content (1 of 3 tests
run
so far have failed)
Returned content should be 6 bytes and not HTTP encoded.
Headers returned by:
http://berad-ols/min_unit_tests/test_environment.php?hello=1
array (
0 => 'HTTP/1.1 200 OK',
1 => 'Date: Mon, 26 Jan 2009 23:03:18 GMT',
2 => 'Server: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.4 with Suhosin-Patch',
3 => 'X-Powered-By: PHP/5.2.4-2ubuntu5.4',
4 => 'Vary: Accept-Encoding',
5 => 'Content-Encoding: gzip',
6 => 'Content-Length: 26',
7 => 'Connection: close',
8 => 'Content-Type: text/html',
)
I've got FirePHP all ready to go, let me know if you want me to run anything in
particular, I may dig in a little and see what I can find otherwise.
Original comment by bmhar...@gmail.com
on 26 Jan 2009 at 11:03
After some FirePHP debugging, it looks like its getting the extra "/" placed in
front
of it on lines 172-173 of CSS.php, which looks like will require some more
debugging
to see where in _urlCB its happening. Hopefully that helps somewhat.
Original comment by bmhar...@gmail.com
on 26 Jan 2009 at 11:46
Try this CSS.php. It'll generate 4 messages for each url. If you can't see
what's
going on, post em here and I'll walk through it.
Original comment by mrclay....@gmail.com
on 27 Jan 2009 at 12:59
Attachments:
I think I may see what the problem is. In my setup I have a symbolic link
called
"static" that goes to a different directory for shared css/js/images across
projects.
It looks to me like thats causing the issue around line 300 of the CSS.php patch you
attached as the DOCUMENT_ROOT is not the same as the path to the images in the
urls.
I'll think about this a bit, not sure if its possible to figure out the correct path
in this situation or not. This is definitely a corner case issue.
Here's the output from that:
Minify: $m = array ( 0 => 'url(../images/exclamation.png)', 1 =>
'../images/exclamation.png', )
Minify: self::$_tempCurrentDir = '/var/www/static/external/css'
Minify: realpath($_SERVER['DOCUMENT_ROOT']) = '/var/www/online_sales/public'
Minify: $url = '/../images/exclamation.png'
Minify: $m = array ( 0 =>
'url(/static/js/yui/datatable/assets/skins/sam/dt-arrow-up.png)', 1 =>
'/static/js/yui/datatable/assets/skins/sam/dt-arrow-up.png', )
Minify: self::$_tempCurrentDir = '/var/www/static/external/css'
Minify: realpath($_SERVER['DOCUMENT_ROOT']) = '/var/www/online_sales/public'
Minify: $url = '/static/js/yui/datatable/assets/skins/sam/dt-arrow-up.png'
Minify: $m = array ( 0 =>
'url(/static/js/yui/datatable/assets/skins/sam/dt-arrow-dn.png)', 1 =>
'/static/js/yui/datatable/assets/skins/sam/dt-arrow-dn.png', )
Minify: self::$_tempCurrentDir = '/var/www/static/external/css'
Minify: realpath($_SERVER['DOCUMENT_ROOT']) = '/var/www/online_sales/public'
Minify: $url = '/static/js/yui/datatable/assets/skins/sam/dt-arrow-dn.png'
Minify: $m = array ( 0 => 'url(../images/fieldset-bg.gif)', 1 =>
'../images/fieldset-bg.gif', )
Minify: self::$_tempCurrentDir = '/var/www/static/external/css'
Minify: realpath($_SERVER['DOCUMENT_ROOT']) = '/var/www/online_sales/public'
Minify: $url = '/../images/fieldset-bg.gif'
Minify: $m = array ( 0 => 'url(../images/fieldset-bg.gif)', 1 =>
'../images/fieldset-bg.gif', )
Minify: self::$_tempCurrentDir = '/var/www/static/external/css'
Minify: realpath($_SERVER['DOCUMENT_ROOT']) = '/var/www/online_sales/public'
Minify: $url = '/../images/fieldset-bg.gif'
Minify: $m = array ( 0 => 'url(../images/fieldset-bg.gif)', 1 =>
'../images/fieldset-bg.gif', )
Minify: self::$_tempCurrentDir = '/var/www/static/external/css'
Minify: realpath($_SERVER['DOCUMENT_ROOT']) = '/var/www/online_sales/public'
Minify: $url = '/../images/fieldset-bg.gif'
Minify: $m = array ( 0 => 'url(../images/input-bg.gif)', 1 =>
'../images/input-bg.gif', )
Minify: self::$_tempCurrentDir = '/var/www/static/external/css'
Minify: realpath($_SERVER['DOCUMENT_ROOT']) = '/var/www/online_sales/public'
Minify: $url = '/../images/input-bg.gif'
Minify: $m = array ( 0 => 'url(../images/exclamation.png)', 1 =>
'../images/exclamation.png', )
Minify: self::$_tempCurrentDir = '/var/www/static/external/css'
Minify: realpath($_SERVER['DOCUMENT_ROOT']) = '/var/www/online_sales/public'
Minify: $url = '/../images/exclamation.png'
Original comment by bmhar...@gmail.com
on 27 Jan 2009 at 3:13
I've tracked it down to the portion of code in the Files Controller (line 55),
where
is converts the DOCUMENT_ROOT based file path to the realpath. This sets up the
filepath to not use the symbolic link, which has the side effects we're seeing
in the
url rewrite process.
Changing that to not use realpath() and just using $file fixes the issue for
me, but
I can't say it doesn't cause other regression issues, I need to get all the
tests
passing locally for me before making the change to know if its causing real
failures.
Original comment by bmhar...@gmail.com
on 27 Jan 2009 at 3:45
Ok, this might be a workaround: Provide your own CSS minifier function that
sets/
resets the doc root (so it's the same as the CSS file while the rewriting takes
place).
// in config.php
function myCssMin($css, $options) {
require_once 'Minify/CSS.php';
$_SERVER['DOCUMENT_ROOT'] = '/var/www/static/external/css'; // may have to adjust
$css = Minify_CSS::minify($css, $options);
$_SERVER['DOCUMENT_ROOT'] = '/var/www/online_sales/public';
return $css;
}
$min_serveOptions['minifiers']['text/css'] = 'myCssMin';
...At some point I'm going to rewrite Minify_CSS to use Minify_CSS_UriRewriter,
which should make rewriting more flexible.
Original comment by mrclay....@gmail.com
on 27 Jan 2009 at 4:04
I'll look at doing something like that, but ultimately I'm wanting to
minfiy/combine
css files that are in the document_root, and some that are outside (under the
path of
the symbolic link), so I'm not sure this would handle that. Thanks for the
help and
time though, much appreciated!
Original comment by bmhar...@gmail.com
on 27 Jan 2009 at 4:22
Wrapping all the doc roots with realpath() solved issues for a lot of users,
but
I'll look into those and see if there would be a non-realpath fix.
I think without having some sort of manual config of symbolic links, this is
going
to be impossible to automate in the general case.
hmm...
$min_symlinks = array(
'/var/www/online_sales/public/css' => '/var/www/static/external/css'
);
Original comment by mrclay....@gmail.com
on 27 Jan 2009 at 7:59
[deleted comment]
what happen when I don't want to minify css just combine?
I don't see any uri rewrite happening...
Original comment by cri...@gmail.com
on 13 Mar 2009 at 1:02
@bmharris: Can you try the $min_symlinks option available in 2.1.2?
http://code.google.com/p/minify/source/browse/tags/release_2.1.2/min/config.php#
114
@crirus: See http://code.google.com/p/minify/wiki/UserGuide under "Custom
Functions". If you have problems with this, please post on the minify list or
open a
new issue if you think there is a bug.
Original comment by mrclay....@gmail.com
on 13 Mar 2009 at 5:22
Nice work, that did it for symlinks.
Original comment by bmhar...@gmail.com
on 18 Mar 2009 at 2:10
Original issue reported on code.google.com by
bmhar...@gmail.com
on 26 Jan 2009 at 9:16