Edit report at http://bugs.php.net/bug.php?id=44889&edit=1
ID: 44889
Comment by: daniel at danielnorton dot com
Reported by: mikec at resnet dot net dot nz
Summary: T_OPEN_TAG doesn't match <?php without any trailing
characters
Status: Open
Type: Feature/Change Request
Package: Feature/Change Request
Operating System: *
PHP Version: 5.3CVS-2008-05-02 (snap)
Block user comment: N
New Comment:
The descriptions of the behavior is different from what I see. With
'short_open_tag' set to 'On', I get this error:
PHP Parse error: parse error in min.php on line 1
I get the same behavior when 'short_open_tag' is set to 'Off'.
PHP 5.3.0 (cli) (built: Jun 29 2009 21:25:23)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies
Previous Comments:
------------------------------------------------------------------------
[2008-05-02 07:29:57] mikec at resnet dot net dot nz
First Seen On:
PHP Version 5.2.5 on Fedora Core 6
Reproduced on (and actual/expected results from):
PHP 5.3.0-dev (cli) (built: May 2 2008 00:17:56)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2008 Zend Technologies
From snaps: php5.3-win32-200805020430.zip
Running on Windows Vista 32bit
------------------------------------------------------------------------
[2008-05-02 07:18:30] mikec at resnet dot net dot nz
Description:
------------
First noticed when including a file containing only "<?php", without a
trailing new line character. I expected this would output nothing, but
instead it outputted "<?php" to the browser.
This only occurs with 'short_open_tag' set to 'off', when set to 'on'
including the same file outputs nothing, as expected.
The tokenizer expects a character after the long open tag, I suggest
that this be extended to check for the end of the input too.
Reproduce code:
---------------
var_dump(ini_get('short_open_tag'));
print_r(token_get_all('<?php'));
print_r(token_get_all('<?'));
Expected result:
----------------
string(0) ""
Array
(
[0] => Array
(
[0] => 368
[1] => <?php
[2] => 1
)
)
Array
(
[0] => Array
(
[0] => 311
[1] => <?
[2] => 1
)
)
Actual result:
--------------
string(0) ""
Array
(
[0] => Array
(
[0] => 311
[1] => <?
[2] => 1
)
[1] => Array
(
[0] => 311
[1] => php
[2] => 1
)
)
Array
(
[0] => Array
(
[0] => 311
[1] => <?
[2] => 1
)
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=44889&edit=1