From:             d dot reade at readesresidential dot com
Operating system: CentOS 5.3 x86
PHP version:      5.2.11
PHP Bug Type:     Filesystem function related
Bug description:  file_get_contents automatically including headers in output

Description:
------------
Since PHP 5.2.11 various scripts we use that utilise the file_get_contents
function have been including the file header info in the output. This
doesn't happen all the time, but it's happening enough to break our
scripts, as well as 3rd party scripts such as DOMPDF.

This appears to be happening with any file type and was first noticed
within minutes of installing PHP 5.2.11 today.

We operate another server running 5.2.10. This uses the exact same
configuration, extensions and web code, but has none of these problems.

Reproduce code:
---------------
<?
$file = file_get_contents('image.jpg');
file_put_contents('newimage.jpg', $file);
?>

Expected result:
----------------
newimage.jpg file containing exact contents of image.jpg

Actual result:
--------------
// start of newimage.jpg
HTTP/1.1 200 OK
Date: Sun, 20 Sep 2009 16:29:16 GMT
Server: Apache
Last-Modified: Sun, 20 Sep 2009 16:01:15 GMT
Accept-Ranges: bytes
Content-Length: 67648
Cache-Control: max-age=2592000
Expires: Tue, 20 Oct 2009 16:29:16 GMT
Connection: close
Content-Type: image/jpeg

���ï¿...@^pjfif^@^a...@^@^...@^a^@^...@��^@<CREATOR: gd-jpeg v1.0
(using IJG JPEG v62), quality = 100

// followed by the rest of the code...

-- 
Edit bug report at http://bugs.php.net/?id=49611&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=49611&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=49611&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=49611&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=49611&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=49611&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=49611&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=49611&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=49611&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=49611&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=49611&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=49611&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=49611&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=49611&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=49611&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=49611&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=49611&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=49611&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=49611&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=49611&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=49611&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=49611&r=mysqlcfg

Reply via email to