Edit report at https://bugs.php.net/bug.php?id=63875&edit=1

 ID:                 63875
 Comment by:         giorgio dot liscio at email dot it
 Reported by:        giorgio dot liscio at email dot it
 Summary:            provide a way to handle "in Unknown on line 0"
                     errors
 Status:             Open
 Type:               Bug
 Package:            *General Issues
 Operating System:   any
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

http://stackoverflow.com/questions/11738949
http://stackoverflow.com/questions/2133652


Previous Comments:
------------------------------------------------------------------------
[2012-12-30 05:44:55] 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!






------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=63875&edit=1

Reply via email to