|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #78394 PHP Fatal Error
Submitted: 2019-08-09 15:17 UTC Modified: 2019-08-10 09:17 UTC
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: auth1299 at yahoo dot com Assigned: cmb (profile)
Status: Not a bug Package: oauth (PECL)
PHP Version: 7.1.31 OS: windows
Private report: No CVE-ID: None
 [2019-08-09 15:17 UTC] auth1299 at yahoo dot com

The fetch() method will cause a PHP Fatal Error if the returned http status code is in the 4xx or 5xx range. This causes the entire script to hault. I should be able to continue with the script and process as necessary. This is a deal breaker because I have other API queries to run even if one returns a 500 or 401 error. 

The error should not be PHP Fatal Error and instead should just be a PHP Warning.

EXAMPLE of the Error:
[09-Aug-2019 10:49:21 America/New_York] PHP Fatal error:  Uncaught Error: Cannot use object of type OAuthException as array in C:\inetpub\wwwroot\cron-job\functions.php:785
Stack trace:
#0 C:\inetpub\wwwroot\cron-job\cron_order_management.php(104): ally_api_request(Array, Array, 'https://api.tra...', 'GET', '....')
#1 {main}
  thrown in C:\inetpub\wwwroot\cron-job\functions.php on line 785

Test script:
try {
catch(OAuthException $e) {

Expected result:
I should a most get a PHP warning and not a PHP Fatal Error.

Actual result:
I get a PHP Fatal Error and all my processing stops.  :(


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-08-09 22:24 UTC] auth1299 at yahoo dot com
I wanted to add a use case: 

I'm processing hundreds of api calls with different accounts. Sometimes if the account is deleted from the remote side I may get a 401 or 404. If I have an account with a wrong ID I get a 500. I still need to process all the records even though some API urls fail. 

With a PHP fatal error the script stops and nothing after that point gets processed.
 [2019-08-10 09:17 UTC]
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2019-08-10 09:17 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon May 29 20:03:40 2023 UTC