Okay. My bad. I didn't remember that I enabled notices and deprecation
errors when I upgraded to 5.3. I believe I wanted to see things that
were going to become errors eventually, and to correct any sloppy coding
I'd allowed myself to write when I was newer to Php and did not take it
seriously - when it was more forgiving. When I did so I was hit with a
slew of notices and I had to change a lotof "if ($_POST[submit'])"s to
"if (isset($_POST[submit_form']))" ... and other things. It was a good
exercise and it has improved the quality of my code a great deal.
>
> Setting variables to their default values is a good idea - but only if
> their equivalent isn't defined in $_POST, $_SESSION, etc.
That is not a problem for me. I do not initialize "REQUEST" variables
(POST, GET, COOKIE, SESSION) - and I never have register_globals
enabled, so setting a local variable to a default value never conflicts
with the super global REQUEST variables.
I set local variables to default values near the top of the script (like
a prologue) and then I go through my REQUEST ($_POST, $_GET) variables
and set a corresponding local variable to it's value which I then use in
my script. I almost never use REQUEST variables directly within my
script. This also forces me to remember to cleanse any user input.
>
>> There is also a dirty "fix" (it is not really a fix)
I think you read too fast. I stated right up front that this was not a fix.
I have several old Php scripts I wrote that I rely on for personal
utilities (calendar, accounting, log file analysis, ...). When I needed
to use one "right now" after turning on NOTICE errors, I resorted to
dropping an htaccess file into that directory that shut off the notices
so I could use my utility and then come back later and fix it at my
leisure (my scripts all still worked, even when using undefined variables).
That's the only reason I mentioned this convenient short cut. It can
put out the immediate fire. I believe I indicated more than once in my
description that you should come back, re-enable notice errors and
actually fix the problems.
>> that will remove
>> them immediately on the production machine. If you can not access
>> php.ini (on a shared server) or do not want to make a global change to
>> php.ini (the cause of those Notices should be found and corrected) put
There's one.
>> the following in a .htaccess file and place it in any affected, upper
>> level directory.
>>
>> # error_reporting = E_ALL & ~E_NOTICE (all error levels except Notices)
>> php_value error_reporting 30711
>>
>> This will disable reporting of Notice level errors.
>>
>
> That does NOT fix the problems. It merely hides them - which is his
> current problem.
It would also hide them on the production machine (where they should
have not been displayed anyway) and, as I said, "put out the fire" for
his client (even if unable to access php.ini on a shared host). He
could then fix the scripts at a more leisurely pace and his client would
be happy that he made the visible errors disappear almost instantly.
>> Here are some other combinations that can be useful for a quick and
>> dirty fix to the production site after upgrading to Php 5.3.
>>
>> # php error level
>> # error_reporting = E_ALL & ~E_DEPRECATED
>> # php_value error_reporting 22527
>>
>> # error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED
>> # php_value error_reporting 22519
>>
>> With the fire put out you can correct the cause of the error reports at
>> a more leisurely pace (after you upgrade to Php 5.3+ on your test
>> system).
>>
>
> Again, you are only hiding the problems, not fixing them!
I know. And again, I also said as much.
It's like using the faux spare tire most cars come with today. It does
not fix your problem, but it does let you get where you're going for now
- and you can deal with the real problem later.
--
*****************************
Chuck Anderson • Boulder, CO