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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Wed May 15 07:01:32 2024 UTC