Bug #71151 [Opn]: File which contains only "<?php" isn't interpreted

[email protected]
Newsgroups php.bugs
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=71151&edit=1

 ID:                 71151
 Updated by:         [email protected]
 Reported by:        daniel dot korner at tu-dortmund dot de
 Summary:            File which contains only "<?php" isn't interpreted
 Status:             Open
 Type:               Bug
 Package:            *General Issues
 Operating System:   Linux 4.2.5-1-Arch
 PHP Version:        7.0.1
 Block user comment: N
 Private report:     N

 New Comment:

The opening tag has always been defined as <?php<whitespace>
where <whitespace> is satisfied by space, tab, \r or \n
It was never just "<?php"
Whether or not <eof> should be considered whitespace seems like a rather philosophical issue rather than a bug.


Previous Comments:
------------------------------------------------------------------------
[2015-12-19 17:02:27] [email protected]

The reason you couldn't reproduce it on Linux is probably because it is a UNIX convention to treat newlines (aka LF or \n) as marking the end of a line, not separating lines, and so UNIX text editors tend to add a newline at the end of a file.

------------------------------------------------------------------------
[2015-12-19 16:46:12] [email protected]

Looks like this has been broken since 5.4: https://3v4l.org/kuLmD

------------------------------------------------------------------------
[2015-12-17 19:04:30] daniel dot korner at tu-dortmund dot de

Description:
------------
By accident I created a file that only contains "<?php". This file has no space, line break or other character following after the last "p". In this case, the php interpreter does not interpret the file and simply returns the string "<?php".

If I then add a space, line break or other whitespace character after the last "p", the interpreters starts to interpret the .php file correctly and returns an empty string.

I could reproduce this behaviour with PHP 7.0.0 and PHP 7.0.1 but not with PHP 5.6.16 on a Computer running Linux (4.2.5-1-ARCH  x86_64).



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=71151&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.