Jump to content

[SOLVED] Debugging: stop if variable undefined


KenDRhyD

Recommended Posts

I am developing on Mac OS 10.5.5 with all of the latest patches.

 

Some time ago when I was developing some PHP code for a web site on my iMac the code would report an error and fail the page if my PHP code referenced a variable that did not exist. This was great since it allowed me to find typing errors.

 

Since then I have upgraded my system several times, and now any reference to a non-existent variable simply results in a null value -- which makes it much more difficult to locate such problems.

 

How can I enable, either permanently, temporarily or per execution the debug mode where references to undefined variables results in a fatal error?

For errors to be displayed during runtime you'll also need to to make display_errors is enabled.

 

You can set this within your php.ini

display_errors = On

 

Or via ini_set in your scripts

error_reporting(E_ALL);
ini_set('display_errors', 'On');

Or via ini_set in your scripts

error_reporting(E_ALL);
ini_set('display_errors', 'On');

 

Does the ini_set() function permanently change the contents of the php.ini file, or does the change only last for the remainder of the page or the session?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.