Hello,
I just spent at least half an hour debugging a simple syntax error:
if(isset($_POST['firstname'])) $mailbody = $mailbody . "First Name: " . $_POST['firstname'];
The yello marked dot was forgotten (it's almost invisible, i'm sorry).
The problem is that this code was part of a php function that is in a file that's part of Joomla component, so once it happened (syn error), all I got as a result was an empty page.
I know this might sound silly for people that know the solution, but I'm wondering hwo to track this kind of errors. Is there a solution?
Best,
Dan
Detecting syntax errors inside php function
Moderator: General Moderators
-
ogosensedan
- Forum Newbie
- Posts: 2
- Joined: Wed Feb 18, 2009 2:14 am
Re: Detecting syntax errors inside php function
Enable display_errors. On a production environment this can be a bad thing, especially for newbie coders. You introduce an error, people will see it. If a bad person sees it and it's a certain type of error then you can have problems - beyond just buggy PHP code.
It's a php.ini setting. Enable that on your test system, do your work on that, and when it works correctly you copy files.
It's a php.ini setting. Enable that on your test system, do your work on that, and when it works correctly you copy files.
-
ogosensedan
- Forum Newbie
- Posts: 2
- Joined: Wed Feb 18, 2009 2:14 am
Re: Detecting syntax errors inside php function
Thank you, I will.