[PHP-BUG] Bug #61336 [NEW]: file_get_contents() no longer returns false on 4xx responses
From: ramsey Operating system: CentOS 6.2 PHP version: 5.4.0 Package: Filesystem function related Bug Type: Bug Bug description:file_get_contents() no longer returns false on 4xx responses Description: In PHP 5.3, file_get_contents() returns false on 4xx responses. In PHP 5.4, file_get_contents() is returning the actual response body, rather than false. Test script: --- http://us3.php.net/manual/en/function.foobar.php'); var_dump($http_response_header); var_dump($response); Expected result: With warnings turned on, this is what I get in PHP 5.3 and what I expect to see in PHP 5.4: PHP Warning: file_get_contents(http://us3.php.net/manual/en/function.foobar.php): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found in /Users/ramsey/Desktop/file_get_contents.php on line 3 PHP Stack trace: PHP 1. {main}() /Users/ramsey/Desktop/file_get_contents.php:0 PHP 2. file_get_contents() /Users/ramsey/Desktop/file_get_contents.php:3 array(11) { [0]=> string(22) "HTTP/1.0 404 Not Found" [1]=> string(35) "Date: Fri, 09 Mar 2012 21:57:32 GMT" [2]=> string(29) "Server: Apache/2.2.3 (CentOS)" [3]=> string(23) "X-Powered-By: PHP/5.3.2" [4]=> string(20) "Content-language: en" [5]=> string(88) "Set-Cookie: LAST_LANG=en; expires=Sat, 09-Mar-2013 21:57:32 GMT; path=/; domain=.php.net" [6]=> string(102) "Set-Cookie: COUNTRY=USA%2C64.2.187.194; expires=Fri, 16-Mar-2012 21:57:32 GMT; path=/; domain=.php.net" [7]=> string(21) "Status: 404 Not Found" [8]=> string(20) "Content-Length: 4219" [9]=> string(17) "Connection: close" [10]=> string(37) "Content-Type: text/html;charset=utf-8" } bool(false) Actual result: -- array(11) { [0]=> string(22) "HTTP/1.1 404 Not Found" [1]=> string(35) "Date: Fri, 09 Mar 2012 21:58:44 GMT" [2]=> string(29) "Server: Apache/2.2.3 (CentOS)" [3]=> string(23) "X-Powered-By: PHP/5.3.2" [4]=> string(20) "Content-language: en" [5]=> string(88) "Set-Cookie: LAST_LANG=en; expires=Sat, 09-Mar-2013 21:58:44 GMT; path=/; domain=.php.net" [6]=> string(102) "Set-Cookie: COUNTRY=USA%2C64.2.187.194; expires=Fri, 16-Mar-2012 21:58:44 GMT; path=/; domain=.php.net" [7]=> string(21) "Status: 404 Not Found" [8]=> string(20) "Content-Length: 4219" [9]=> string(17) "Connection: close" [10]=> string(37) "Content-Type: text/html;charset=utf-8" } string(4219) "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en"> PHP: 404 Not Found
Bug #61336 [Com]: file_get_contents() no longer returns false on 4xx responses
Edit report at https://bugs.php.net/bug.php?id=61336&edit=1 ID: 61336 Comment by: ram...@php.net Reported by: ram...@php.net Summary:file_get_contents() no longer returns false on 4xx responses Status: Feedback 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: 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/. 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); Previous Comments: [2012-03-10 14:21:41] cataphr...@php.net I can't reproduce this. Probably the default context has ignore_errors on. Verify that it doesn't and try to pass a context that has ignore_errors set to false. [2012-03-09 22:41:50] s...@php.net Just for the record, repro script works for me on Windows / 5.4.0 VC9 NTS -------- [2012-03-09 21:59:47] ram...@php.net Description: In PHP 5.3, file_get_contents() returns false on 4xx responses. In PHP 5.4, file_get_contents() is returning the actual response body, rather than false. Test script: --- http://us3.php.net/manual/en/function.foobar.php'); var_dump($http_response_header); var_dump($response); Expected result: With warnings turned on, this is what I get in PHP 5.3 and what I expect to see in PHP 5.4: PHP Warning: file_get_contents(http://us3.php.net/manual/en/function.foobar.php): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found in /Users/ramsey/Desktop/file_get_contents.php on line 3 PHP Stack trace: PHP 1. {main}() /Users/ramsey/Desktop/file_get_contents.php:0 PHP 2. file_get_contents() /Users/ramsey/Desktop/file_get_contents.php:3 array(11) { [0]=> string(22) "HTTP/1.0 404 Not Found" [1]=> string(35) "Date: Fri, 09 Mar 2012 21:57:32 GMT" [2]=> string(29) "Server: Apache/2.2.3 (CentOS)" [3]=> string(23) "X-Powered-By: PHP/5.3.2" [4]=> string(20) "Content-language: en" [5]=> string(88) "Set-Cookie: LAST_LANG=en; expires=Sat, 09-Mar-2013 21:57:32 GMT; path=/; domain=.php.net" [6]=> string(102) "Set-Cookie: COUNTRY=USA%2C64.2.187.194; expires=Fri, 16-Mar-2012 21:57:32 GMT; path=/; domain=.php.net" [7]=> string(21) "Status: 404 Not Found" [8]=> string(20) "Content-Length: 4219" [9]=> string(17) "Connection: close" [10]=> string(37) "Content-Type: text/html;charset=utf-8" } bool(false) Actual result: -- array(11) { [0]=> string(22) "HTTP/1.1 404 Not Found" [1]=> string(35) "Date: Fri, 09 Mar 2012 21:58:44 GMT" [2]=> string(29) "Server: Apache/2.2.3 (CentOS)" [3]=> string(23) "X-Powered-By: PHP/5.3.2" [4]=> string(20) "Content-language: en" [5]=> string(88) "Set-Cookie: LAST_LANG=en; expires=Sat, 09-Mar-2013 21:58:44 GMT; path=/; domain=.php.net" [6]=> string(102) "Set-Cookie: COUNTRY=USA%2C64.2.187.194; expires=Fri, 16-Mar-2012 21:58:44 GMT; path=/; domain=.php.net" [7]=> string(21) "Status: 404 Not Found" [8]=> string(20) "Content-Length: 4219" [9]=> string(17) "Connection: close" [10]=> string(37) "Content-Type: text/html;charset=utf-8" } string(4219) "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en"> PHP: 404 Not Found
Bug #61336 [Com]: file_get_contents() no longer returns false on 4xx responses
Edit report at https://bugs.php.net/bug.php?id=61336&edit=1 ID: 61336 Comment by: ram...@php.net Reported by: ram...@php.net Summary:file_get_contents() no longer returns false on 4xx responses Status: Feedback 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: 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 Previous Comments: [2012-03-13 15:20:20] ram...@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/. 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); [2012-03-10 14:21:41] cataphr...@php.net I can't reproduce this. Probably the default context has ignore_errors on. Verify that it doesn't and try to pass a context that has ignore_errors set to false. [2012-03-09 22:41:50] s...@php.net Just for the record, repro script works for me on Windows / 5.4.0 VC9 NTS -------- [2012-03-09 21:59:47] ram...@php.net Description: In PHP 5.3, file_get_contents() returns false on 4xx responses. In PHP 5.4, file_get_contents() is returning the actual response body, rather than false. Test script: --- http://us3.php.net/manual/en/function.foobar.php'); var_dump($http_response_header); var_dump($response); Expected result: With warnings turned on, this is what I get in PHP 5.3 and what I expect to see in PHP 5.4: PHP Warning: file_get_contents(http://us3.php.net/manual/en/function.foobar.php): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found in /Users/ramsey/Desktop/file_get_contents.php on line 3 PHP Stack trace: PHP 1. {main}() /Users/ramsey/Desktop/file_get_contents.php:0 PHP 2. file_get_contents() /Users/ramsey/Desktop/file_get_contents.php:3 array(11) { [0]=> string(22) "HTTP/1.0 404 Not Found" [1]=> string(35) "Date: Fri, 09 Mar 2012 21:57:32 GMT" [2]=> string(29) "Server: Apache/2.2.3 (CentOS)" [3]=> string(23) "X-Powered-By: PHP/5.3.2" [4]=> string(20) "Content-language: en" [5]=> string(88) "Set-Cookie: LAST_LANG=en; expires=Sat, 09-Mar-2013 21:57:32 GMT; path=/; domain=.php.net" [6]=> string(102) "Set-Cookie: COUNTRY=USA%2C64.2.187.194; expires=Fri, 16-Mar-2012 21:57:32 GMT; path=/; domain=.php.net" [7]=> string(21) "Status: 404 Not Found" [8]=> string(20) "Content-Length: 4219" [9]=> string(17) "Connection: close" [10]=> string(37) "Content-Type: text/html;charset=utf-8" } bool(false) Actual result: -- array(11) { [0]=> string(22) "HTTP/1.1 404 Not Found" [1]=> string(35) "Date: Fri, 09 Mar 2012 21:58:44 GMT" [2]=> string(29) "Server: Apache/2.2.3 (CentOS)" [3]=> string(23) "X-Powered-By: PHP/5.3.2" [4]=> string(20) "Content-language: en" [5]=> string(88) "Set-Cookie: LAST_LANG=en; expires=Sat, 09-Mar-2013 21:58:44 GMT; path=/; domain=.php.net" [6]=> string(102) "Set-Cookie: COUNTRY=USA%2C64.2.187.194; expires=Fri, 16-Mar-2012 21:58:44 GMT; path=/; domain=.php.net" [7]=> string(21) "Status: 404 Not Found" [8]=> string(20) "Content-Length: 4219" [9]=> string(17) "Connection: close" [10]=> string(37) "Content-Type: text/html;charset=utf-8" } string(4219) "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en"> PHP: 404 Not Found
#48837 [NEW]: Building --with-curlwrappers can cause bad/illegal format or missing URL errors
From: ram...@php.net Operating system: Ubuntu 9.04 PHP version: 5.3.0 PHP Bug Type: cURL related Bug description: Building --with-curlwrappers can cause bad/illegal format or missing URL errors Description: I received the error "URL using bad/illegal format or missing URL" on some require_once() calls when PHP was built with --with-curlwrappers. Building PHP without --with-curlwrappers fixed the problem. Reproduce code: --- I was using a vanilla install of Zend Framework when I noticed the problem. Expected result: The file did exist at the location being required, and the include_path was correct, so I expected the file to be required. Actual result: -- Warning: require_once(): URL using bad/illegal format or missing URL in /home/ramsey/dev/zftest/lib/Zend/Loader/PluginLoader.php on line 396 Warning: require_once(/home/ramsey/dev/zftest/lib/Zend/Loader/PluginLoader/Exception.php): failed to open stream: operation failed in /home/ramsey/dev/zftest/lib/Zend/Loader/PluginLoader.php on line 396 Fatal error: require_once(): Failed opening required 'Zend/Loader/PluginLoader/Exception.php' (include_path='/home/ramsey/dev/zftest/lib') in /home/ramsey/dev/zftest/lib/Zend/Loader/PluginLoader.php on line 396 -- Edit bug report at http://bugs.php.net/?id=48837&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48837&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48837&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48837&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48837&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48837&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48837&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48837&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48837&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48837&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48837&r=support Expected behavior: http://bugs.php.net/fix.php?id=48837&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48837&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48837&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48837&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48837&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=48837&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48837&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48837&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48837&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48837&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48837&r=mysqlcfg
#49242 [NEW]: Expose function in Zend API for comparing arrays by identity
From: ram...@php.net Operating system: n/a PHP version: 5.3SVN-2009-08-13 (SVN) PHP Bug Type: Feature/Change Request Bug description: Expose function in Zend API for comparing arrays by identity Description: I'm using the embed SAPI, and I came across an issue when using zend_hash_compare(). I wanted to use the provided hash_zval_compare_function() as the callback function for the compar parameter. However, I cannot use this, since it is not exposed. I could use zend_compare_arrays(), but it doesn't allow me to pass in a 1 as the value of the ordered parameter sent to zend_hash_compare(). Since I want to compare arrays like comparing with the identity operator, then I need to use zend_hash_compare() and create my own callback that does exactly what hash_zval_compare_function() does, thus reinventing the wheel. Either: 1) Expose hash_zval_compare_function() so it can be used by third-party apps - or - 2) Make a second version of zend_compare_arrays() that allows you to compare arrays by identity (i.e. zend_compare_arrays_identity()?) -- Edit bug report at http://bugs.php.net/?id=49242&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49242&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49242&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49242&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49242&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49242&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49242&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49242&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49242&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49242&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49242&r=support Expected behavior: http://bugs.php.net/fix.php?id=49242&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49242&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49242&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49242&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49242&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=49242&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49242&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49242&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49242&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49242&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49242&r=mysqlcfg