Re: [PHP] $_SESSION saves all values but Class -- works on one server but not another?! [second plead for help]

2006-01-25 Thread Jochem Maas

Daevid Vincent wrote:

No no no. I'm NOT passing data between servers. It's just two pages on the
same server. One that sets up the session/class and the other page just
re-loads the session. 


When I talk about two different servers, I copy the entire source/db schema
from one server to the other so they are clones for all intents and
purposes.

One server works the way I'd expect.
The other doesn't.
SAME code on both. Same schema. Nearly identical LAMP versions.


keyword is 'Nearly' - please take into account that the behaviour
of php can change from version to version (sometimes the change is
completely unintentional and unwanted.):


[EMAIL PROTECTED]:/lockdown# php --version
PHP 5.0.3 (cli) (built: Jan  5 2006 13:18:18)


PHP5.0.3


Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.3, Copyright (c) 1998-2004 Zend Technologies
with Zend Extension Manager v1.0.9, Copyright (c) 2003-2005, by Zend
Technologies
with Zend Optimizer v2.6.0, Copyright (c) 1998-2005, by Zend
Technologies


the not working box doesn't run the Zend stuff - try turning it
off to see if that break your working machine (doubtful)



NOT WORKING BOX:
vmware apache2-php5 # php --version
PHP 5.0.5-pl3-gentoo (cli) (built: Dec 14 2005 15:44:04)


PHP5.0.5 (or even PHP5.0.5-pl3-gentoo what exotic flavor that might be)


given that the not working box is running php5.0.5 and the working box
a prior version gives me the sneaking suspicion (spelling!?) that
you may be looking at a reference related problem.

I assume your php CLI is from the same build as the apache module (or
whatever sapi your websaerver uses), correct? (otherwise you'll need
to look at the version info in phpinfo() as viewed via your webbrowser)


Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.5, Copyright (c) 1998-2004 Zend Technologies
This is why I'm saying, it's not my PHP code or database or anything like
that.
It must be some kind of server configuration, but I can't figure out what it
would be. I've compared the php.ini files and don't see anything that seems
relevant. 


the session is not set to auto start on the not working server per chance?






-Original Message-
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 24, 2006 4:54 PM

To: php-general@lists.php.net
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] $_SESSION saves all values but Class -- 
works on one server but not another?! [second plead for help]


You say it's working on one box and not on the other?  Maybe 
I'm wrong (and sounds like I am) but I thought that you 
couldn't pass objects between scripts even with serialize()?


Certainly sounds like it was working for you...   can anyone 
clarify what objects/variables/data types can be passed from 
script to script and what can't?


tg, try the manual.



I know things like database connections can't be shared (that 
is, you can't assign a MySQL connect link to a variable then 
pass that variable/connect to the next script, it needs to 
reconnect the next time around.. or am I wrong about that too? hah)


-TG
God I'm tired

= = = Original message = = =

Thought I'd give this another shot since I still can't figure 
it out after

nearly a week...

I have a gentoo server that doesn't save/restore the CLASS 
portion of a
session, but it does retain other $_SESSION values. This code 
works fine on

a debian box.

WORKING BOX:
[snip]





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] $_SESSION saves all values but Class -- works on one server but not another?! [second plead for help]

2006-01-24 Thread Daevid Vincent
Thought I'd give this another shot since I still can't figure it out after
nearly a week...

I have a gentoo server that doesn't save/restore the CLASS portion of a
session, but it does retain other $_SESSION values. This code works fine on
a debian box.

WORKING BOX:
[EMAIL PROTECTED]:/lockdown# php --version
PHP 5.0.3 (cli) (built: Jan  5 2006 13:18:18)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.3, Copyright (c) 1998-2004 Zend Technologies
with Zend Extension Manager v1.0.9, Copyright (c) 2003-2005, by Zend
Technologies
with Zend Optimizer v2.6.0, Copyright (c) 1998-2005, by Zend
Technologies

NOT WORKING BOX:
vmware apache2-php5 # php --version
PHP 5.0.5-pl3-gentoo (cli) (built: Dec 14 2005 15:44:04)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.5, Copyright (c) 1998-2004 Zend Technologies

I've compared the php.ini files and can't find anything related to sessions
that is different. In fact they're almost the same with a few minor
exceptions that should have no effect that I can think of.

Here is the code I'm executing:

?php
  [SNIP DATABASE LOAD, ETC.]
echo BUserData array = /BBR\n;
print_r($UserData);

//set the session variables:
$_SESSION['login']  = true;
$_SESSION['ie'] =
(stristr($_SERVER['HTTP_USER_AGENT'],MSIE)) ? true : false;
$_SESSION['id'] = $UserData['id'];
$_SESSION['username']   = $UserData['username'];
$_SESSION['firstname']  = $UserData['firstname'];
$_SESSION['lastname']   = $UserData['lastname'];
$_SESSION['email']  = $UserData['email'];
$_SESSION['foo']= '1234567890';

require_once('includes/classes/User.class.php');
$_SESSION['user'] = new User($UserData['id']);

echo PB_SESSION array = /BBR\n;
var_dump($_SESSION);
echo PBUSERNAME/B = .$_SESSION['user']-get_username().BR\n;
exit;
?

