Bug #71502 [NEW]: session not saving correct values

From: Date: Wed, 03 Feb 2016 08:59:10 +0000
Subject: Bug #71502 [NEW]: session not saving correct values
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-199015@lists.php.net to get a copy of this message
From: birger at bredelund dot dk Operating system: win7 PHP version: 5.6.17 Package: Session related Bug Type: Bug Bug description:session not saving correct values Description: ------------ --- From manual page: http://www.php.net/book.session --- I have a problem with a specific registration in session. PHP is actual version 5.5.1 - supplied with Wampserver 2.5 No changes to ini, og anything else special. I have ekstensive use og $_SESSION - and everything functions as it is supposed to. Has been up till now, anyway. A function - GetKode() - returns an arbritary string, from a given set of characteres. Used for captcha. So... Save the result in $_SESSION and in a hidden input in the form. The script that recieves data from the form, then compares the two. And the problem is, that the values are not identical. Renaming the varibale (captcha -> capkode for instance) does not give the same value in input line and $_SESSION Been all over my code - the $_SESSION variable name is not in use anywhere else, and the error occurs even before submitting the form. Running my own server, so I can actually check the session-file for content - and it is not as it should be, it is not the same string as the one in the HTML-input.. And the real problem is, that it is only this one variable - no matter what I call it... Theres around a hundred values in the $_SESSION - and only this one behaves like this. I have done the same thing on other sites, with no problems.... It actually could look like, whenever the value of $_SESSION variable is called, the GetKode() function is the one returning the value. Don't really see how this could happen, tho... Get Kode, ia capable of returning a string of fixed length og of random length. If I set the length, the wrong data-entry is of the same length. If I do not, lengths vary (as expeccted). Test script: --------------- $_SESSION['captcha'] = GetCode(); echo '<input type="hidden" id="captha" value="'.$_SESSION['captcha'].'">'; also tried like this: $capt = ((string)GetCode()); // Trying to make sure, its not cause by a "recall" of the function, but actually a store string value. $_SESSION['captcha'] = $capt; echo '<input type="hidden" id="captha" value="'.$capt.'">'; Same result. Also tried adding echo $capt."\n".$_SESSION['capkode']; Whitch intering enough prints equal (correct) values - but it is not the one that is actually stored in $_SESSION.... Expected result: ---------------- You would expect the session and the input line to hold identical values - they don't Actual result: -------------- At my wits end. What is happening here, is simply not possible... -- Edit bug report at https://bugs.php.net/bug.php?id=71502&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71502&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71502&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71502&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=71502&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=71502&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=71502&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=71502&r=needscript Try newer version: https://bugs.php.net/fix.php?id=71502&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=71502&r=support Expected behavior: https://bugs.php.net/fix.php?id=71502&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=71502&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=71502&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=71502&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71502&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=71502&r=dst IIS Stability: https://bugs.php.net/fix.php?id=71502&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=71502&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=71502&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=71502&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=71502&r=mysqlcfg

« previous php.bugs (#199015) next »