php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30441 file_get_contents and fread don't read the wholle file
Submitted: 2004-10-15 08:35 UTC Modified: 2005-05-23 14:59 UTC
Votes:4
Avg. Score:4.5 ± 0.5
Reproduced:4 of 4 (100.0%)
Same Version:4 (100.0%)
Same OS:4 (100.0%)
From: christian at koch dot net Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 5.0.2 OS: Windows XP SP2
Private report: No CVE-ID: None
 [2004-10-15 08:35 UTC] christian at koch dot net
Description:
------------
<part of the file where problem occurs>

<meta name="ef-type" content="template">
<meta name="lower-file" content="<%ATTRIBUTE name="lower-file"%>">
<meta name="keywords" content="<%ATTRIBUTE name="keywords"%>,<%COMPONENT file="/templates/hallo.html"%>">
<meta name="edate" content="<%ATTRIBUTE name="edate"%>">

</part>

<result after file_get_contents()>

<meta name="ef-type" content="template">
<meta name="lower-file" content="<%ATTRIBUTE name="lower-file%>">
<meta name="keywords" content="<%ATTRIBUTE name="keywords%>,<%COMPONENT file="/templates/hallo.html"%>">
<meta name="edate" content="<%ATTRIBUTE name="edate%>">

</result>

I'm missings some (") if there are outer (") then the second inner (") is missing.

Christian

Reproduce code:
---------------
var_dump ( file_get_contents("<anyfilename>") );

Expected result:
----------------
if i read a file i think the file shoud be read completely :-)

Actual result:
--------------
s.o.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-21 23:22 UTC] wez@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.



 [2004-10-22 13:41 UTC] christian at koch dot net
read a file into a string, the string has a different content as the file. try this

<?php

var_dump(file_get_contents("testfile.txt"));

?>

where textfile.txt contains:

begin
<blafasel begin="<%testtag name="abc"%>" soso stop>
bla="fasel" begin="<%testtag name="abc"%>" soso stop
blafasel begin="<%testtag name="abc"%>" soso stop
blafasel begin="<%testtag name="abc"%>" soso stop
blafasel begin="<%testtag name="abc"%>" soso stop
blafasel begin="<%testtag name="abc"%>" soso stop

<meta name="ef-type" content="template">
<meta name="lower-file" content="<%ATTRIBUTE name="lower-file"%>">
<meta name="keywords" content="<%ATTRIBUTE name="keywords"%>,<%COMPONENT
file="/templates/hallo.html"%>">
<meta name="edate" content="<%ATTRIBUTE name="edate"%>">

blafasel begin="<%testtag name="abc"%>" soso stop
blafasel begin="<%testtag name="abc"%>" soso stop
end

the differences occurs at line 2(chr 37) and line 10(chr 62). both are " (doublequotes) the error occurs too if I use the fread() function.

Hope this is enough info

I've made an upgrade to 5.02. the still occurs

Christian
 [2004-10-22 13:46 UTC] christian at koch dot net
bug is still in 5.01 and 5.00
 [2004-10-22 13:54 UTC] tony2001@php.net
I can't reproduce it with PHP 5.1.0-dev, 5.0.3-dev and 4.3.10-dev.
Please, provide a downloadable example.
 [2005-05-23 14:59 UTC] sniper@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 12:01:27 2024 UTC