php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60253 readfile() fails and gives no error
Submitted: 2011-11-09 18:56 UTC Modified: 2011-11-10 18:47 UTC
From: dario at minttwist dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: Irrelevant 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: dario at minttwist dot com
New email:
PHP Version: OS:

 

 [2011-11-09 18:56 UTC] dario at minttwist dot com
Description:
------------
It seems like readfile() is failing without giving any error.

It apparently happens when you call readfile() several times in a short amount 
of time. It can also be because I'm trying to read a file which as just been 
saved in the filesystem.

In this case it's running on PHP 5.2.6 but it seems to be happening on other 
versions as well.

Configure command: './configure' '--enable-bcmath' '--enable-calendar' '--
enable-exif' '--enable-ftp' '--enable-gd-native-ttf' '--enable-libxml' '--
enable-magic-quotes' '--enable-mbstring' '--enable-sockets' '--with-
curl=/opt/curlssl/' '--with-curlwrappers' '--with-freetype-dir=/usr' '--with-gd' 
'--with-gettext' '--with-jpeg-dir=/usr' '--with-kerberos' '--with-libxml-
dir=/opt/xml2/' '--with-mcrypt=/opt/libmcrypt/' '--with-mysql=/usr' '--with-
mysqli' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-openssl=/usr' '--
with-openssl-dir=/usr' '--with-png-dir=/usr' '--with-ttf' '--with-xmlrpc' '--
with-xpm-dir=/usr/X11R6' '--with-xsl=/opt/xslt/' '--with-zlib' '--with-zlib-
dir=/usr' '--enable-soap' '--with-mssql=/usr' '--enable-pdo' '--with-pdo-mysql' 
'--with-imap=/usr/local/imap' '--enable-zip' '--with-ldap' '--with-tidy' '--
with-magickwand=/usr' '--with-mhash' '--with-pgsql' '--with-imap-ssl' '--with-
pdo-pgsql'



Test script:
---------------
Download source: http://www.mtcodelab.com/Development/PHP-bug/source.zip
See it in action: http://www.mtcodelab.com/Development/PHP-bug/

Expected result:
----------------
I expect to see 10 times the same image, always.

Actual result:
--------------
Sometimes some images containing "8: *,,,*" appear. If you don't see them, try 
refreshing. It shouldn't happen!

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-09 20:58 UTC] pierrick@php.net
-Status: Open +Status: No Feedback
 [2011-11-09 20:58 UTC] pierrick@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

It looks like you're using some rewrite rules in your reproduce script. Could you 
include them ?
 [2011-11-09 20:59 UTC] pierrick@php.net
-Status: No Feedback +Status: Feedback
 [2011-11-09 21:04 UTC] dario at minttwist dot com
What do you mean with include them? There is just one rule inside which is essential to 
reproduce the bug
 [2011-11-09 21:04 UTC] dario at minttwist dot com
-Status: Feedback +Status: Open -Operating System: +Operating System: Linux
 [2011-11-10 18:15 UTC] pierrick@php.net
Sorry I missed htaccess file.

The images containing "8: *,,,*" are there because the file exists but is empty. 
Since the file is empty readfile return an empty string and did not failed.
 [2011-11-10 18:15 UTC] pierrick@php.net
-Status: Open +Status: Bogus
 [2011-11-10 18:18 UTC] dario at minttwist dot com
Ok, makes perfect sense - so why are they empty just sometimes..? The file is 
always the same - or at least it's generated always following the same process.
 [2011-11-10 18:47 UTC] pierrick@php.net
Maybe some race conditions. One instance of your resize.php file is trying to 
read it while an other one is writing it.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 22:01:33 2024 UTC