derekr / php.sugar

Official Espresso php.sugar
69 stars 7 forks source link

<?php ?> tags not recognized in comments #6

Closed donut closed 15 years ago

donut commented 15 years ago

So, if one has the following the ?> tag is just seen as part of the comment:

<?php if (true) : //this never happens ?>
    echo "GOOMBA!";
<?php endif ?>

The first ?> is not recognized as being separate from the comment. This happens in comment blocks as well.

derekr commented 15 years ago

I tested this with comment blocks, but couldn't recreate the issue. Only when using the line // comment.

donut commented 15 years ago

Yeah, that's right. I was a bit confused when I tested it out. It's just the single-line comments that create this issue.

derekr commented 15 years ago

Are we sure it should be parsed like that? I have checked other editors and they comment out the ?> as well. It makes sense because // comments out the whole line.

donut commented 15 years ago

But PHP doesn't care that the whole line is commented out, it still reads the ?>. This is done all over the Wordpress default template. Block comments do effectively nullify any open/close tags within them, but line comments do not.