-
-
Notifications
You must be signed in to change notification settings - Fork 150
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
RuntimeException in version 1.6.x #123
Comments
Thanks for narrowing it down- honestly that is the hardest part of a lot of these bugs, just figuring out where it's breaking. Looking at the line in question I've got a good idea of what's happening, so once I'm done with work today I should be able to tackle it. |
Not sure if this helps (or if it's the same), but I was able to track down a similar exception with Failing test: public function testUnclosedRegexExceptionDoesNotHappenWithVariablesEndingWithG()
{
$this->expectNotToPerformAssertions();
\JShrink\Minifier::minify('var value = currentRating/other;');
} |
Test cases are always super super helpful! I normally put them directly into the test suite when I'm working on fixes. |
Yeah, I'd include it in a pull request normally, but haven't had a chance to dig into why this is happening. And then I saw an open PR and this issue, so wasn't sure if it's already mostly resolved 🙂 |
I think I'll be able to resolve it with about an hour of work, but unfortunately last night I had a migraine so I didn't have a chance. |
No worries at all! Thanks for looking into this as quickly as you are! |
I'm running into this issue as well. Maybe my reduced test case helps when trying to test it: <?php
require 'vendor/autoload.php';
// https://github.com/salesagility/SuiteCRM/blob/hotfix/themes/SuiteP/js/style.js#L183
var_dump(JShrink\Minifier::minify('if (spans[jj].className.match(/currentTab.*/)) {
tabNum = ii;
}')); Returns: I also tried to apply the fix from #124 but the issue remains the same. |
Actually noticed the above error is the error with the #124 applied. Here an example when I do it without #124 <?php
require 'vendor/autoload.php';
var_dump(JShrink\Minifier::minify('if(D>(F/2){console.log("a")}')); Works if I add spaces around the <?php
require 'vendor/autoload.php';
var_dump(JShrink\Minifier::minify('if(D>(F / 2){console.log("a")}')); Results in Hope this helps while debugging the issue. Downgrading to JShrink 1.5.0 for the meanwhile. |
A fix has been pushed up! I've incorporated all of the examples from this thread into the test suite as well to prevent future regressions. Thanks for everyone's help! |
Hello After using updated version number of issues is less but still exist (before hundreds, now few)! ex.
|
Please reopen |
@maciej-orba - check out the latest PR, #126, it should resolve this. I've included the jquery-ui test in the test suite itself to confirm that no errors are being triggered. |
I confirm, Static Content Deploy for Magento works fine, with no issues on latest JShrink
|
Thank you for confirming that- if you have any other issues please feel free to open up an issue here! |
Hello, I'm still using version 1.6.0 and PHP7, but Error: Unclosed regex pattern at position...still appear. because since 1.6.1 it dropped PHP 7 support. is there anyway to patch this error? I'm now downgrade to 1.5.0 Thank you |
I should have dropped php7 support in 1.6 but didn't as an error. You should lock to 1.5 or even 1.4 if you're having trouble and want to stay on the no longer supported php7. You should really upgrade to php8 though, as php7 isn't getting security updates anymore. |
I'm going to lock this topic for now- if people find their way here please just open up a new ticket with any issues you're having. |
Just updated to version 1.6.
Shrinking several libraries now breaks with
Error: Unclosed string at position:
orError: Unclosed regex pattern at position
.One example is jquery-ui.js (see https://pastebin.com/NwEXPtAb): breaks e.g. on line 12958
I added
$this->echo('|error|');
beforethrow new \RuntimeException('Unclosed regex pattern at position: ' . $this->index);
and removed the exception to get an idea where the error occurs. See https://pastebin.com/AX1XFgS3 (starts on line 1074).Thanks for help!
The text was updated successfully, but these errors were encountered: