#41540 [NEW]: A probable solution for the Mysterious Warning Message.

From: Date: Wed, 30 May 2007 11:53:06 +0000
Subject: #41540 [NEW]: A probable solution for the Mysterious Warning Message.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-113190@lists.php.net to get a copy of this message
From: essem76 at yahoo dot com Operating system: Windows Server 2000 PHP version: 5.2.2 PHP Bug Type: Session related Bug description: A probable solution for the Mysterious Warning Message. 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 -- Edit bug report at http://bugs.php.net/?id=41540&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41540&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41540&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41540&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41540&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41540&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41540&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41540&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41540&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41540&r=support Expected behavior: http://bugs.php.net/fix.php?id=41540&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41540&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41540&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41540&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41540&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41540&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41540&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41540&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41540&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41540&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41540&r=mysqlcfg

« previous php.bugs (#113190) next »