Bug #60775 [Fbk->Csd]: file_get_contents does not return all content
| From: | tech163 at fusionswift dot com | Date: | Wed, 18 Jan 2012 03:43:51 +0000 |
| Subject: | Bug #60775 [Fbk->Csd]: file_get_contents does not return all content | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-166574@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60775&edit=1
ID: 60775
User updated by: tech163 at fusionswift dot com
Reported by: tech163 at fusionswift dot com
Summary: file_get_contents does not return all content
-Status: Feedback
+Status: Closed
Type: Bug
Package: Streams related
Operating System: CentOS 6.2
PHP Version: 5.3.9
Block user comment: N
Private report: N
New Comment:
Oops. Seemed to be a nginx proxy issue.
Previous Comments:
------------------------------------------------------------------------
[2012-01-17 16:49:37] mike@php.net
Look, how should I reproduce when this script only works on your server.
Please provide a self-contained reproduce case. Eventually check your server
config, too.
------------------------------------------------------------------------
[2012-01-17 13:02:38] tech163 at fusionswift dot com
<?php
<?php
$expires_offset = 31536000;
header('Content-Type: application/x-javascript; charset=UTF-8');
header('Vary: Accept-Encoding'); // Handle proxies
header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) .
'
GMT');
header("Cache-Control: public, max-age=$expires_offset");
echo file_get_contents('wp-includes/js/tinymce/wp-tinymce.js');
echo 'test';
?>
where the file, wp-includes/js/tinymce/wp-tinymce.js, contains
https://www.cheatswhiz.com/wp-includes/js/tinymce/wp-tinymce.js.
When that code
is excuted, only portions of https://www.cheatswhiz.com/wp-
includes/js/tinymce/wp-tinymce.js is read, Also, the echo 'test'; after the
file_get_contents is not executed.
------------------------------------------------------------------------
[2012-01-17 13:00:20] mike@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
------------------------------------------------------------------------
[2012-01-17 02:41:02] tech163 at fusionswift dot com
Description:
------------
This error began appearing a few days ago after I ran yum update, and recompiled
PHP, using
'./configure' '--prefix=/home/arch120113' '--with-config-file-
path=/home/arch120112/php' '--with-mysqli=mysqlnd' '--with-mysql=mysqlnd'
'--with-
pdo-mysql=mysqlnd' '--with-mysql-sock=/var/lib/mysql/mysql.sock'
'--enable-bcmath'
'--enable-calendar' '--enable-exif' '--enable-ftp'
'--enable-magic-quotes' '--
enable-mbstring' '--enable-sockets' '--with-bz2' '--with-curl'
'--with-gd' '--
enable-gd-native-ttf' '--with-jpeg-dir=/opt' '--with-png-dir=/opt'
'--with-
gettext' '--with-imap' '--with-imap-ssl' '--with-kerberos'
'--with-mcrypt' '--
with-openssl' '--with-zlib' '--enable-zip' '--enable-fpm'
'--with-freetype-
dir=/usr/include/freetype2/'
Now, when I use file_get_contents() on a large file (300KB), not the entire thing
appears.
Test script:
---------------
https://www.cheatswhiz.com/info.php
<?php
<?php
$expires_offset = 31536000;
header('Content-Type: application/x-javascript; charset=UTF-8');
header('Vary: Accept-Encoding'); // Handle proxies
header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) .
' GMT');
header("Cache-Control: public, max-age=$expires_offset");
echo file_get_contents('wp-includes/js/tinymce/wp-tinymce.js');
?>
File it's reading from is https://www.cheatswhiz.com/wp-includes/js/tinymce/wp-tinymce.js
Expected result:
----------------
The entire content of the file is read.
Actual result:
--------------
Only part of the content is read
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60775&edit=1