My PHP version:
$ php -v
PHP 5.3.6 (cli) (built: Mar 17 2011 20:56:13)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
The code in question:
$ echo -n "<?php" | php
<?php
Adding some more next to <?php
:
$ echo -n "<?php/**/" | php
<?php/**/
or
$ echo -n "<?php;" | php
<?php;
and then a space:
$ echo -n "<?php " | php
(finally empty output).
That PHP version is not giving me a Parse error: syntax error, unexpected $end
type of message for the examples above, but it does with this:
$ echo -n "<?php x" | php -d display_errors=1
Parse error: syntax error, unexpected $end in - on line 1
Hope it helps. In my eyes this looks like that the input is treated just as text until a whitespace follows up the <?php
opening sequence.