Re: scoping: can someone explain to me if this should/should not work?

From: Date: Wed, 03 Oct 2001 03:04:27 +0000
Subject: Re: scoping: can someone explain to me if this should/should not work?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-69684@lists.php.net to get a copy of this message
You'd have to show the processing in getDomain for anybody to guess... Which values of $SERVER_NAME make it crash?... -- WARNING richard@zend.com address is an endangered species -- Use ceo@l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Doug Farmer <daf@peakpeak.com> Newsgroups: php.general To: <php-general@lists.php.net> Sent: Wednesday, September 26, 2001 5:26 PM Subject: scoping: can someone explain to me if this should/should not work? > The following code seems to work in general but everyone once in a while I'm > getting a segmentation fault. Can someone explain to me why this would be > intermittent and/or whether or not it should work? > > function getDomain($serverName) > { > $result = $serverName; > // some processing to result occurs here > echo "here 3: $result<br>"; > return $result; > } > > function test() > { > global $SERVER_NAME; > echo "here 1<br>"; > $domain = getDomain($SERVER_NAME); > echo "here 2<br>"; > > } > > When I get a segv, I get the output: > > here 1 > here 3: <appropriate value here> > > The "here 2" is not displayed. I thought that this would a return by copy > and not have an issue. > > - doug > >

« previous php.general (#69684) next »