The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Trying to make sense of global variables

extract($row)
. . . when $row is an array built from . . .
$row=mysql_fetch_array($result_of_query,MYSQL_ASSOC);
. . . and when I have a session_start() at the top of the page . . .

But now when I do this, I get this error:
Warning: Unknown(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled.

It happens when I try to extract the array, $row, when the page starts with a session_start().

So now I'm confused. I've been familiar with making variables global in a function so they can be use by the rest of the program. Is $row in my script a global variable despite never having declared it as such because it was made an array by a function? I've tried building a new array from $row, but it's still causing the error. The error does not occur only if I do not use session_start().

Is $_SESSION a global variable by nature -- despite not being declared as such? Guess that would make sense, but why does the session extension give a damn what I'm doing with $row when I'm not trying to put any value from $row into the $_SESSION variable or even use any value from $_SESSION?

I've read as much as I can on this particular error, and I understand just enough to know that it would be best not to enable registar_globals for security reasons, but I still don't understand why what I am doing is causing this error.

In PHP 4.2.x there was a change to the defaults (for security reasons).
The most controversial (at least, the one with the most impact on the PHP community) was register_globals.This article has all the detail you should need.

I've been reading up on the directive for register_globals as well as information on the super globals in general and $_SESSION in particular. Things might be clearing up for me if I could understand what felgall wrote about how the variable I am trying to use is $_SESSION['row']. If I am not adding $row to the $_SESSION array at any point, how does $row become $_SESSION['row']? And if it is part of $_SESSION, how come it doesn't appear if I print_r($_session) or var_dump($_session)?

I keep looking through the manual to see if there is something that says something about a variable created after session_start() is somehow made to be global, but everything I read seems to repeat that registering the variable (which is n/a 'cause register globals is off, right?) or adding it to $_SESSION is the only way a variable becomes part of the session super global.

Where is the value in $row coming from? If it is set in the current page then it should still be called $row. If it was set in a prior page then it will need to have been passed in one of the global valiables such as $_SESSION, $_COOKIE, $_GET or $_POST or the current page will not be able to access it at all unless you change the register_globals setting to make all variables global (and hence have less control on what values can be passed into the page).