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

"JIT stack limit exhausted" error encountered for certain styles #65

Open
trepmal opened this issue Oct 13, 2023 · 0 comments
Open

"JIT stack limit exhausted" error encountered for certain styles #65

trepmal opened this issue Oct 13, 2023 · 0 comments

Comments

@trepmal
Copy link

trepmal commented Oct 13, 2023

Here's my CSS, reduced/simplified from a real-world example: https://gist.github.com/trepmal/edf83dbd0d10b949b353c4b88fe20eea . The key elements being the selector with escaped characters, and a certain minimum amount of styles to follow.

When run through the minifier, nothing is returned:

use tubalmartin\CssMin\Minifier as CSSmin;

$css = file_get_contents( 'test.css' );

$minifier = new CSSmin;
$min = $minifier->run( $css );

// $min is empty

There "JIT stack limit exhausted" error comes from

// Process strings so their content doesn't get accidentally minified
$css = preg_replace_callback(
'/(?:"(?:[^\\\\"]|\\\\.|\\\\)*")|'."(?:'(?:[^\\\\']|\\\\.|\\\\)*')/S",
array($this, 'processStringsCallback'),
$css
);

Which can be tested directly:

$min_test = preg_replace_callback(
	'/(?:"(?:[^\\\\"]|\\\\.|\\\\)*")|'."(?:'(?:[^\\\\']|\\\\.|\\\\)*')/S",
	function($i) { return $i; },
	$css
);

if ( preg_last_error() ) {
	echo preg_last_error_msg() . PHP_EOL;
}
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

1 participant