开发者

Is it possible to emit warning when I read value of unset variable?

How to configure PHP to emit warning when I try to read value of unset vari开发者_Go百科able?

It is frequently happens when I rename variable in one place, I obtain weird result because I forgot to rename it in other place.


Set error reporting to all and you will get info about any undefined variables too, for example, put this on top of your script:

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


It's not possible elevate the level of a notice, but you could create a custom error handling function.

You can build that handler in a way that it reacts only to "variable not set" type notices and outputs a message or sends an E-Mail or whatever.

All the other errors you could pass on to the default error handler by returning false in the custom error handler.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