RE: [PHP4BETA] Really strange session_register behavior

From: Date: Tue, 21 Sep 1999 22:29:32 +0000
Subject: RE: [PHP4BETA] Really strange session_register behavior
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-4778@lists.php.net to get a copy of this message
Eep. I forgot to paste in the $group[stuff] = "Hi"; $group[morestuff] = "Hi!"; lines after the error_reporting.. I was copy/pasting things into email and it didn't work right... in my test script, however, it was there. ... I tried this on another server, running a CVS version from a few days ago, and got these results (different than before): count: 2 group[stuff] = Hi group[morestuff] = Hi! count: 2 group[stuff] = H group[morestuff] = H count: 2 group[stuff] = H group[morestuff] = H ... corrected script follows: <?php error_reporting(7); $group[stuff] = "Hi"; $group[morestuff] = "Hi!"; echo "count: ".count($group)."<p>"; echo "group[stuff] = $group[stuff]<p>"; echo "group[morestuff] = $group[morestuff]<p>"; session_register("group"); echo "group[stuff] = $group[stuff]<p>"; echo "group[morestuff] = $group[morestuff]<p>"; $group[stuff] = "Hi"; $group[morestuff] = "Hi!"; echo "group[stuff] = $group[stuff]<p>"; echo "group[morestuff] = $group[morestuff]<p>"; ?> J -----Original Message----- From: Justin Matlock [mailto:jmat@firewind.net] Sent: Tuesday, September 21, 1999 5:37 PM To: php4beta@lists.php.net Subject: [PHP4BETA] Really strange session_register behavior Sensitivity: Personal I don't know if anyone else has seen this, but it's been nailing me lately, and I can't figure out if I'm doing something very wrong with my scripts (works fine under PHP3, or if something else is messed up). After I register a variable with session_register, not only do all of the values get cleared out, but I can no longer assign values to it (if it's an array). I'm running Apache 1.3.9, and Beta2. Here's my test script: <?php // Test Script error_reporting(7); echo "count: ".count($group)."<p>"; echo "group[stuff] = $group[stuff]<p>"; echo "group[morestuff] = $group[morestuff]<p>"; session_register("group"); echo "count: ".count($group)."<p>"; echo "group[stuff] = $group[stuff]<p>"; echo "group[morestuff] = $group[morestuff]<p>"; $group[stuff] = "Hi"; $group[morestuff] = "Hi!"; echo "count: ".count($group)."<p>"; echo "group[stuff] = $group[stuff]<p>"; echo "group[morestuff] = $group[morestuff]<p>"; ?> The results: ------------------- count: 2 group[stuff] = Hi group[morestuff] = Hi! count: 0 group[stuff] = group[morestuff] = count: 0 group[stuff] = group[morestuff] = ------------------- -- PHP 4 Beta

« previous php.version4 (#4778) next »