Bug #87058

Comment in sysext/form DatePicker ViewHelper causes errors if HTML is being minified

Added by Natalia Postnikova 6 months ago. Updated 2 months ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2018-12-03
Due date:
% Done:

0%

TYPO3 Version:
8
PHP Version:
7.1
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

DatePicker ViewHelper of the sysext/form Extension has a comment that starts with //. This comment generates an error if the HTML code of the page is minified. I have this issue in TYPO3 8.7. but the comment is still there in GitHub Master https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/form/Classes/ViewHelpers/Form/DatePickerViewHelper.php line 184

History

#1 Updated by Riccardo De Contardi 2 months ago

  • Status changed from New to Needs Feedback

@Natalia Postnikova

Sorry for this so late answer; I think you used a third-party extension to minify your HTML code. Could you tell us what extension did you use and the steps we should follow to reproduce your problem?

I tried with TYPO3 version 9.5.5 and the extension EXT:min version 1.7.0

1) create a form with only one field, type: "jQuery datepicker"
2) put the form on a page
3) install EXT:min
4) in TS Setup I wrote the same configuration of the extension's manual https://docs.typo3.org/typo3cms/extensions/min/#html-source-aka-tinysource:

plugin.tx_min.tinysource {
    enable = 1
    head {
        stripTabs = 1
        stripNewLines = 1
        stripDoubleSpaces = 1
        stripTwoLinesToOne = 1
        # Caution with this option! Indention sensitive code may break.
        stripSpacesBetweenTags = 0
    }
    body {
        stripComments = 1
        stripTabs = 1
        stripNewLines = 1
        stripDoubleSpaces = 1
        # Caution with this option! Indention sensitive code may break.
        stripSpacesBetweenTags = 0
        stripTwoLinesToOne = 0
        preventStripOfSearchComment = 1

        protectCode {
            10 = /(<textarea.*?>.*?<\/textarea>)/is
            20 = /(<pre.*?>.*?<\/pre>)/is
        }
    }
    oneLineMode = 1
}
</pre>

h3. Results

when viewing the page, the HTML source is minified, but AFAICS there is no error. Please could you add more detail? Thank you!

Also available in: Atom PDF