From: Operating system: Linux PHP version: 5.3.8 Package: Streams related Bug Type: Bug Bug description:'http' 'ignore_errors' does not work
Description: ------------ file_get_contents() and such raises warnings in case of errors when using http stream context. I saw the https://bugs.php.net/bug.php?id=54898&edit=2 and yes, it works. But how I can achieve the adequate behavior when the remote works incorrectly? It will be very sad to change the PHP error reporting level even for this single case and it's hard to find out the problem from the script's code. Test script: --------------- <?php $url = "http://rest.ebay.com/epn/v1/find/item.rss?keyword=key&programid=1&campaignid=123456789&paymentMethod=PayPal&minBids=10&maxBids=20&condition1=New&exclSellerId1=1&exclSellerId2=2&exclSellerId3=Ð"; $options = array( 'http' => array( 'ignore_errors' => true, ) ); $context = stream_context_create($options); $xmlString = file_get_contents($url, false, $context); var_dump($xmlString); Expected result: ---------------- <Error>An internal error occurred while processing your request</Error> Actual result: -------------- PHP Warning: file_get_contents(http://rest.ebay.com/epn/v1/find/item.rss?keyword=key&programid=1&campaignid=123456789&paymentMethod=PayPal&minBids=10&maxBids=20&condition1=New&exclSellerId1=1&exclSellerId2=2&exclSellerId3=Ð): failed to open stream: HTTP request failed! in /home/stanis/Work/Fiord/phptest.php on line 43 bool(false) -- Edit bug report at https://bugs.php.net/bug.php?id=60446&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60446&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60446&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60446&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=60446&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60446&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=60446&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=60446&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=60446&r=needscript Try newer version: https://bugs.php.net/fix.php?id=60446&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=60446&r=support Expected behavior: https://bugs.php.net/fix.php?id=60446&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=60446&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=60446&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=60446&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60446&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=60446&r=dst IIS Stability: https://bugs.php.net/fix.php?id=60446&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=60446&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=60446&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=60446&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=60446&r=mysqlcfg