From:
Operating system: Windows XP
PHP version: 5.3.5
Package: Streams related
Bug Type: Bug
Bug description:file() fgets() fgetc() will read <?php but not save this
Description:
------------
If reading a file that contains "<?" this is ignored and any text
afterwards on that line is ignored.
<?php - does not read
<? php - does not read
<?<?
Even with extra spaces before the <? gets shifted to the next line.
The fgetc reads the line and can show the data but lines read with the
file() command ignores the line.
Test script:
---------------
Two files required: phpinfo2.php
<?php - does not read
phpinfo();
<?
< ?
<?php - does not read
<? php - does not read
?>
Second file: readFileViaPHP.php
<?
$lines = file('phpinfo2.php',FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES);
echo '<pre>';
print_r ($lines);
echo '</pre>';
echo '<br />' . "\n";
?>
Expected result:
----------------
You should see all records from phpinfo2.php
Array
(
[0] => <?php - does not read
[1] => phpinfo();
[2] => <?
[3] => < ?
[4] => <?php - does not read
[5] => <? php - does not read
[6] => ?>
)
Actual result:
--------------
Array
(
[0] => phpinfo();
[2] => < ?
[5] => ?>
)
--
Edit bug report at http://bugs.php.net/bug.php?id=53875&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=53875&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=53875&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=53875&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=53875&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=53875&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=53875&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=53875&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=53875&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=53875&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=53875&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=53875&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=53875&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=53875&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=53875&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53875&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53875&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=53875&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=53875&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=53875&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=53875&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=53875&r=mysqlcfg