[PHP-DEV] Bug #9606 Updated: complex objects and references not saved

2001-07-04 Thread sniper

ID: 9606
Updated by: sniper
Reported By: [EMAIL PROTECTED]
Old-Status: Duplicate
Status: Closed
Old-Bug Type: *Session related
Bug Type: *General Issues
Operating system: 
PHP Version: 4.0.4pl1
Assigned To: 
Comments:

should be fixed in CVS. Fix will be in 4.0.7


Previous Comments:
---

[2001-06-14 23:25:30] [EMAIL PROTECTED]

duplicate of #8676

---

[2001-03-07 18:22:17] [EMAIL PROTECTED]

Here is a sample code that produces totally random results.
Elements of container become integers, switch places or even
become objects from other script run on the server before
when saving and restoring sessions.

///example//
class elt {
 var $a; var $b; var $c;

 function elt($a, $b, $c) {
  $this->a=$a; $this->b=$b; $this->c=$c;
 }
 
 function print_elt() {
  echo htmlspecialchars($this->a.' '.$this->b.' '.$this->c).'
 ';
 }
 
}

class container {
 var $arr;


 function container() {
  $this->arr=array();
 }

 function put($elt) {
  $num=sizeof($this->arr);
  $this->arr[$num]=$elt;
  $this->arr['num_'.$num]=&$this->arr[$num];
 }

 function get_by_num($num) {
  return $this->arr[$num];
 }

 function get_by_text($num) {
  return $this->arr['num_'.$num];
 }
}

session_register('x');
if (isset($x)) {
 $tmp=$x->get_by_num(0); $tmp->print_elt();
 $tmp=$x->get_by_text(0); $tmp->print_elt();
 $tmp=$x->get_by_num(1); $tmp->print_elt();
 $tmp=$x->get_by_text(1); $tmp->print_elt();
 $tmp=$x->get_by_num(2); $tmp->print_elt();
 $tmp=$x->get_by_text(2); $tmp->print_elt();
}
else {
 $x=new container;
 $x->put(new elt(1, 2, 3));
 $x->put(new elt('aaa', 'bbb', 'ccc'));
 $x->put(new elt('x', 'y', 'z'));
}
end of example//

I use precompiled Debian packet (at the moment I'm writing
this 4.0.4pl1-5) with modules xml, pgsql, ldap and imap. As
server I use apache (Debian packet version 1.3.14-2.3)
Here is my ini file:

//php.ini///
engine   = On
short_open_tag = On
asp_tags  = Off
precision  = 14
y2k_compliance = Off
output_buffering = Off
output_handler  =  
implicit_flush  = Off 
allow_call_time_pass_reference = On 
safe_mode  = Off
safe_mode_exec_dir =
safe_mode_allowed_env_vars = PHP_ 
safe_mode_protected_env_vars = LD_LIBRARY_PATH  
disable_functions =
highlight.string = #DD
highlight.comment = #FF8000
highlight.keyword = #007700
highlight.bg  = #FF
highlight.default = #BB
highlight.html  = #00

expose_php = On 
max_execution_time = 30
memory_limit = 8M

error_reporting = E_ALL & ~E_NOTICE  
display_errors = On
display_startup_errors = Off
log_errors  = Off
track_errors = Off 
warn_plus_overloading = Off

variables_order  = "EGPCS" 
register_globals = On  
register_argc_argv = On  
post_max_size  = 8M  
gpc_order   = "GPC" 

magic_quotes_gpc = On  
magic_quotes_runtime= Off  
magic_quotes_sybase = Off  

auto_prepend_file =
auto_append_file =

default_mimetype = "text/html"

include_path =   
doc_root  = 
user_dir  = 
enable_dl  = On
file_uploads = On

upload_max_filesize = 2M

allow_url_fopen = On

[Syslog]
define_syslog_variables = Off

[mail function]
SMTP   = localhost   
sendmail_from = [EMAIL PROTECTED]

[Debugger]
debugger.host = localhost
debugger.port = 7869
debugger.enabled = False

[Logging]
[Java]

[SQL]
sql.safe_mode = Off

[ODBC]
odbc.allow_persistent = On
odbc.check_persistent  =  On
odbc.max_persistent = -1
odbc.max_links   = -1
odbc.defaultlrl = 4096 
odbc.defaultbinmode =  1 

[MySQL]
mysql.allow_persistent = On 
mysql.max_persistent = -1
mysql.max_links   = -1
mysql.default_port  =  
mysql.default_socket =  
mysql.default_host  =  
mysql.default_user  =  
mysql.default_password =  

[mSQL]
msql.allow_persistent = On 
msql.max_persistent  = -1 
msql.max_links   = -1 

[PostgresSQL]
pgsql.allow_persistent = On 
pgsql.max_persistent = -1 
pgsql.max_links   = -1 

[Sybase]
sybase.allow_persistent = On 
sybase.max_persistent = -1 
sybase.max_links  = -1 
sybase.min_error_severity = 10 
sybase.min_message_severity = 10 
sybase.compatability_mode = Off 

[Sybase-CT]
sybct.allow_persistent = On  
sybct.max_persistent = -1  
sybct.max_links   = -1  
sybct.min_server_severity = 10 
sybct.min_client_severity = 10 

[bcmath]
bcmath.scale = 0 

[browscap]

[Informix]
ifx.default_host  =  
ifx.default_user  =  
ifx.default_password  =  
ifx.allow_persistent  = On 
ifx.max_persistent  = -1 
ifx.max_links   = -1 
ifx.textasvarcha

