Re: php 4.0.1 and error_reporting
| From: | Matthew Leverton | Date: | Thu, 29 Jun 2000 14:41:14 +0000 |
| Subject: | Re: php 4.0.1 and error_reporting | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-3807@lists.php.net to get a copy of this message | ||
Something changed with the way variables initialize. I didn't look at the
what's new section, so perhaps it is by design. I don't think I updated
my PHP.INI file either, so perhaps that has something to do with it as
well. Anyway, Example:
My code with PHP 4.0.0 looked something like this:
--
$accesslevel = $HTTP_SESSION_VARS["accesslevel"];
// more code
$read_access = get_read_access_from_db(); // psuedo-code
// $read_access typically is 0 meaning anyone can read
if ($accesslevel < $read_access) {
die("You do not have the access to read this forum.");
// actually it is a bit more friendly ;)
}
--
the session var "accesslevel" is not always initialized. In PHP 4.0.0
this uninitialized variable was NOT less than 0. After upgrading
to PHP 4.0.1, this uninitialized session variable returns true if
compared to less than zero.
Changing the line to the following was a simple fix:
$accesslevel = 0 + $HTTP_SESSION_VARS["accesslevel"];
I typically initialize variables, so I didn't run across any other
problems with it. It was the only problem I ran into upgrading. I
am using the Win32 ISAPI DLL, and the sessions now work great!
Anyway, maybe this is part of your problem?
--
Matthew Leverton - matthew@aeroinc.net -
http://www.allegro.cc
-----Original Message-----
From: Kari Asikainen <Kari.Asikainen@imnetti.fi>
To: php-general@lists.php.net <php-general@lists.php.net>
Date: Thursday, June 29, 2000 4:45 AM
Subject: [PHP] php 4.0.1 and error_reporting
>Has error reporting changed somehow between PHP 4.0.0 and 4.0.1 because I'm
>getting random notices about uninitialized variables and constants in my
>scripts after I upgraded to 4.0.1. The notices don't show up every time,
but
>when I press reload, they show up on constant intervals, about 1/5 of the
>time. I have the default error_reporting (E_ALL & ~E_NOTICE), phpinfo()
>shows error_reporting 2039. The problems go away instantly when I downgrade
>to 4.0.0.
>
>PHP compiled as Apache module (DSO), platform RedHat Linux 6.2,
>Apache/1.3.12 Ben-SSL/1.39. Configure-line is: ./configure'
>'--disable-debug' '--with-imap=/usr/local' '--with-pgsql=/usr'
>'--with-mysql=/usr' '--with-gd=/usr' '--with-freetype'
>'--with-apxs=/usr/bin/apxs'
>
>I'm using Zend Optimizer.
>
>-Kari
>
>--
>Kari Asikainen
>Ilamark Oy
>tel: +358 14 716155
>mobile: +358 40 525 9842
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
>For additional commands, e-mail: php-general-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net
>