ID: 20728 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Feedback +Status: No Feedback Bug Type: Session related Operating System: Linux 2.4.x PHP Version: 4.2.3 New Comment:
No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. Previous Comments: ------------------------------------------------------------------------ [2002-12-01 19:48:10] [EMAIL PROTECTED] I still don't see any bug here..using references with _SESSION is not really useful as only the value is stored.. You think it should stay as a reference? ------------------------------------------------------------------------ [2002-12-01 19:06:00] [EMAIL PROTECTED] Hello, This code is incorrect - I must have pasted over the code after I modified it during testing as $foobar is not a reference, but a copy. Here is what it should be (please note that you will have to hit reload after the first hit as session gets created on the first hit - so load it and hit reload - and then view the output): <?php session_start(); echo 'Before session modifications:<br><pre>'; var_dump($_SESSION); $_SESSION['foobar'] = 1; $foobar =& $_SESSION['foobar']; global $foobar; $foobar = 3; echo '</pre>After session modifications:<br><pre>'; var_dump($_SESSION); ?> ------------------------------------------------------------------------ [2002-12-01 16:13:01] [EMAIL PROTECTED] I get this normal output: Before session modifications: array(1) { ["foobar"]=> int(1) } After session modifications: array(1) { ["foobar"]=> int(1) } No bug here. (using PHP 4.3.0-dev) ------------------------------------------------------------------------ [2002-12-01 16:07:16] [EMAIL PROTECTED] Hello, I don;t think it is quote as easy as saying "Don't use global with the autoglobal arrays.". Please read my original bug post. I went out of my way to be very detailed so that I don't waste your time - this does nobody any good though if you don't take the time to read it. More specifically, this is the part I am referring to: <ORIGNAL BUG POST> So now you are asking that is interesting, but why would you ever want to "global" an autoglobal. Good question! There would be no purpose in doing this since $_SESSION is always in scope. Well, this bug presented itself to me in an application where there was a reference to a portion of $_SESSION. Since the application is over 5000 lines of code, we will view a highly condensed test version of this: <?php session_start(); echo 'Before session modifications:<br><pre>'; var_dump($_SESSION); $_SESSION['foobar'] = 1; $foobar = $_SESSION['foobar']; global $foobar; $foobar = 3; echo '</pre>After session modifications:<br><pre>'; var_dump($_SESSION); ?> </ORIGNAL BUG POST> So the bug presents itself when you "global" a reference to an array element of an autoglobal as well. Perhaps, I should have used this as the original code example. Please take the time to read the full bug post. Thank You, Mike ------------------------------------------------------------------------ [2002-11-29 20:58:08] [EMAIL PROTECTED] Don't use global with the autoglobal arrays. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/20728 -- Edit this bug report at http://bugs.php.net/?id=20728&edit=1