[SOLVED] session 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
User avatar
sharyn
Forum Commoner
Posts: 33
Joined: Tue Jun 15, 2004 6:39 pm
Location: So Cal

[SOLVED] session problem

Post by sharyn »

I am trying to open a named pipe and saving the file pointer using a session variable. However, while other session variable seem to be saved just fine, the session variable for the file pointer doesn't get saved.

Code: Select all

if (($_SESSION['Pipe_open'] == 0 ) )
{
  if  ( !( $_SESSION['Pipe_fp'] = fopen("/Users/administrator/Sites/maps/PipeFile","w") ) )
    echo "ERROR :: Can't open PipeFile<br>";
  else
    $_SESSION['Pipe_open'] = 1;  
}

$Pipe_fp_check = $_SESSION['Pipe_fp'];

if ( !($Pipe_fp_check) ) echo "Error :: pipe not open<br>";
The first time around, the pipe gets opened and everything checks out fine. The next time around, it doesn't re-open the pipe, but the Pipe_fp session variable is not set anymore.

Can anyone help? Thanks a million

-sharyn
Last edited by sharyn on Thu Oct 28, 2004 3:40 pm, edited 1 time in total.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

as you can read in the manual:
Warning
Some types of data can not be serialized thus stored in sessions. It includes resource variables or objects with circular references (i.e. objects which passes a reference to itself to another object).
User avatar
sharyn
Forum Commoner
Posts: 33
Joined: Tue Jun 15, 2004 6:39 pm
Location: So Cal

Post by sharyn »

Thanks TimVW.. well now I can stop beating my head against the wall and try something else...
Post Reply