Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twitter bootstrap #4

Closed
zeleznypa opened this issue Jun 20, 2012 · 15 comments
Closed

Twitter bootstrap #4

zeleznypa opened this issue Jun 20, 2012 · 15 comments

Comments

@zeleznypa
Copy link

We have problem with compressing bootstrap.css
There is an error somewhere over:
$css = preg_replace_callback('/(?:^|})(?:(?:[^{:])+:)+(?:[^{]*{)/', array($this, 'replace_colon'), $css);
$css = preg_replace('/\s+([!{};:>+()]~=,])/', '$1', $css);
$css = preg_replace('/' . self::CLASSCOLON . '/', ':', $css);

@tubalmartin
Copy link
Owner

What's the issue? Please provide more details.

I've compressed successfully Bootstrap 2.0.4 using the compressor my company hosts here: http://www.margenn.com/csscompressor

Try it if you want.

@zeleznypa
Copy link
Author

It is very strange, because same css file work well on your site, but on my computer (Windows, Apache, Php 5.3) cause issue "Error 101(net::ERR_CONNECTION_RESET): Connection reset".

I found that there is a problem with calling this "$css = preg_replace_callback('/(?:^|})(?:(?:[^{:])+:)+(?:[^{]*{)/', array($this, 'replace_colon'), $css);" on bootstrap.css

I don't know why. There is no error message, no log nothing just this.

@tubalmartin
Copy link
Owner

Ummm, if you Google "Error 101(net::ERR_CONNECTION_RESET): Connection reset" you'll see there are many people who had that issue.

Are you using a database connection (MySQL) when the compressor runs? check this out: http://serverfault.com/questions/74313/what-could-cause-an-101-error-in-wamp-under-windows-7

As a side note: Windows + Apache = issues!

@zeleznypa
Copy link
Author

After more than hour of browsing and searching I found this: http://stackoverflow.com/questions/7620910/regexp-in-preg-match-function-returning-browser-error

Problem was somewhere else. Sorry for my false

@zeleznypa zeleznypa reopened this Jul 29, 2012
@zeleznypa
Copy link
Author

I have to investigate this problem more.

On my developper station (Windows XP, Php 5.3.14, Apache/2.2.22) I still have an issue "Error 101(net::ERR_CONNECTION_RESET): Connection reset". After some investigating I found that core of the problem is in pcre.recursion_limit parameter in php.ini.

After that I found, that CssMin set this value itself. When I call CssMin with FALSE value of constructor parametter $raise_php_limits, Problem with error 101 disappear.!!!!

Unfortunetly, there is another issue. CssMinificator completly delete content of first chunk of twitter bootstrap.css
Code disappear right in the part I paste in first comment.

@mrclay
Copy link

mrclay commented Nov 23, 2012

So not increasing PCRE limits can cause crashes, and raising PCRE limits via ini_set can cause crashes! I love PCRE.

@tubalmartin
Copy link
Owner

Try lowering the chunk length to 10.000 chars or even less until it doesn't break. Default is 25.000 chars

$css_chunk_length = 25000; // aprox size, not exact

@tubalmartin
Copy link
Owner

Hi mikeytown2,

I can't find any issues with your code. I've compressed it successfully several times using the gui: http://www.margenn.com/csscompressor

@mikeytown2
Copy link

Tested on a windows box. I've played around with the PCRE limits and chunk length and it still dies with no error in the php error log; xdebug output is incomplete. I guess I'll make that code conditional; only run if not windows. http://stackoverflow.com/questions/5879043/php-script-detect-whether-running-under-linux-or-windows

@tubalmartin
Copy link
Owner

I don't have a Windows environment to test this but google a bit and you'll find many topics discussing issues with Windows + Apache/mod_php and PCRE limits such as this one: http://stackoverflow.com/questions/3457039/apache-php-on-windows-crashes-with-regular-expression which suggests it maybe a bug with the PHP version/compilation used.

My suggestion: Don't use Windows if possible, upgrade Apache and PHP to the latest stable release.

I'm closing this issue.

@alexweber
Copy link

Apologies for re-opening this but I'v having the exact same issue on OSX + MAMP and extending the check on line 290 to ignore "DAR" as well (OSX == Darwin apparently) fixes it for me...

@mrclay
Copy link

mrclay commented Nov 12, 2013

FYI I'm seeing people have more of these crashes with Bootstrap 3's CSS file. I have a section on this wiki page, is there anything you would add?
https://code.google.com/p/minify/wiki/CommonProblems

@tubalmartin
Copy link
Owner

I'll give the bootstrap 3 a try with the compressor and report back ;)

@tubalmartin
Copy link
Owner

I've just released version 2.4.8-2. I've reduced the chunk length by 5x so it's now 5.000 chars. Most PCRE issues should be gone. Give it a go!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants