Bug #71502 [Opn->Nab]: session not saving correct values

From: Date: Wed, 03 Feb 2016 09:08:40 +0000
Subject: Bug #71502 [Opn->Nab]: session not saving correct values
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-199016@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71502&edit=1 ID: 71502 Updated by: requinix@php.net Reported by: birger at bredelund dot dk Summary: session not saving correct values -Status: Open +Status: Not a bug Type: Bug Package: Session related Operating System: win7 PHP Version: 5.6.17 Block user comment: N Private report: N New Comment: Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. If the code changes then GetCode() must be getting called, right? Use debug_backtrace() or debug_print_backtrace() in that function to make sure that it is being called exactly when you think it is. Previous Comments: ------------------------------------------------------------------------ [2016-02-03 08:59:06] birger at bredelund dot dk 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 this bug report at https://bugs.php.net/bug.php?id=71502&edit=1

« previous php.bugs (#199016) next »