note 30996 added to function.require-once

From: Date: Sat, 05 Apr 2003 23:42:16 +0000
Subject: note 30996 added to function.require-once
Groups: php.notes 
Request: Send a blank email to php-notes+get-46268@lists.php.net to get a copy of this message
When including a file with require(_once) or include(_once), if the file has syntax errors, PHP will not execute any commands in the file. This can be especially annoying if you set your error reporting settings up in another file, and include it via require_once(). Example: <?php require_once("error_foo.php"); // some code strtoupper("bar") // oops, we left off a semi-colin ?> error_foo.php: <?php ini_set("display_errors", "1"); ini_set("html_errors", "1"); ini_set("error_reproting", E_ALL & ~E_NOTICE); $old_handler = set_error_handler("new_handler"); function new_handler() { // code that fails PHP's parse check } ?> If you default settings in this example are to supress errors (and for some reason you do not have error logging on), your script will fail, with no error reporting by PHP. You will have to fix the included file, or, place error report settings in the parent script for error reporting to be handled as directed. -- http://www.php.net/manual/en/function.require-once.php http://master.php.net/manage/user-notes.php?action=edit+30996 http://master.php.net/manage/user-notes.php?action=delete+30996 http://master.php.net/manage/user-notes.php?action=reject+30996

« previous php.notes (#46268) next »