html-minifier icon indicating copy to clipboard operation
html-minifier copied to clipboard

PHP breaks when "?>" exist in string(s) or comment(s)

Open millennIumAMbiguity opened this issue 2 years ago • 0 comments

When ?> exist in a comment or string, the PHP breaks.

The expected result should be the same as the input.

Before:

<?php

//this does not get formatted.

define("cars", [
  "Alfa Romeo",
  "BMW", //this "?>" will break the PHP. 
  "Toyota"
]);

//this get formatted. <h1 class="">

echo cars[0];

?>

After:

<?php

//this does not get formatted.

define("cars", [
  "Alfa Romeo",
  "BMW", //this "?>" will break the PHP. "Toyota" ]); //this get formatted.<h1>echo cars[0]; ?>

millennIumAMbiguity avatar Mar 28 '22 09:03 millennIumAMbiguity