|
9 Feb 2004, 16:18
|
#1
|
Forever Delayed
Join Date: Sep 2000
Location: www.netgamers.org
Posts: 1,475
|
Upgraded PHP, annoying errors...
I upgraded to the latest PHP (having not upgraded in about 10 months previously!).
Now I get lots of stuff like:
Notice: Undefined variable: existingerror in H:\Dev\sc\login.php on line 104
or
Notice: Undefined index: m in H:\Dev\sc\index.php on line 3
Now, I know this is caused because I use (respectively):
if ((!$existingerror) and (!$row['active']))
if ($_GET['m'] == "logout")
So (as far as I can see) I have two choices:
1 - Add "^E_NOTICE" to the PHP config
or
2 - Do if (isset ($_GET['m']) and ($_GET['m']=="logout"))
The problem with (1) is that I'll no longer know if I've mispelled a variable elsewhere. But with (2) I'll have to rewrite a LOT of code. Not just for this project, but for lots of others.
Can anybody suggest a 3rd Way? I suppose I _could_ turn off display_errors and refer to the error log if something doesn't work. But that sucks. I want my errors on screenm there and then! Well, errors apart from ones moaning about undefined variables.
It's amusing, because one of the good things(?) about PHP, is that you never needed to define or cast variables prior to use.
Grrr...
M.
__________________
Firefly Oper and General l4m3r - "I Do Stuff"
O2 Rip-off campaign
<vampy> plus i hate people ... i despise humanity as a whole
pablissimo "I'm still geting over the fact you just posted a pic of your own vomit"
|
|
|
9 Feb 2004, 16:34
|
#2
|
Let battle commence
Join Date: Feb 2002
Location: England
Posts: 732
|
Re: Upgraded PHP, annoying errors...
You can turn off error messages on a per page basis... turn them on for development and off on the live server?
don't just have hte command here, will have a look when i get home
__________________
Mit
http://tim.igoe.me.uk - Development Blog
Whats on TV now - UK TV Guide
<Mendosa> mit is a cute cudlly toy that will be in the shops by christmas
<mig-work> ur now my eternal fav pa god
<Squiz> i name thee, Sir Mit
<Zeus> u my friend are a true gamer I knew u were
|
|
|
9 Feb 2004, 16:38
|
#3
|
Forever Delayed
Join Date: Sep 2000
Location: www.netgamers.org
Posts: 1,475
|
Re: Upgraded PHP, annoying errors...
Yes mate, but that does mess us up, doesn't it?
It would mean I no longer get an error for if (!$foo), sure. But if for example I do:
$foo = 1
$bar = 2
$total = $foo+$bra
Then with this (above) I won't get informed that $bra doesn't exist.
Bah!
M.
__________________
Firefly Oper and General l4m3r - "I Do Stuff"
O2 Rip-off campaign
<vampy> plus i hate people ... i despise humanity as a whole
pablissimo "I'm still geting over the fact you just posted a pic of your own vomit"
|
|
|
9 Feb 2004, 17:25
|
#4
|
Let battle commence
Join Date: Feb 2002
Location: England
Posts: 732
|
Re: Upgraded PHP, annoying errors...
Hence why i said about having it OFF for development and ON for live
__________________
Mit
http://tim.igoe.me.uk - Development Blog
Whats on TV now - UK TV Guide
<Mendosa> mit is a cute cudlly toy that will be in the shops by christmas
<mig-work> ur now my eternal fav pa god
<Squiz> i name thee, Sir Mit
<Zeus> u my friend are a true gamer I knew u were
|
|
|
9 Feb 2004, 18:00
|
#5
|
Friendly geek of GD :-/
Join Date: Nov 2000
Location: On my metal roid
Posts: 923
|
Re: Upgraded PHP, annoying errors...
Not declaring your variables is BAAAAAAAD man!
Pure evil!
__________________
[ »] Entropy increases! :-/
|
|
|
9 Feb 2004, 22:37
|
#6
|
Ball
Join Date: Oct 2001
Posts: 4,410
|
Re: Upgraded PHP, annoying errors...
Always put m= in your URLs?
|
|
|
10 Feb 2004, 10:00
|
#7
|
Forever Delayed
Join Date: Sep 2000
Location: www.netgamers.org
Posts: 1,475
|
Re: Upgraded PHP, annoying errors...
Quote:
Originally Posted by JetLinus
Not declaring your variables is BAAAAAAAD man!
Pure evil!
|
Erm, PHP has never required you to declare your variables.
So usually, I'd agree. But with regards to PHP, you're not right I'm afraid.
M.
__________________
Firefly Oper and General l4m3r - "I Do Stuff"
O2 Rip-off campaign
<vampy> plus i hate people ... i despise humanity as a whole
pablissimo "I'm still geting over the fact you just posted a pic of your own vomit"
|
|
|
10 Feb 2004, 10:02
|
#8
|
Forever Delayed
Join Date: Sep 2000
Location: www.netgamers.org
Posts: 1,475
|
Re: Upgraded PHP, annoying errors...
Quote:
Originally Posted by Mit
Hence why i said about having it OFF for development and ON for live
|
That's stupid Mr Mit.
What if I DID spell a variable name wrong?
I'd never know.
M.
__________________
Firefly Oper and General l4m3r - "I Do Stuff"
O2 Rip-off campaign
<vampy> plus i hate people ... i despise humanity as a whole
pablissimo "I'm still geting over the fact you just posted a pic of your own vomit"
|
|
|
10 Feb 2004, 10:05
|
#9
|
Friendly geek of GD :-/
Join Date: Nov 2000
Location: On my metal roid
Posts: 923
|
Re: Upgraded PHP, annoying errors...
Ah ok, sorry then :-/
But did I understand correctly? If you had declared your variables, this could not have happened?
Or anyway, doesn't PHP force you to declare your vars, or doesn't it allow you to?
Because if you are able to, you should. Actually... You know, oldschool-style.
That's what my point was.
__________________
[ »] Entropy increases! :-/
|
|
|
10 Feb 2004, 11:21
|
#10
|
Let battle commence
Join Date: Feb 2002
Location: England
Posts: 732
|
Re: Upgraded PHP, annoying errors...
Quote:
Originally Posted by Mong
That's stupid Mr Mit.
What if I DID spell a variable name wrong?
I'd never know.
M.
|
You'd know cos you would have the thing turned off while developing and then turn it on when you upload to the live server....
don't tell me, you edit the live copy?
__________________
Mit
http://tim.igoe.me.uk - Development Blog
Whats on TV now - UK TV Guide
<Mendosa> mit is a cute cudlly toy that will be in the shops by christmas
<mig-work> ur now my eternal fav pa god
<Squiz> i name thee, Sir Mit
<Zeus> u my friend are a true gamer I knew u were
|
|
|
10 Feb 2004, 12:28
|
#11
|
Forever Delayed
Join Date: Sep 2000
Location: www.netgamers.org
Posts: 1,475
|
Re: Upgraded PHP, annoying errors...
Quote:
Originally Posted by Mit
You'd know cos you would have the thing turned off while developing and then turn it on when you upload to the live server.... =
|
Yes. What's the point of developing without seeing error messages? Your suggestion means I wouldn't know of errors in my code until I uploaded it!!
Quote:
Originally Posted by Mit
don't tell me, you edit the live copy?
|
Of course not.
M.
__________________
Firefly Oper and General l4m3r - "I Do Stuff"
O2 Rip-off campaign
<vampy> plus i hate people ... i despise humanity as a whole
pablissimo "I'm still geting over the fact you just posted a pic of your own vomit"
|
|
|
16 Feb 2004, 13:50
|
#12
|
/dev/zero Retired Mod
Join Date: May 2000
Posts: 415
|
Re: Upgraded PHP, annoying errors...
The reason is that you have error reporting set to E_ALL, whereas normally it is E_ALL & !E_NOTICE
JetLinus: I think the day that there is a php -w I will jump for joy.
__________________
#linux : Home of Genius
<idimmu> ok i was chained to a desk with this oriental dude
|
|
|
16 Feb 2004, 16:40
|
#13
|
Let battle commence
Join Date: Feb 2002
Location: England
Posts: 732
|
Re: Upgraded PHP, annoying errors...
Quote:
Originally Posted by Mong
Yes. What's the point of developing without seeing error messages? Your suggestion means I wouldn't know of errors in my code until I uploaded it!!
|
crossed meanings, i mean turn OFF the "hide errors" thing while developing and then on when u upload, thus u CAN see the errors on Dev and not on Live
__________________
Mit
http://tim.igoe.me.uk - Development Blog
Whats on TV now - UK TV Guide
<Mendosa> mit is a cute cudlly toy that will be in the shops by christmas
<mig-work> ur now my eternal fav pa god
<Squiz> i name thee, Sir Mit
<Zeus> u my friend are a true gamer I knew u were
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
|
All times are GMT +1. The time now is 22:54.
| |