I guess not but just checking.
I've already got a try...catch for this but it doesn't handle it.
I'd like to catch this:
PHP Fatal error: Maximum execution time of 15 seconds exceeded in.....
I guess not but just checking.
I've already got a try...catch for this but it doesn't handle it.
I'd like to catch this:
PHP Fatal error: Maximum execution time of 15 seconds exceeded in.....
I found this script.
It tells where an error was happening.
Put it in beginning of php pages.
I have put it inside a 'common.php'
which I include in all pages:
include 'common.php'
Here is the code I have to give error information:
<?php
function exception_error_handler($errno, $errstr, $errfile, $errline ) {
echo '<pre>';
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
echo '</pre>';
}
set_error_handler("exception_error_handler");
I put that in as a test and now get this:
PHP Fatal error: Uncaught exception 'ErrorException' with message 'Non-static method clsCheckUser::CheckUser() should not be called statically
Strange. The method works fine. Why would a method "should not be called statically'? What determines that?
If the method is only loosely defined in scope it causes this error.
Basically you probably have this code:
class clsCheckUser
{
function CheckUser()
{
// do something to check the user
return true;
}
}
THen you use this methodology to call the CheckUser method:
clsCheckUser::CheckUser()
The error is saying that you haven't defined precisely how one is to access this method, and therefore it shouldn't be accessed statically. While it does work (since it does for backward compatibility), it's not "correct". You should be scoping your methods and properties:
class clsCheckUser
{
static function CheckUser()
{
// do something
return true;
}
}
Hope that helps.
What determines it is the [man]static[/man] keyword.
EDIT: bpat beat me to it. :p
bpat1434;10941951 wrote:If the method is only loosely defined in scope it causes this error.
Basically you probably have this code:
class clsCheckUser { function CheckUser() { // do something to check the user return true; } }
THen you use this methodology to call the CheckUser method:
clsCheckUser::CheckUser()
The error is saying that you haven't defined precisely how one is to access this method, and therefore it shouldn't be accessed statically. While it does work (since it does for backward compatibility), it's not "correct". You should be scoping your methods and properties:
class clsCheckUser { static function CheckUser() { // do something return true; } }
Hope that helps.
Yes, that is helpful. I thought the error meant something like that so I put the word static in front of "class" which of course didn't work. Thanks.