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

#!#protected_XXX#!# #3

Closed
plojewski opened this issue Mar 4, 2022 · 9 comments
Closed

#!#protected_XXX#!# #3

plojewski opened this issue Mar 4, 2022 · 9 comments
Labels
bug Something isn't working Support Helping people to work with EXT:min

Comments

@plojewski
Copy link

Hi, after upgrade to 2.0 there is "protected" instead of loading .js:
Zrzut ekranu 2022-03-4 o 14 28 46

@a-r-m-i-n a-r-m-i-n added the bug Something isn't working label Mar 7, 2022
@a-r-m-i-n
Copy link
Owner

Thanks for reporting, I will check this ASAP

@a-r-m-i-n
Copy link
Owner

I am sorry, but I'm unable to reconstruct this issue. Tested in TYPO3 11 with PHP 8 and TYPO3 10 with PHP 7.4.
Also with invalid regular expressions, I don't get your result.

Can you give me more info and dump your plugin.tx_min config?

@plojewski
Copy link
Author

plojewski commented Mar 7, 2022

@a-r-m-i-n Thanks for checking. I've tested on Typo3 10.4.16 / PHP 7.4 and additional config like this:

plugin.tx_min.tinysource {
    head {
        protectCode {
            10 = /(<script.*?>.*?<\/script>)/is
        }
    }
    body {
        protectCode {
            10 = /(<script.*?>.*?<\/script>)/is
        }
    }
}

@neonic
Copy link

neonic commented Mar 7, 2022

Hello,

we do have the same behavior. Textareas will be replaced with #!#protected_XXX#!#. The XXX is a hash and regenerates with every refresh.

We use the latest T3 10 LTS with PHP 7.4 and the following configuration:

plugin.tx_min.tinysource {
    enable = 1
    head {
        stripTabs = 1
        stripNewLines = 1
        stripDoubleSpaces = 1
        stripTwoLinesToOne = 1
        stripSpacesBetweenTags = 0
    }
    body {
        stripComments = 1
        stripTabs = 1
        stripNewLines = 1
        stripDoubleSpaces = 1
        stripSpacesBetweenTags = 0
        stripTwoLinesToOne = 0
        preventStripOfSearchComment = 1
        protectCode {
            10 = /(<textarea.*?>.*?<\/textarea>)/is
            20 = /(<pre.*?>.*?<\/pre>)/is
        }
    }
    oneLineMode = 1
}
config {
	compressCss = 1
	concatenateCss = 1
	compressJs = 1
	concatenateJs = 1
}

The static template of min 2.0.0 is not included.

@a-r-m-i-n
Copy link
Owner

Okay thanks. Locally I'm still not able to reconstruct this issue, but on my own website's dev environment, I was able to reconstruct.

I'm going to fix it as soon as possible.

@a-r-m-i-n
Copy link
Owner

Okay, I see the problem.
I've moved the "protectCode" to the root level of tinysource configuration. In your code, it is still located within head and body.

This was a major upgrade, which breaks old configurations, which is also well documented:
https://docs.typo3.org/p/t3/min/2.0/en-us/Configuration.html#html-source-compression

@a-r-m-i-n a-r-m-i-n added Support Helping people to work with EXT:min and removed bug Something isn't working labels Mar 8, 2022
@a-r-m-i-n a-r-m-i-n reopened this Mar 8, 2022
@a-r-m-i-n
Copy link
Owner

I reopen this issue, because I want to fix this behaviour.
If you provide inconsistent config, this should not be the result.

The reason why this is happening: At the place where the protection applies, the body version of protectCode is defined as fallback, in case the root version is missing.

But when restoring the protected code, this fallback is missing.

I'm going to replace the fallback at all. In worst case, you will get no protected textareas, then.

Also I want to improve documentation, when upgrading from v1.

@a-r-m-i-n a-r-m-i-n added the bug Something isn't working label Mar 8, 2022
@plojewski
Copy link
Author

Thank you!

@neonic
Copy link

neonic commented Mar 9, 2022

Thank you. With changing the configuration, min works like a charm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Support Helping people to work with EXT:min
Projects
None yet
Development

No branches or pull requests

3 participants