PHP Error Handling
Expired
Thread created 02-19-2013 by kakomu
0 Score
26 Replies
1,686 Views
I finally had the time to look through the links you posted plus another link I posted earlier about handling warnings.
I copied/pasted some basic error handling functions that halt the program...
PHP Error Handling
Expired
Thread created 02-19-2013 by kakomu
0 Score
26 Replies
1,686 Views
problem is that a warning is not an error
PHP Error Handling
Expired
Thread created 02-19-2013 by kakomu
0 Score
26 Replies
1,686 Views
No. I used PHP's set_error_handler function to halt my program when PHP throws a warning. The exact thing I had requested information on. By default, PHP will halt on errors, but will not halt on...
PHP Error Handling
Expired
Thread created 02-19-2013 by kakomu
0 Score
26 Replies
1,686 Views
Classic ASP halted on errors too, unless you told it to behave otherwise.
http://stackoverflow.com/questions/10520390/stop-script-execution-upon-notice-warning ?
PHP Error Handling
Expired
Thread created 02-19-2013 by kakomu
0 Score
26 Replies
1,686 Views
Had a feeling you weren't looking for help on coding, just a hunch but said it anyways. Anyhow, to answer your question, you could try PHP Compiler. I've never used it so I could not tell you how...
PHP Error Handling
Expired
Thread created 02-19-2013 by kakomu
0 Score
26 Replies
1,686 Views
You need to do your own error checking and handling within your code. You cannot change the default behavior of PHP.
PHP Error Handling
Expired
Thread created 02-19-2013 by kakomu
0 Score
26 Replies
1,686 Views
If you guys do not understand what I'm writing and cannot help me with what I'm requesting, I request that you please refrain from gunking up my thread. I'm not looking for pointers on HOW to code my...
PHP Error Handling
Expired
Thread created 02-19-2013 by kakomu
0 Score
26 Replies
1,686 Views
The method I was testing which led to this thread throws a warning: "Missing Argument".
Variable length argument lists are something else.
PHP Error Handling
Expired
Thread created 02-19-2013 by kakomu
0 Score
26 Replies
1,686 Views
I'm writing a program in php and I'm currently testing a class I wrote. Part of testing this class involved calling a method while passing an incorrect quantity of arguments. For its part, PHP throws...
PHP Error Handling
Expired
Thread created 02-19-2013 by kakomu
0 Score
26 Replies
1,686 Views
Your best way to handle this is not to alter or find a way to have PHP but to create custom error handling to enact what you want how you want it. That would be done on a program for program, file...
PHP Error Handling
Expired
Thread created 02-19-2013 by kakomu
0 Score
26 Replies
1,686 Views
This isn't a problem concerning a range of variables. This isn't an issue of a user passing a string instead of an int. This is a problem wherein I define a method as:
addUser($username, $id)
and...
PHP Error Handling
Expired
Thread created 02-19-2013 by kakomu
0 Score
26 Replies
1,686 Views
PHP is not a compiler and cannot be forced to malfunction in the way that compilers do. What you are trying to do is not possible, sorry.
Try this:
public function addUser($username='', $id=-1) ...
PHP Error Handling
Expired
Thread created 02-19-2013 by kakomu
0 Score
26 Replies
1,686 Views
Excellent! So you decided to add error handling to the code which is what was recommended from the beginning of the thread.
PHP Error Handling
Expired
Thread created 02-19-2013 by kakomu
0 Score
26 Replies
1,686 Views
OK so if someone puts your code on another system, what do you suppose will happen?
PHP Error Handling
Expired
Thread created 02-19-2013 by kakomu
0 Score
26 Replies
1,686 Views
it will do exactly what he's programmed it to do?
PHP Error Handling
Expired
Thread created 02-19-2013 by kakomu
0 Score
26 Replies
1,686 Views
If your function is checking the input (error handling), it should be able to return a specific code if the passed variables do not match a pre-defined range and the calling code should take that...
PHP Error Handling
Expired
Thread created 02-19-2013 by kakomu
0 Score
26 Replies
1,686 Views
Really bad code design if you leave it to the user to be able to call the method and not restrict their parameters to however you wish it to be. This should never ever happen. In the user form that...
PHP Error Handling
Expired
Thread created 02-19-2013 by kakomu
0 Score
26 Replies
1,686 Views
as you've found out, warnings are considered non-fatal and the script will continue to execute. I think you can override this behaviour with the set_error_handler function.
I.e. set it to die...
PHP Error Handling
Expired
Thread created 02-19-2013 by kakomu
0 Score
26 Replies
1,686 Views
Kudos! An elegant solution.
PHP Error Handling
Expired
Thread created 02-19-2013 by kakomu
0 Score
26 Replies
1,686 Views
You may want to read on Scripting Languages Vs Programming Languages
php is scripting language and interpreted at run time not compiled.
Programming Language (Java of C++)is typically first...
PHP Error Handling
Expired
Thread created 02-19-2013 by kakomu
0 Score
26 Replies
1,686 Views
I can call your method as addUser('junk data', 'more junk data')
Any input supplied to your application should be treated as untrusted and passed through a validation routine to ensure that the...
PHP Error Handling
Expired
Thread created 02-19-2013 by kakomu
0 Score
26 Replies
1,686 Views
You could use default arguments and then error check for that default argument
PHP Error Handling
Expired
Thread created 02-19-2013 by kakomu
0 Score
26 Replies
1,686 Views
The number of parameters is variable in PHP, so there is no warning or error to generate. It is something that PHP programmers take advantage of regularly, for instance by allowing an object to have...
PHP Error Handling
Expired
Thread created 02-19-2013 by kakomu
0 Score
26 Replies
1,686 Views
I check all of my own code. I'm attempting to configure and write this code so that if someone else is using the class (such as in a plug-in or module setup), they don't accidentally screw things up....
PHP Error Handling
Expired
Thread created 02-19-2013 by kakomu
0 Score
26 Replies
1,686 Views
Can't you have your code throw an exception if the inputs are not good? I'd think that should take care of it, but I haven't touched PHP in years.
PHP Error Handling
Expired
Thread created 02-19-2013 by kakomu
0 Score
26 Replies
1,686 Views
His error-handling routine is part of the PHP.ini which is a PHP system file. It does not come with the code. My point is that it is not the proper method for handling errors.
PHP Error Handling
Expired
Thread created 02-19-2013 by kakomu
0 Score
26 Replies
1,686 Views
My error-handling routine is contained in a PHP file titled "errorHandler.php", which contains the following code:
function errHandle($errNo, $errStr, $errFile, $errLine)
{
$msg = "$errStr...