note 49883 added to function.error-reporting

From: Date: Fri, 11 Feb 2005 05:55:40 +0000
Subject: note 49883 added to function.error-reporting
Groups: php.notes 
Request: Send a blank email to php-notes+get-84833@lists.php.net to get a copy of this message
Under jjuffermans' note, the editors posted the following: "Instead of using @ to suppress errors if the file does not exist you should do a conditional include: if (is_file("nosuchfile.php")) { include_once("nosuchfile.php"); }" This is rather obvious, but has an even more obvious problem: is_file doesn't check on the include_path, which one assumes include_once is highly likely to be using. While there are any number of kludgy workarounds which can be employed to overcome this problem, it's a structural problem in PHP and should be fixed. Preferably @ should only suppress a file not found error, but not any errors inside the included file if it is found, or failing that at the least is_file or file_exists should have the option to look on the include_path for the file. ---- Manual Page -- http://www.php.net/manual/en/function.error-reporting.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+49883 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49883&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49883&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49883&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49883&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49883&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+49883&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#84833) next »