RE: [PHP] register_globals and E_ALL error reporting

From: Date: Wed, 13 Mar 2002 16:38:48 +0000
Subject: RE: [PHP] register_globals and E_ALL error reporting
Groups: php.general 
Request: Send a blank email to php-general+get-88365@lists.php.net to get a copy of this message
> -----Original Message----- > From: Richard Ellerbrock [mailto:richarde@eskom.co.za] > Sent: 13 March 2002 14:25 > > The following code generates a warning when register_globals=off and > error reporting is set to E_ALL. How do I define the constant > in another > way not to generate a warning? This is with php 4.1.1. I use defines > extensively throughout my code and it is making my debugging difficult > through the transition to register_global=off code. > > <?php > > define(DBF_HOST, "localhost"); > > echo DBF_HOST; > > ?> > > Warning: Use of undefined constant DBF_HOST - assumed 'DBF_HOST' in > var/www/html/iptrackdev/test.php on line 3 localhost That has nothing to do with register_globals! You're getting the error because you have error_reporting set to E_ALL. The error is that both arguments to define should be strings, thus: define('DBF_HOST', 'localhost'); The way you have it, the naked DBF_HOST looks like a reference to a constant, but when PHP looks it up it can't find it because it hasn't been defined yet because the define contains a reference to the constant DBF_HOST which hasn't been defined yet so when PHP looks it up it can't find it because... oh, well, you get the idea! Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: m.ford@lmu.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

« previous php.general (#88365) next »