Re: Call to undefined function problem

From: Date: Tue, 11 Sep 2001 06:30:10 +0000
Subject: Re: Call to undefined function problem
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-66858@lists.php.net to get a copy of this message
Thanks. I ran some further tests and came to the same conclusion. My test showed that the constant was defined even though in theory it should be a new request. Since this is a production system, I don't want to go with a release candidate. I'm going to do a switchover to "include_once". "Rasmus Lerdorf" <rasmus@php.net> wrote in message news:Pine.LNX.4.33.0109102253450.1269-100000@rasmus.php.net... > Try the current 4.0.7 release candidates. There were some define() > related issues in prior versions. Also, in PHP 4 you don't need those > defines to protect from multiple inclusion. You can simply use > include_once > > -Rasmus > > On Mon, 10 Sep 2001, Doug Farmer wrote: > > > > > I'm doing the following: > > > > ---- test.php ----- > > <?php > > require("functions.php"); > > require("...."); // several other requires here > > > > setNoCacheHeaders(); // this is line 16 > > > > // other stuff here > > ?> > > > > ------ functions.php ----- > > <?php > > > > if (!define("__FUNCTIONS__") ) > > { > > define( "__FUNCTIONS__", 1, 1 ); > > > > // a bunch of other defines here > > echo "here 1<br>"; > > function setNoCacheHeaders( ) { > > static $headersNotSet = TRUE; > > > > if ( $headersNotSet ) { > > header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the > > past > > header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " > > GMT"); // > > always modified > > header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 > > header("Pragma: no-cache"); // HTTP/1.0 > > $headersNotSet = FALSE; > > } > > } > > echo "here 2<br>"; > > > > // a few more functions here > > > > } > > > > -------------------------------- > > > > My output is > > here 1 > > here 2 > > > > Fatal error: Call to undefined function: setnocacheheaders() in > > $DOCUMENT_ROOT/test.php on line 16 > > > > Can someone explain? I found something similar in the archives but no > > answer was given. This exact code worked under php3. The only changes in > > the files were files ending in php3 were changed to end php. I also had 2 > > classes that I was using that had initializers in the variable declaration. > > I moved the initialization to constructors. > > > > Note that on some clients the request goes through w/o errors. This is > > intermittent but consistent on a per client basis. > > > > - doug > > > > > > > > > > > > >

« previous php.general (#66858) next »