[PHP-DEV] Bug #9606 Updated: complex objects and references not saved

2001-06-18 Thread sniper

ID: 9606
Updated by: sniper
Reported By: [EMAIL PROTECTED]
Old-Status: Open
Status: Duplicate
Bug Type: *Session related
Operating system: 
PHP Version: 4.0.4pl1
Assigned To: 
Comments:

duplicate of #8676

Previous Comments:
---

[2001-03-07 18:22:17] [EMAIL PROTECTED]
Here is a sample code that produces totally random results.
Elements of container become integers, switch places or even
become objects from other script run on the server before
when saving and restoring sessions.

///example//
class elt {
 var $a; var $b; var $c;

 function elt($a, $b, $c) {
  $this->a=$a; $this->b=$b; $this->c=$c;
 }
 
 function print_elt() {
  echo htmlspecialchars($this->a.' '.$this->b.' '.$this->c).'
 ';
 }
 
}

class container {
 var $arr;


 function container() {
  $this->arr=array();
 }

 function put($elt) {
  $num=sizeof($this->arr);
  $this->arr[$num]=$elt;
  $this->arr['num_'.$num]=&$this->arr[$num];
 }

 function get_by_num($num) {
  return $this->arr[$num];
 }

 function get_by_text($num) {
  return $this->arr['num_'.$num];
 }
}

session_register('x');
if (isset($x)) {
 $tmp=$x->get_by_num(0); $tmp->print_elt();
 $tmp=$x->get_by_text(0); $tmp->print_elt();
 $tmp=$x->get_by_num(1); $tmp->print_elt();
 $tmp=$x->get_by_text(1); $tmp->print_elt();
 $tmp=$x->get_by_num(2); $tmp->print_elt();
 $tmp=$x->get_by_text(2); $tmp->print_elt();
}
else {
 $x=new container;
 $x->put(new elt(1, 2, 3));
 $x->put(new elt('aaa', 'bbb', 'ccc'));
 $x->put(new elt('x', 'y', 'z'));
}
end of example//

I use precompiled Debian packet (at the moment I'm writing
this 4.0.4pl1-5) with modules xml, pgsql, ldap and imap. As
server I use apache (Debian packet version 1.3.14-2.3)
Here is my ini file:

//php.ini///
engine   = On
short_open_tag = On
asp_tags  = Off
precision  = 14
y2k_compliance = Off
output_buffering = Off
output_handler  =  
implicit_flush  = Off 
allow_call_time_pass_reference = On 
safe_mode  = Off
safe_mode_exec_dir =
safe_mode_allowed_env_vars = PHP_ 
safe_mode_protected_env_vars = LD_LIBRARY_PATH  
disable_functions =
highlight.string = #DD
highlight.comment = #FF8000
highlight.keyword = #007700
highlight.bg  = #FF
highlight.default = #BB
highlight.html  = #00

expose_php = On 
max_execution_time = 30
memory_limit = 8M

error_reporting = E_ALL & ~E_NOTICE  
display_errors = On
display_startup_errors = Off
log_errors  = Off
track_errors = Off 
warn_plus_overloading = Off

variables_order  = "EGPCS" 
register_globals = On  
register_argc_argv = On  
post_max_size  = 8M  
gpc_order   = "GPC" 

magic_quotes_gpc = On  
magic_quotes_runtime= Off  
magic_quotes_sybase = Off  

auto_prepend_file =
auto_append_file =

default_mimetype = "text/html"

include_path =   
doc_root  = 
user_dir  = 
enable_dl  = On
file_uploads = On

upload_max_filesize = 2M

allow_url_fopen = On

[Syslog]
define_syslog_variables = Off

[mail function]
SMTP   = localhost   
sendmail_from = [EMAIL PROTECTED]

[Debugger]
debugger.host = localhost
debugger.port = 7869
debugger.enabled = False

[Logging]
[Java]

[SQL]
sql.safe_mode = Off

[ODBC]
odbc.allow_persistent = On
odbc.check_persistent  =  On
odbc.max_persistent = -1
odbc.max_links   = -1
odbc.defaultlrl = 4096 
odbc.defaultbinmode =  1 

[MySQL]
mysql.allow_persistent = On 
mysql.max_persistent = -1
mysql.max_links   = -1
mysql.default_port  =  
mysql.default_socket =  
mysql.default_host  =  
mysql.default_user  =  
mysql.default_password =  

[mSQL]
msql.allow_persistent = On 
msql.max_persistent  = -1 
msql.max_links   = -1 

[PostgresSQL]
pgsql.allow_persistent = On 
pgsql.max_persistent = -1 
pgsql.max_links   = -1 

[Sybase]
sybase.allow_persistent = On 
sybase.max_persistent = -1 
sybase.max_links  = -1 
sybase.min_error_severity = 10 
sybase.min_message_severity = 10 
sybase.compatability_mode = Off 

[Sybase-CT]
sybct.allow_persistent = On  
sybct.max_persistent = -1  
sybct.max_links   = -1  
sybct.min_server_severity = 10 
sybct.min_client_severity = 10 

[bcmath]
bcmath.scale = 0 

[browscap]

[Informix]
ifx.default_host  =  
ifx.default_user  =  
ifx.default_password  =  
ifx.allow_persistent  = On 
ifx.max_persistent  = -1 
ifx.max_links   = -1 
ifx.textasvarchar  = 0 
ifx.byteasvarchar  = 0 
ifx.charasvarchar  = 0 
ifx.blobinfile   = 0 
ifx.nullformat   = 0 

[Session]
session.save_handler  = files   
session.save_path = /tmp
sessi