Re: [PHP] Unexpected behaviour from define()
Thank you very much! Once I realized the source of the problem, I was dismayed that one could declare a constant and have the interpreter absolutely ignore it without warning. I already had error_reporting to E_ALL in php.ini, so was unaware of what else I could do. Didn't think to look for 'display_errors = 1' in php.ini since I was seeing error messages for other errors. Thanks again. Jim On Fri, Jun 25, 2010 at 10:38:39AM +0100, Richard Quadling wrote: > On 24 June 2010 22:41, James Long wrote: > error_reporting(-1); > ini_set('display_errors', 1); > > define( 'LOG_NORMAL', 0 ); > define( 'LOG_WARNING', 1 ); > define( 'LOG_ERROR', 2 ); > > echo 'LOG_NORMAL ' . LOG_NORMAL . "\n"; > echo 'LOG_WARNING ' . LOG_WARNING . "\n"; > echo 'LOG_ERROR ' . LOG_ERROR . "\n"; > ?> > > outputs ... > > Notice: Constant LOG_WARNING already defined in - on line 4 > LOG_NORMAL 0 > LOG_WARNING 5 > LOG_ERROR 2 > > I'm on Win32 PHP 5.3.3-RC1 (cli) (built: Jun 17 2010 22:43:29) > > > > > > -- > - > Richard Quadling > "Standing on the shoulders of some very clever giants!" > EE : http://www.experts-exchange.com/M_248814.html > EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp > Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 > ZOPA : http://uk.zopa.com/member/RQuadling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unexpected behaviour from define()
On 24 June 2010 22:41, James Long wrote: outputs ... Notice: Constant LOG_WARNING already defined in - on line 4 LOG_NORMAL 0 LOG_WARNING 5 LOG_ERROR 2 I'm on Win32 PHP 5.3.3-RC1 (cli) (built: Jun 17 2010 22:43:29) -- - Richard Quadling "Standing on the shoulders of some very clever giants!" EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unexpected behaviour from define()
On 24/06/10 23:08, Ashley Sheridan wrote: On Thu, 2010-06-24 at 23:02 +0100, Tim Schofield wrote: Very strange, as seems to work fine Tim It would, you misspelt LOG_WARNING with a lowercase 'i' ;) Thanks, Ash http://www.ashleysheridan.co.uk Thats what I was trying to illustrate, it worked with lower case i but not with upper case, but James has explained it. Thanks Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unexpected behaviour from define()
On Thu, 2010-06-24 at 23:02 +0100, Tim Schofield wrote: > On 24/06/10 22:41, James Long wrote: > > Perhaps I am missing something basic here. > > > > Why does the LOG_WARNING constant take on a value of 4, when > > it is defined with a value of 1? > > > > Thank you! > > > > Jim > > > > > > $ cat bug.php > > > > > define( 'LOG_NORMAL', 0 ); > > define( 'LOG_WARNING', 1 ); > > define( 'LOG_ERROR', 2 ); > > > > echo 'LOG_NORMAL ' . LOG_NORMAL . "\n"; > > echo 'LOG_WARNING ' . LOG_WARNING . "\n"; > > echo 'LOG_ERROR ' . LOG_ERROR . "\n"; > > > > ?> > > $ php bug.php > > LOG_NORMAL 0 > > LOG_WARNING 4 > > LOG_ERROR 2 > > $ > > > > Very strange, as > > > define( 'LOG_NORMAL', 0 ); > define( 'LOG_WARNiNG', 1 ); > define( 'LOG_ERROR', 2 ); > > echo 'LOG_NORMAL ' . LOG_NORMAL . "\n"; > echo 'LOG_WARNiNG ' . LOG_WARNiNG . "\n"; > echo 'LOG_ERROR ' . LOG_ERROR . "\n"; > > ?> > > seems to work fine > > Tim > It would, you misspelt LOG_WARNING with a lowercase 'i' ;) Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Unexpected behaviour from define()
On 24/06/10 22:41, James Long wrote: Perhaps I am missing something basic here. Why does the LOG_WARNING constant take on a value of 4, when it is defined with a value of 1? Thank you! Jim $ cat bug.php $ php bug.php LOG_NORMAL 0 LOG_WARNING 4 LOG_ERROR 2 $ Very strange, as seems to work fine Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php