|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-08-11 08:19 UTC] tony2001@php.net
[2006-08-11 09:05 UTC] steamboy at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 14:00:01 2025 UTC |
Description: ------------ I'm sorry, I could not check the bug with the latest version of php (only with 4.3.11), BUT before closing this topic, please try the code I posted because the bug is so peculiar, I would be surprised if it had been reported ! One line of javascript (displaying an html image tag with document.write), prevents the setcookie function to work correctly when the value is given with some conditional statements (using isset, or hiding an error with @). Simply enter a word in the input field. Reproduce code: --------------- <?php if (!isset($_POST['aa'])) {$ax='00';} else {$ax=$_POST['aa'];} setcookie('test',$ax); var_dump($ax); ?> <script type="text/javascript"> document.write('<img src>') </script> <form method="post" action="" name="test"> <input type="text" name="aa"><br><br> <input type="submit" value="Ok"> </form> Expected result: ---------------- It should set a cookie named 'test' with the value you have entered in the input field. Actual result: -------------- Instead it will set the '00' value to the cookie, even though dumping the variable produces the expected result, that is the content of the input field ! However, if you remove the javascript line, it will set the cookie with the correct value !