|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-05-30 12:06 UTC] tony2001@php.net
[2007-06-01 05:23 UTC] essem76 at yahoo dot com
[2007-06-01 06:14 UTC] essem76 at yahoo dot com
[2007-06-01 06:43 UTC] tony2001@php.net
[2010-11-06 19:07 UTC] scrivimi at mosconimatteo dot com
[2010-11-06 19:07 UTC] scrivimi at mosconimatteo dot com
[2010-12-13 20:08 UTC] jaguilar at addax dot cc
[2011-11-14 14:44 UTC] claudio dot galdiolo at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 07:00:01 2025 UTC |
Description: ------------ If that iritating warning occurs then check the mistyped PHP variables assigned to session variable. I faced the same problem and half an hour after getting on my nerves I found the typing mistake and the nasty warning disappeared. As there aren't many articles when I googled, I thought this might be help someone.. Reproduce code: --------------- <?php session_start(); function checkArrEmpty($arr){ $flag = false; if(is_array($arr)) { foreach($arr as $val){ if($val == ""){ $flag = true; break; } } } return $flag; } if(!$_SESSION['blnFormDataValid']){ $arrUserData = $_SESSION['arrFormData']; } if(isset($_POST['btnAdd'])){ $arrFormData = $_POST; if(!checkArrEmpty($arrFormData)){ $_SESSION['blnFormDataValid'] = true; $_SESSION['arrFormData'] = ""; //header("location: XTemp.php"); //exit(); } else{//THE following nasty variable mistyped (look for small case d in data) is creating a hell. //Simply replace $arrFormdata to $arrFormData and see the difference. $_SESSION['arrFormData'] = $arrFormdata; $_SESSION['blnFormDataValid'] = false; } } ?> <form id="frmUser" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <label>First Name: </label><input type="text" name="fName" value="<?php echo $arrUserData['fName']; ?>" /><br/> <label>Last Name: </label><input type="text" name="lName" value="<?php echo $arrUserData['lName']; ?>" /><br/> <input type="submit" name="btnAdd" value="add" /> </form> Expected result: ---------------- The code is expected to check the server side validations of the form inputs failing which will generate the same form but with the partially filled values this time. Actual result: -------------- The following warning is displayed even in PHP 5.2.0:- Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0