Bug #61336 [Opn]: file_get_contents() no longer returns false on 4xx responses

From: Date: Fri, 30 Mar 2012 16:39:42 +0000
Subject: Bug #61336 [Opn]: file_get_contents() no longer returns false on 4xx responses
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-169024@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=61336&edit=1

 ID:                 61336
 Updated by:         rasmus@php.net
 Reported by:        ramsey@php.net
 Summary:            file_get_contents() no longer returns false on 4xx
                     responses
 Status:             Open
 Type:               Bug
 Package:            Filesystem function related
 Operating System:   CentOS 6.2
 PHP Version:        5.4.0
 Block user comment: N
 Private report:     N

 New Comment:

Unable to reproduce this on any of my Ubuntu 11.10 or Centos machines. I have 
Centos in a VM, but not Virtualbox.

Perhaps you have some weird proxying going on? Break out tcpdump and see what is 
actually coming across the wire.


Previous Comments:
------------------------------------------------------------------------
[2012-03-30 06:29:59] ramsey@php.net

I've just done a clean install of Ubuntu 11.10 on VirtualBox and then built PHP 5.4 from the
PHP-5.4 branch. I am still encountering this problem.

As this point, the single commonality between environments is that I'm using VirtualBox. Could
this problem be a result of the way in which VirtualBox accesses the network?

------------------------------------------------------------------------
[2012-03-29 23:19:19] ramsey@php.net

I've just checked out the PHP-5.3 branch on the same environments and built it with exactly the
same config values as my 5.4 builds. php --version shows me this: PHP 5.3.11-dev (cli)
(built: Mar 29 2012 19:12:58)

It appears that I'm having the exact same problem with the latest checkout from PHP 5.3 in
these same two environments (Debian 6.0.4 and CentOS 6.2). Either I have a problem in both of these
environments, or the code that is broken in 5.4 has recently been merged to 5.3. Unfortunately,
others that I have asked to test this cannot reproduce it in their environments, so that points to a
problem with my environment. Any help identifying that problem is greatly appreciated. I have posted
detailed instructions on exactly what I have done to set up each environment.

------------------------------------------------------------------------
[2012-03-29 22:42:48] ramsey@php.net

On that same Debian 6.0.4 VM (using VirtualBox), I built PHP from the latest checkout of the PHP-5.4
branch. php --version gives me the following version line: PHP 5.4.1RC1-dev (cli)
(built: Mar 29 2012 18:34:37)

When I run my test script with this build of PHP, I am still having the same problem.

------------------------------------------------------------------------
[2012-03-13 20:24:57] ramsey@php.net

I've just tried this on a clean Debian 6.0.4 virtual machine, and I'm having the 
same problem there (I've tried even with ignore_errors set to false).

Here are the PHP build notes for my Debian installation: http://pastie.org/3588244

------------------------------------------------------------------------
[2012-03-13 15:20:20] ramsey@php.net

I'm still seeing the problem with ignore_errors set to false. See below for how 
I'm setting ignore_errors. For full details on how my environment is set up, you 
can refer to http://benramsey.com/blog/2012/03/build-php-54-on-centos-62/.


<?php

$context = stream_context_create(array(
    'http' => array(
        'ignore_errors' => false
    )
));

$response = 
file_get_contents('http://us3.php.net/manual/en/function.foobar.php',
false, 
$context);

var_dump($http_response_header);
var_dump($response);

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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=61336


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=61336&edit=1


Thread (20 messages)

« previous php.bugs (#169024) next »