html in php escaped with \ interpreted incorrectly
Posted: Fri Mar 02, 2018 10:43 am
Do anyone reading this , the Batch Wizard is a really easy way to check some php files. This php line
echo '<p style=\'padding-left: 15px; font-weight:bold;color:red;\'>'. __FUNCTION__.'</p>'. "\n";
and
echo '<p style=\"padding-left:15px;font-weight:bold;color:red;\">' . __FUNCTION__ . '</p>' . "\n";
generate error messages like
The value for the "style" attribute appears to use one or more invalid quotation characters. To quote attribute values, use only the U+0022 quotation mark (") or U+0027 apostrophe (') characters. Do not use accents or left or right quotation mark characters like U+2018 (‘), U+2019 (’), U+201C (“), or U+201D (”).
The attribute value "\'padding-left:" for the "style" attribute is not in single or double quotation marks when it must be. In HTML5, attribute values containing literal spaces, quotes (" or '), equal signs (=), less-than signs (<), greater-than signs (>), or grave accents (`) must be quoted. Empty strings must also be quoted. In XHTML/XML, attribute values must always be quoted. Quoting values is recommended, even if it's not technically required.
Its not very good style, but it works fine. PS I check the lines in hex to make sure I did not have any funny utf-8 in it
php file attached with a zip extension.
echo '<p style=\'padding-left: 15px; font-weight:bold;color:red;\'>'. __FUNCTION__.'</p>'. "\n";
and
echo '<p style=\"padding-left:15px;font-weight:bold;color:red;\">' . __FUNCTION__ . '</p>' . "\n";
generate error messages like
The value for the "style" attribute appears to use one or more invalid quotation characters. To quote attribute values, use only the U+0022 quotation mark (") or U+0027 apostrophe (') characters. Do not use accents or left or right quotation mark characters like U+2018 (‘), U+2019 (’), U+201C (“), or U+201D (”).
The attribute value "\'padding-left:" for the "style" attribute is not in single or double quotation marks when it must be. In HTML5, attribute values containing literal spaces, quotes (" or '), equal signs (=), less-than signs (<), greater-than signs (>), or grave accents (`) must be quoted. Empty strings must also be quoted. In XHTML/XML, attribute values must always be quoted. Quoting values is recommended, even if it's not technically required.
Its not very good style, but it works fine. PS I check the lines in hex to make sure I did not have any funny utf-8 in it
php file attached with a zip extension.