ID:               44889
 User updated by:  mikec at resnet dot net dot nz
 Reported By:      mikec at resnet dot net dot nz
 Status:           Open
 Bug Type:         Scripting Engine problem
 Operating System: Linux and Win32
 PHP Version:      5.3CVS-2008-05-02 (snap)
 New Comment:

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


Previous Comments:
------------------------------------------------------------------------

[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/?id=44889&edit=1

Reply via email to