Which properly results in this (as it's all on the same page):

UserData array = 
Array ( [id] = 1 [firstname] = Daevid [lastname] = Vincent [email] =
[EMAIL PROTECTED] ) snip

_SESSION array = 
array(9) { [login]= bool(true) [ie]= bool(true) [id]= string(1) 1
[username]= string(6) daevid [firstname]= string(6) Daevid
[lastname]= string(7) Vincent [email]= string(17)
[EMAIL PROTECTED] [foo]= string(10) 1234567890 [user]=
object(User)#2 (24) { [username:protected]= string(6) daevid
[firstname:protected]= string(6) Daevid [lastname:protected]=
string(7) Vincent [email:protected]= string(17) [EMAIL PROTECTED] ...
snip } } 

USERNAME = daevid


Now I load a simple session loading test page with this code:

?php 
require_once('includes/classes/User.class.php');
session_start();
echo BSESSION TEST:P/B;
var_dump($_SESSION);
exit;
?

On the working box things are fine (obviously): 

SESSION TEST:
array(9) { [login]= bool(true) [ie]= bool(true) [id]= string(1) 1
[username]= string(6) daevid [firstname]= string(6) Daevid
[lastname]= string(7) Vincent [email]= string(17)
[EMAIL PROTECTED] [foo]= string(10) 1234567890 [user]=
object(User)#1 (24) { [username:protected]= string(6) daevid
[firstname:protected]= string(6) Daevid [lastname:protected]=
string(7) Vincent [email:protected]= string(17) [EMAIL PROTECTED]
[timestamp:protected]= string(19) -00-00 00:00:00 ... snip } } 

but on the broken box I see:

SESSION TEST:
array(9) { [login]= bool(true) [ie]= bool(true) [id]= string(1) 1
[username]= string(6) daevid [firstname]= string(6) Daevid
[lastname]= string(7) Vincent [email]= string(17)
[EMAIL PROTECTED] [foo]= string(10) 1234567890 [user]=
object(User)#1 (20) { [username:protected]= string(0) 
[firstname:protected]= string(0)  [lastname:protected]= string(0) 
[email:protected]= string(0)  [timestamp:protected]= NULL ... snip
} } 

Notice how the regular session info is there, but the User class is all
empty or NULL. So SOME of the $_SESSION is working, but not the User class
portion. This is completely baffling to me. Examining the /tmp/sess_* file
shows this same data.

Here is the session portion of php.ini on the broken box:

[Session]
; Handler used to store/retrieve data.
session.save_handler = files

; Argument passed to save_handler.  In the case of files, this is the path
; where data files are stored. Note: Windows users have to change this
; variable in order to use PHP's session functions.
;
; As of PHP 4.0.1, you can define the path as:
;
; session.save_path = N;/path
;
; where N is an integer.  Instead of storing all the session files in
; /path, what this will do is use subdirectories N-levels deep, and
; store the session data in those directories.  This is useful if you
; or your OS have problems with lots of files in one directory, and is
; a more efficient layout for servers that handle lots of sessions.
;
; NOTE 1: PHP will not create this directory structure automatically.
; You can use the script in the ext/session dir for that purpose.
; NOTE 2: See the section on garbage collection below if 

Re: [PHP] $_SESSION saves all values but Class -- works on one server but not another?! [second plead for help]

2006-01-24 Thread tg-php
You say it's working on one box and not on the other?  Maybe I'm wrong (and 
sounds like I am) but I thought that you couldn't pass objects between scripts 
even with serialize()?

Certainly sounds like it was working for you...   can anyone clarify what 
objects/variables/data types can be passed from script to script and what can't?

I know things like database connections can't be shared (that is, you can't 
assign a MySQL connect link to a variable then pass that variable/connect to 
the next script, it needs to reconnect the next time around.. or am I wrong 
about that too? hah)

-TG
God I'm tired

= = = Original message = = =

Thought I'd give this another shot since I still can't figure it out after
nearly a week...

I have a gentoo server that doesn't save/restore the CLASS portion of a
session, but it does retain other $_SESSION values. This code works fine on
a debian box.

WORKING BOX:
[snip]

___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] $_SESSION saves all values but Class -- works on one server but not another?! [second plead for help]

2006-01-24 Thread Daevid Vincent
No no no. I'm NOT passing data between servers. It's just two pages on the
same server. One that sets up the session/class and the other page just
re-loads the session. 

When I talk about two different servers, I copy the entire source/db schema
from one server to the other so they are clones for all intents and
purposes.

One server works the way I'd expect.
The other doesn't.
SAME code on both. Same schema. Nearly identical LAMP versions.
This is why I'm saying, it's not my PHP code or database or anything like
that.
It must be some kind of server configuration, but I can't figure out what it
would be. I've compared the php.ini files and don't see anything that seems
relevant. 


 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, January 24, 2006 4:54 PM
 To: php-general@lists.php.net
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] $_SESSION saves all values but Class -- 
 works on one server but not another?! [second plead for help]
 
 You say it's working on one box and not on the other?  Maybe 
 I'm wrong (and sounds like I am) but I thought that you 
 couldn't pass objects between scripts even with serialize()?
 
 Certainly sounds like it was working for you...   can anyone 
 clarify what objects/variables/data types can be passed from 
 script to script and what can't?
 
 I know things like database connections can't be shared (that 
 is, you can't assign a MySQL connect link to a variable then 
 pass that variable/connect to the next script, it needs to 
 reconnect the next time around.. or am I wrong about that too? hah)
 
 -TG
 God I'm tired
 
 = = = Original message = = =
 
 Thought I'd give this another shot since I still can't figure 
 it out after
 nearly a week...
 
 I have a gentoo server that doesn't save/restore the CLASS 
 portion of a
 session, but it does retain other $_SESSION values. This code 
 works fine on
 a debian box.
 
 WORKING BOX:
 [snip]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php