...

View Full Version : Error Message Interpretation Help



srule_
12-29-2007, 05:26 PM
What does an error like this mean:



getMessage(); } /* Include the HTML for the form */ require_once('./lib/form.php'); ?>


It is a result of the following code:


<?
try {
require_once('./lib/login.class.php');
$login = new Login;
}
catch(Exception $error) {
print $error->getMessage();
}

/* Include the HTML for the form */
require_once('./lib/form.php');
?>

whizard
12-29-2007, 05:30 PM
It's not an error message... its your source code. ... Don't know why, though.

Fou-Lu
12-29-2007, 08:45 PM
Thats most interesting.
The answer is easy if you get the entire source in there, it would likely be due to having short tags disabled. But if its just a partial I'm at a complete loss - unless the Exception class is doing something funky and interpreting messages as php code, which is doubtful.
Sorry mate, all I can tell you from here is that its nothing with your syntax at all, looks fine to me. The only thing I can suggest is in your catch to try doing nothing at all to see if it resolves the problem, or use an $error->printStackTrace(); (I think thats what it is in php, you may need to look up the method call) - print stack trace doesn't need to be printed out btw it will do that by itself.
This is really weird though, I don't generally print out messages from exceptions but ones I consider fatal I do write to a log file and have had no troubles from it. Could be the php version as well, the early 5.x versions had... questionable objects to begin with.
Hope you get it solved!

oesxyl
12-29-2007, 09:04 PM
What does an error like this mean:



It is a result of the following code:


<?
try {
require_once('./lib/login.class.php');
$login = new Login;
}
catch(Exception $error) {
print $error->getMessage();
}

/* Include the HTML for the form */
require_once('./lib/form.php');
?>


I guess, class Login use form.php and you create a instance in 'try' before including form.php.
I could be wrong, :D

best regards

dumpfi
12-30-2007, 11:23 AM
The "error message" is just the source code when viewed in a browser. Everything between <? and -> is interpreted as a HTML tag and thus not shown.

If you do a View Source on the site you will see the full source code.

The real error here is that your server is not configured to feed .php files to PHP on requests (or the file has a wrong extension).

Search the web for instructions on how to configure your server for PHP.

dumpfi



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum