nepzap2 Posted October 18, 2011 Share Posted October 18, 2011 Dear all, I updated my versions of php/MySQL and OS to Windows 7 Professional and weird "Warnings and Notices:" started popping up. E.g. "Notice: Undefined index: page in C:\Server\htdocs\domain\index.php on line 25 " Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for '-4.0/DST' instead in C:\Server\htdocs\domain\index.php on line 12 " I don't know what is going on. Unless I enter these following functions (error_reporting(0);, session_start() with their parameters these warnings display. Can anyone offer any advice? Any assistance is appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/249329-weird-bug/ Share on other sites More sharing options...
ZulfadlyAshBurn Posted October 18, 2011 Share Posted October 18, 2011 updating your OS has nothing to do with those error but updating your PHP have something to do with those errors. in your code on line 25 what is the code? as for date() use date_default_timezone_set(). see function.date-default-timezone-set Quote Link to comment https://forums.phpfreaks.com/topic/249329-weird-bug/#findComment-1280248 Share on other sites More sharing options...
nepzap2 Posted October 18, 2011 Author Share Posted October 18, 2011 Devotee, Thank you for answering. The code is the following: <?php //error_reporting (E_ALL ^ E_NOTICE); //error_reporting(0); //session_start(); include "functions/functions.php"; // Testing News Functions // include "functions/functionsAllSummerInterns.php"; include "functions/functionsNews.php"; include "includes/header.php"; ini_set('arg_separator.output', '&'); /* Below are the cases for each section of the website. Through the $_GET[''] Method we detect which section the user clicks on and style the section accordingly. */ // Body Content Begins switch (htmlentities ($_GET['page'])){ More Code ?> Quote Link to comment https://forums.phpfreaks.com/topic/249329-weird-bug/#findComment-1280249 Share on other sites More sharing options...
nepzap2 Posted October 18, 2011 Author Share Posted October 18, 2011 line 25 reads switch (htmlentities ($_GET['page'])){ Quote Link to comment https://forums.phpfreaks.com/topic/249329-weird-bug/#findComment-1280250 Share on other sites More sharing options...
ManiacDan Posted October 18, 2011 Share Posted October 18, 2011 When you updated PHP the new installed version defaulted to showing errors. Now you're seeing an error that was previously hidden. That's not a bug in PHP, though it represents a bug in your code. $_GET['page'] doesn't exist when you expect it to exist. Fix that. The date timezone thing can be safely ignored, but it won't hurt you to explicitly set the timezone. -Dan Quote Link to comment https://forums.phpfreaks.com/topic/249329-weird-bug/#findComment-1280259 Share on other sites More sharing options...
nepzap2 Posted October 18, 2011 Author Share Posted October 18, 2011 Thanks, I understand the logic. How would I define a variable that I'm passing via the $_GET method. For instance in this situation. Quote Link to comment https://forums.phpfreaks.com/topic/249329-weird-bug/#findComment-1280287 Share on other sites More sharing options...
xyph Posted October 18, 2011 Share Posted October 18, 2011 Check to see it exists before using it. <?php if( isset($_GET['page']) ) { switch ( htmlentities($_GET['page']) ) { // etc } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/249329-weird-bug/#findComment-1280294 Share on other sites More sharing options...
nepzap2 Posted October 18, 2011 Author Share Posted October 18, 2011 Thank you guys. This helps. Quote Link to comment https://forums.phpfreaks.com/topic/249329-weird-bug/#findComment-1280303 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.