User Name
Password

Go Back   Planetarion Forums > Non Planetarion Discussions > Programming and Discussion
Register FAQ Members List Calendar Arcade Today's Posts

Reply
Thread Tools Display Modes
Unread 9 Feb 2004, 16:18   #1
Mong
Forever Delayed
 
Join Date: Sep 2000
Location: www.netgamers.org
Posts: 1,475
Mong is on a distinguished road
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"
Mong is offline   Reply With Quote
Unread 9 Feb 2004, 16:34   #2
Mit
Let battle commence
 
Mit's Avatar
 
Join Date: Feb 2002
Location: England
Posts: 732
Mit is a jewel in the roughMit is a jewel in the roughMit is a jewel in the rough
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
Mit is offline   Reply With Quote
Unread 9 Feb 2004, 16:38   #3
Mong
Forever Delayed
 
Join Date: Sep 2000
Location: www.netgamers.org
Posts: 1,475
Mong is on a distinguished road
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"
Mong is offline   Reply With Quote
Unread 9 Feb 2004, 17:25   #4
Mit
Let battle commence
 
Mit's Avatar
 
Join Date: Feb 2002
Location: England
Posts: 732
Mit is a jewel in the roughMit is a jewel in the roughMit is a jewel in the rough
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
Mit is offline   Reply With Quote
Unread 9 Feb 2004, 18:00   #5
JetLinus
Friendly geek of GD :-/
 
JetLinus's Avatar
 
Join Date: Nov 2000
Location: On my metal roid
Posts: 923
JetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud of
Arrow Re: Upgraded PHP, annoying errors...

Not declaring your variables is BAAAAAAAD man!
Pure evil!
__________________
[»] Entropy increases! :-/
JetLinus is offline   Reply With Quote
Unread 9 Feb 2004, 22:37   #6
queball
Ball
 
queball's Avatar
 
Join Date: Oct 2001
Posts: 4,410
queball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so little
Re: Upgraded PHP, annoying errors...

Always put m= in your URLs?
queball is offline   Reply With Quote
Unread 10 Feb 2004, 10:00   #7
Mong
Forever Delayed
 
Join Date: Sep 2000
Location: www.netgamers.org
Posts: 1,475
Mong is on a distinguished road
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"
Mong is offline   Reply With Quote
Unread 10 Feb 2004, 10:02   #8
Mong
Forever Delayed
 
Join Date: Sep 2000
Location: www.netgamers.org
Posts: 1,475
Mong is on a distinguished road
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"
Mong is offline   Reply With Quote
Unread 10 Feb 2004, 10:05   #9
JetLinus
Friendly geek of GD :-/
 
JetLinus's Avatar
 
Join Date: Nov 2000
Location: On my metal roid
Posts: 923
JetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud of
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! :-/
JetLinus is offline   Reply With Quote
Unread 10 Feb 2004, 11:21   #10
Mit
Let battle commence
 
Mit's Avatar
 
Join Date: Feb 2002
Location: England
Posts: 732
Mit is a jewel in the roughMit is a jewel in the roughMit is a jewel in the rough
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
Mit is offline   Reply With Quote
Unread 10 Feb 2004, 12:28   #11
Mong
Forever Delayed
 
Join Date: Sep 2000
Location: www.netgamers.org
Posts: 1,475
Mong is on a distinguished road
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"
Mong is offline   Reply With Quote
Unread 16 Feb 2004, 13:50   #12
MT
/dev/zero
Retired Mod
 
MT's Avatar
 
Join Date: May 2000
Posts: 415
MT is an unknown quantity at this point
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
MT is offline   Reply With Quote
Unread 16 Feb 2004, 16:40   #13
Mit
Let battle commence
 
Mit's Avatar
 
Join Date: Feb 2002
Location: England
Posts: 732
Mit is a jewel in the roughMit is a jewel in the roughMit is a jewel in the rough
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
Mit is offline   Reply With Quote
Reply



Forum Jump


All times are GMT +1. The time now is 09:44.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2018