Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #4960 > unrolled thread
| Started by | Paul <pauly814@gmail.com> |
|---|---|
| First post | 2012-02-23 08:01 -0800 |
| Last post | 2012-02-23 15:55 -0600 |
| Articles | 4 — 4 participants |
Back to article view | Back to comp.lang.php
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
| From | Paul <pauly814@gmail.com> |
|---|---|
| Date | 2012-02-23 08:01 -0800 |
| Subject | way to turn off strict option? Use of undefined constant |
| Message-ID | <69c9643c-2a9f-4f51-b388-4c767d021623@r1g2000yqk.googlegroups.com> |
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 ? thanks
[toc] | [next] | [standalone]
| From | Michael Fesser <netizen@gmx.de> |
|---|---|
| Date | 2012-02-23 18:21 +0100 |
| Message-ID | <b7tck7l0cfjcl2vb46c5smi00hl6hd3s7c@mfesser.de> |
| In reply to | #4960 |
.oO(Paul) >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? You can turn off notices (see error_reporting()), but the errors still exist and you should fix them as soon as possible. The above for example is the result of accessing an array element with an unquoted string key: $foo = $array[bar]; Correct would be: $foo = $array['bar']; Micha -- http://mfesser.de/blickwinkel
[toc] | [prev] | [next] | [standalone]
| From | "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> |
|---|---|
| Date | 2012-02-23 19:00 +0100 |
| Message-ID | <ji5us6$4a8$1@dont-email.me> |
| In reply to | #4960 |
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
--
[toc] | [prev] | [next] | [standalone]
| From | "Peter H. Coffin" <hellsop@ninehells.com> |
|---|---|
| Date | 2012-02-23 15:55 -0600 |
| Message-ID | <slrnjkdde0.rcn.hellsop@nibelheim.ninehells.com> |
| In reply to | #4960 |
On Thu, 23 Feb 2012 08:01:48 -0800 (PST), Paul 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 ? Or you could, you know, define your constants... -- Nay, God Himself will not save men against their wills. -Locke
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.php
csiph-web