Page 1 of 1
extract() problem
Posted: Mon Feb 05, 2007 7:43 pm
by 696020
I've just deployed an app on a hosted server (Solaris) and I've noticed that the extract() function doesn't work. Any ideas why? Config problem?
I'm running PHP 5.14 on my laptop, Darwin laptop1s-computer.local 8.8.1 Darwin Kernel Version 8.8.1: Mon Sep 25 19:42:00 PDT 2006; root:xnu-792.13.8.obj~1/RELEASE_I386 i386
And the server is running 5.12
SunOS z09528AA 5.11 snv_43 i86pc
Thanks!
Posted: Mon Feb 05, 2007 8:29 pm
by Ollie Saunders
How do you know it isn't working?
Also generally its quite a dangerous function to use unless you are in the scope of a function or method so should you be using it at all?
Posted: Mon Feb 05, 2007 8:36 pm
by 696020
Up pretty late in the uk?
Actually, I found it was a database migration problem.
With regards to the safety of using this funciton, I could see how it might be dangerous for $_POST or $_GET or $_REQUEST, but I'm using if for DB queries ($row)...do you see a problem with that? Just curious.
Posted: Tue Feb 06, 2007 3:54 am
by Ollie Saunders
Up pretty late in the uk?
Yes, it has become a habit.
but I'm using if for DB queries ($row)...do you see a problem with that? Just curious.
Yes, because, depending on the names of the database fields, other variables can be overwritten. It's not so much dangerous from a security standpoint but can make for some difficult debugging. So if you are going to use it then you should use it before defining any other variables and at the top of a function (scoped) imo.