Home » File System » File » Bug #2810
Can not call readAll two times !
Details
| Submitted | 2004-11-22 21:44 UTC |
|---|---|
| From | webmaster at clublegendes dot com |
| Assigned | mike |
| Status | Closed |
| Package | File |
| PHP Version | 5.0.1 |
| OS | WinXP |
| Roadmaps | 1.3.0a1 |
Comments
[2004-11-22 21:44 UTC] webmaster at clublegendes dot com
Description:
------------
Bonjour,
I try to translate this bug.
Well, it is impossible to call staticly two times the method readAll :
If arguments are different, there is no bug.
But if the second call to method readAll has the same argument than the first call, readAll return NULL and doesn't return the file content.
I try it with Apache 1.3.31 and PHP 4.3.8 there is a bug.
I try it with Apache 2.0.50 and PHP 5.0.1 there is a bug too.
Reproduce code:
---------------
<pre><?php
//Version of File.php :
// Installed 1.0.3
// Latest 1.0.3
require_once 'File.php';
//toto contents : Bonjour de France!
$ls_file='toto.txt';
$ls_body = File::readAll($ls_file);
if (PEAR::isError($ls_body)){
//the script doesn't pass here
die ($ls_body->getMessage());
} else {
//Well that works and retrun : ---Bonjour de France!---
echo "\n--- $ls_body ---\n";
}
//BE carefull to view the bug : $ls_file DOESN'T CHANGE !
$ls_body = File::readAll($ls_file);
if (PEAR::isError($ls_body)){
//the script doesn't pass here
die ($ls_body->getMessage());
} else {
//THE BUG IS HERE !
//expected result : ---Bonjour de France!---
//but return "--- ---"
echo "\n--- $ls_body ---\n";
}
?></pre>