|  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: -
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
Have you experienced this issue?
Rate the importance of this bug to you:

 [2012-12-30 05:44 UTC] giorgio dot liscio at email dot it
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 

Some functions may be needed:


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


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!


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-12-31 09:53 UTC] giorgio dot liscio at email dot it
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 15 14:01:28 2024 UTC