ID: 25977
Updated by: [email]sniperphp.net[/email]
Reported By: nightstorm at tlen dot pl
-Status: Open
+Status: Bogus
Bug Type: Filesystem function related
Operating System: Windows XP
PHP Version: 5CVS-2003-10-24 (dev)
New Comment:

fopen ('file', 'rb');



Previous Comments:
------------------------------------------------------------------------

[2003-10-24 12:52:44] nightstorm at tlen dot pl

Description:
------------
I tried to write something like a simple package system, which loads
the files into an array, serializes it, and compresses. But I noticed
that each file didn't have first 334 characters. I wrote a simple code
to check it and I stated this is a PHP bug. I experimented with many
variants - changing the way of loading (file_get_contents(), file()
etc.), using fseek($fp, 0, SEEK_SET); and also moving to the other
directory, or loading other files. There is the funniest part of this
story. I've got a template system, which loads templates also by
fopen(), but I noticed that these files are not cutted. I copied some
code from pr and set it to open a file in main project directory (
/ ) - it was cutted. Then i checked with files form /templates - these
aren't cutted. I checked phpBB 2 - also: files from /templates weren't
cutted, but from other directories, and the root - were. And only for
these files, which were created there. So if I copied any file from for
example root to /templates, it wouldn't work. I looked into "file
attributes" and everything was the same in each file: read only on,
archivization off, indexing on. I totally don't know, what's going on.
fseek($fp, 0, SEEK_SET); should set the beginning of the file, but it
is moving me into 334th character; fseek($fp, 1, SEEK_SET); works
correctly. rewind($fp) also doesn't work. ftell($fp); returns 0.

System:
Windows XP Pro, NTFS partition
Apache 2.0.4
PHP 5.0.0-dev latest snapshot

Reproduce code:
---------------
$f = fopen('../../engine/fws.php', 'r');
echo '<pre>';
while(!feof($f)){
echo fread($f, 256);
}
fclose($f);
echo '</pre>';


Expected result:
----------------
<?php
/*
************************************************** ***************************
* Fillar WebSystem 1.0.0
* ========================================
* Fillar Systems 2002/2003
* Site Engine/Discussion Board
************************************************** ***************************
*
* -> Main interface
* -> Written by Tomasz "Zyx" Jędrzejewski
* -> Date started: 1-7-2003
*
* -> Version: 1.0.0
************************************************** ***************************
*/
/************************************************** *************************
*
* This program is free software; you can redistribute it and/or
modify
* it under the terms of the GNU General Public License as published
by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*

************************************************** *************************/
.....

Actual result:
--------------
Main interface
* -> Written by Tomasz "Zyx" Jędrzejewski
* -> Date started: 1-7-2003
*
* -> Version: 1.0.0
************************************************** ***************************
*/
/************************************************** *************************
*
* This program is free software; you can redistribute it and/or
modify
* it under the terms of the GNU General Public License as published
by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*

************************************************** *************************/
....


------------------------------------------------------------------------


--
Edit this bug report at [url]http://bugs.php.net/?id=25977&edit=1[/url]