Can I get PHP to throw an error when I try to define a function that has already been defined? -
I run this problem periodically, and I'm trying to figure out whether it is a configuration Problem is or is special with PHP
Actually, a function fu () in my code will be defined, and then somewhere I will accidentally redefine the fuses with the same name (). I hope that any kind of error is thrown, eg "Fatal error: Function already defined line 234, bar.flip blah blah".
But I could not find anything. I get a blank screen debugging can take an infinity because I try to decide that the error message is being redefined by mistake without the help of the error message.
My configuration settings for reporting errors have been set to e-mail, and I have all other types of errors without errors.
Any insights? Is there anything that can cause PHP to report these errors (so that I can either rename the offensive function or wrap it in the function_exists () section?
EDIT: To be clear, I think I have been talking about the examples in which to avoid the namespace collision in PHP, where for any reason I accidentally a function Name which is already The person is present during development (or for example, I import a file where the function is already defined). I hope for an error message when this happens, which will help me debug, but I One does not get the one.
You define the function definitions function_exists ()
: < / P>
(Function_exists ("file_get_contents")} {function file_get_contents (....) ....}
work for me
Come A phpinfo ()
for error_reporting and related settings?
P>
can not redeclare file_get_contents () in D: \ xyz \ htdocs \ test.php on line 5>
display_errors
error_reporting 22519 (equals ... well, I do not know but it shows errors)
error reporting completely When in some hosting environments, I was stopped by Error handler has proved very useful:
Comments
Post a Comment