extract() problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
696020
Forum Newbie
Posts: 16
Joined: Wed Aug 16, 2006 11:45 pm

extract() problem

Post 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!
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post 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?
696020
Forum Newbie
Posts: 16
Joined: Wed Aug 16, 2006 11:45 pm

Post 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.
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post 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.
Post Reply