php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36087 file() cannot read rule with <?
Submitted: 2006-01-19 16:00 UTC Modified: 2006-01-19 16:09 UTC
From: bob at xbob dot nl Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 5.1.2 OS: linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bob at xbob dot nl
New email:
PHP Version: OS:

 

 [2006-01-19 16:00 UTC] bob at xbob dot nl
Description:
------------
when file() is reading a rule with '<?' in it, it will fail.
the next rule is in place of the '<?' rule and index key remains. The next rule's index is copmletly gone. see code example for more information.

Reproduce code:
---------------
--- file 1 --- class.A.php --- file to read ---
<?php
class A {
protected $var;
}
?>

--- file 2 --- run.php     --- file to run  ---
<?php
echo '<pre>';
var_dump(file('class.A.php'));
echo '</pre>';
?>

Expected result:
----------------
array(5) {
  [0]=>
  string(3) "<?
"
  [1]=>
  string(10) "class A {
"
  [2]=>
  string(16) "protected $var;
"
  [3]=>
  string(2) "}
"
  [4]=>
  string(2) "?>"
}

Actual result:
--------------
array(5) {
  [0]=>
  string(6) "
  string(10) "class A {
"
  [2]=>
  string(16) "protected $var;
"
  [3]=>
  string(2) "}
"
  [4]=>
  string(2) "?>"
}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-19 16:09 UTC] tony2001@php.net
Use "View source" to see what your script *really* produces.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 20 10:00:03 2025 UTC