Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #4964

Re: way to turn off strict option? Use of undefined constant

From "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid>
Newsgroups comp.lang.php
Subject Re: way to turn off strict option? Use of undefined constant
Date 2012-02-23 19:00 +0100
Organization http://alvaro.es/
Message-ID <ji5us6$4a8$1@dont-email.me> (permalink)
References <69c9643c-2a9f-4f51-b388-4c767d021623@r1g2000yqk.googlegroups.com>

Show all headers | View raw


El 23/02/2012 17:01, Paul escribió/wrote:
> I installed a new version of PHP and now am getting errors on my pages
> that say:
>
> Notice: Use of undefined constant....
>
> Is there any way in the page that I can add some code so I do not get
> these errors?  I just want to get this working and will go back and
> fix this later.
>
> But maybe there is a way like in VB a way to turn off Option
> Explicit ?

Not exactly, but quite similar. You have a few choices:

- Hide error messages: 
http://es2.php.net/manual/en/errorfunc.configuration.php#ini.display-errors

- Log error messages: 
http://es2.php.net/manual/en/errorfunc.configuration.php#ini.error-log

- Ignore certain error types: 
http://es2.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting

These options can be combined to your liking. You can set them in 
several places:

1. Edit your `php.ini` file:

		error_reporting = E_ALL & ~E_NOTICE
		display_errors = On

2. Put this on top of your script:

		<?php

		error_reporting(E_ALL & ~E_NOTICE);
		ini_set('display_errors', TRUE);

3. If PHP runs as Apache module, you can also use an `.htaccess` file:

		# Print E_ALL & ~E_NOTICE from a PHP script to get the appropriate number:
		php_value error_reporting 30711
		php_flag display_errors on


In your dev box I'd recommend E_ALL | E_STRICT.


-- 
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

way to turn off strict option? Use of undefined constant Paul <pauly814@gmail.com> - 2012-02-23 08:01 -0800
  Re: way to turn off strict option? Use of undefined constant Michael Fesser <netizen@gmx.de> - 2012-02-23 18:21 +0100
  Re: way to turn off strict option? Use of undefined constant "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-02-23 19:00 +0100
  Re: way to turn off strict option? Use of undefined constant "Peter H. Coffin" <hellsop@ninehells.com> - 2012-02-23 15:55 -0600

csiph-web