php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63875 provide a way to handle "in Unknown on line 0" errors
Submitted: 2012-12-30 05:44 UTC Modified: -
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: giorgio dot liscio at email dot it Assigned:
Status: Open Package: *General Issues
PHP Version: Irrelevant OS: any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: giorgio dot liscio at email dot it
New email:
PHP Version: OS:

 

 [2012-12-30 05:44 UTC] giorgio dot liscio at email dot it
Description:
------------
please read carefully! I really think this is important

when an error happens before the actual script execution (main(), "unknown on line 0") it is not possible to handle and gracefully display the 
error in the user space

errors may be: "post content-length exceeded", "file upload size exceeded", "max input time"... or the equivalent apache errors 
(LimitRequestBody for instance)

note that I'm not sure, or I don't remember, what exactly happens when some of these errors happen, but --some of them don't block the php's 
execution--, like "post_max_size". But when the php's execution isn't blocked I should be able to handle startup errors: nowadays I can't.

for example, a big file is uploaded on the server and the post data is limited by some of the above.

now, the php page executes anyway because the "startup warning" doesn't block the execution. But, as I said, in the user space, there is no way 
what exactly happened and what caused the error, the only way to handle this is (I suppose) parsing error_get_last().

when the big file is sent to the server i may not have the complete form data and in the user space I can't get the proof that is complete.

the only thing i can do is if(error_get_last()) throw new Exception("Something went wrong with your request (???)");

then something must be done here to fix this problem. I don't have the complete view of the problem but I hope to have been clear so you can fix 
this.

Some functions may be needed:

get_startup_errors();

that returns something like this:

    [0][message] => Post content data limit excedeed ...
    [0][startupErrType] => STARTUP_ERR_PARTIAL_POST

    [1][message] => Module 'ssh2' blah blah blah
    [1][startupErrType] => STARTUP_ERR_SERVER

    [2]...


where startupErrType consists in constants like these:

STARTUP_ERR_PARTIAL_POST          // partial data sent
STARTUP_ERR_EXCEDEED_INPUT_TIME   // excedeed input time
STARTUP_ERR_EXTENSION             // an extension caused the error
STARTUP_ERR_SERVER                // server caused the startup error


I hope to have been clear, my English isn't good.

have a happy new year!





Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-12-31 09:53 UTC] giorgio dot liscio at email dot it
http://stackoverflow.com/questions/11738949
http://stackoverflow.com/questions/2133652
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Nov 12 05:01:32 2019 UTC