[php-src] Issue #7993: php open/close tags igored within C-style comments
| From: | Daniel-Peder | Date: | Sun, 23 Jan 2022 15:01:07 +0000 |
| Subject: | [php-src] Issue #7993: php open/close tags igored within C-style comments | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-239248@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7993
Author: Daniel-Peder
### Description
[The following code:
```php
<?php
echo (ob_start()?'':'')
.
/*
?>
hello world
<?php
*/
ob_get_clean()
,
PHP_EOL
;
```
Resulted in this output:
```
```
But I expected this output instead:
```
hello world
```
](https://3v4l.org/OkFOE)
The open/close tags <?php ... ?> should have precedence over the comments or at least, it
should be better described in manual page.
According to the [php tags manual
page](https://www.php.net/manual/en/language.basic-syntax.phptags.php), telling:
> When PHP parses a file, it looks for opening and closing tags, which are <?php and ?>
> which tell PHP to start and stop interpreting the code between them.
PHP does not obey this rule, as it rather considers the text between tags as part of comment, which
is, however, rather part of interpreted php code instead of part of not interpreted text.
### PHP Version
ALL
### Operating System
_No response_