#41855 [Bgs]: Problem with require()

From: Date: Mon, 02 Jul 2007 13:34:35 +0000
Subject: #41855 [Bgs]: Problem with require()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-114532@lists.php.net to get a copy of this message
ID: 41855 User updated by: siegler at boskage dot com Reported By: siegler at boskage dot com Status: Bogus Bug Type: Scripting Engine problem Operating System: Windows Server 2003 (IIS 6) PHP Version: 5.2.3 New Comment: I realize that require 'should' exit when the file is not found. Part of the problem is that it is not, only a warning is getting thrown instead of a fatal error. I also realize "require() or foo()" should also not work, but it's been the only way I can get any error message to print to the screen. The other part of the problem is that PHP is not finding the file being required. The file exists and permissions are set correctly on the file. I'm more than familiar with how the statement should work, and this code worked find until I upgraded to version 5.2.3 of PHP. Previous Comments: ------------------------------------------------------------------------ [2007-07-01 13:40:23] sniper@php.net FYI: require / include are not functions, they are language constructs. And something like 'require() or foo()' isn't gonna work since require exits if file is not found. ------------------------------------------------------------------------ [2007-06-29 18:32:22] siegler at boskage dot com Description: ------------ I am having problems using a require statement and getting very odd results. The link of code is: require("util.php"); util.php does exist in the same directory as the executing script (I have even run getcwd() to insure my path is getting interpreted correctly). Initially I was getting no error output from this, and for some reason when I change the code to read: require("util.php") or die("blah"); I will get my error, except require is throwing a notice instead of a fatal error so I need this die statement to actually get an error to show, and die never shows the text I pass to the function. Reproduce code: --------------- Any require statement may or may not reproduce this issue (for the most part it seems pretty random). I can temporarily fix this by switching my require to an include, run the script, switch back to require and rerun the script. It will work then for a short period of time. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41855&edit=1

« previous php.bugs (#114532) next »