Function Posted January 11, 2012 Share Posted January 11, 2012 Can anyone help me fix this problem: Deprecated: Function session_is_registered() is deprecated in/includes/functions/sessions.php on line 81 The code is: function tep_session_is_registered($variable) { return session_is_registered($variable); } function tep_session_unregister($variable) { return session_unregister($variable); } Fairly new to PHP and would greatly appreciate any help! Quote Link to comment https://forums.phpfreaks.com/topic/254826-deprecated-function-session_is_registered-is-deprecated-in/ Share on other sites More sharing options...
wolfcry Posted January 11, 2012 Share Posted January 11, 2012 http://php.net/manual/en/migration53.deprecated.php It means it can't / shouldn't be used. Read 12th one down from the Deprecated Functions header. If you're going to start learning PHP, that manual will be your best friend, though, it can become cluttered and confusing at times Quote Link to comment https://forums.phpfreaks.com/topic/254826-deprecated-function-session_is_registered-is-deprecated-in/#findComment-1306656 Share on other sites More sharing options...
Function Posted January 11, 2012 Author Share Posted January 11, 2012 Thanks Wolfcry! I changed all the session_register I could find to $_SESSION. Now this error appeared: Parse error: syntax error, unexpected T_VARIABLE, expecting '(' in /includes/functions/sessions.php on line 70 This is the code: function tep_$_SESSION($variable) { global $session_started; Appreciate any help! Quote Link to comment https://forums.phpfreaks.com/topic/254826-deprecated-function-session_is_registered-is-deprecated-in/#findComment-1306686 Share on other sites More sharing options...
wolfcry Posted January 12, 2012 Share Posted January 12, 2012 Well, from what I can see, you're missing the closing curly brace }. Other than that, I'd need to see exactly what is on line 69 and line 70. Usually it means a line wasn't properly ended with the semi-colon ';' Quote Link to comment https://forums.phpfreaks.com/topic/254826-deprecated-function-session_is_registered-is-deprecated-in/#findComment-1306718 Share on other sites More sharing options...
Function Posted January 12, 2012 Author Share Posted January 12, 2012 Thanks Wolfcry! I did add } after on the next line after global $session_started; but it didn't fix it. Here is the code from line 66 to 78 function tep_session_start() { return session_start(); } function tep_$_SESSION($variable) { global $session_started; if ($session_started == true) { return $_SESSION($variable); } else { return false; } } Thanks for your help! Quote Link to comment https://forums.phpfreaks.com/topic/254826-deprecated-function-session_is_registered-is-deprecated-in/#findComment-1306728 Share on other sites More sharing options...
wolfcry Posted January 12, 2012 Share Posted January 12, 2012 I don't think this: tep_$_SESSION is a valid function name and the script is looking for the following () to indicate that it's a function on its own. Try changing that to something else. As far as I remember, reserved key words and functions cannot be used in the names of variables and other functions. Quote Link to comment https://forums.phpfreaks.com/topic/254826-deprecated-function-session_is_registered-is-deprecated-in/#findComment-1306729 Share on other sites More sharing options...
jcbones Posted January 12, 2012 Share Posted January 12, 2012 function tep_session_is_registered($variable) { return isset($_SESSION[$variable]); } function tep_session_unregister($variable) { return unset($_SESSION[$variable]); } Quote Link to comment https://forums.phpfreaks.com/topic/254826-deprecated-function-session_is_registered-is-deprecated-in/#findComment-1306746 Share on other sites More sharing options...
Function Posted January 12, 2012 Author Share Posted January 12, 2012 function tep_session_is_registered($variable) { return isset($_SESSION[$variable]); } function tep_session_unregister($variable) { return unset($_SESSION[$variable]); } I installed the code and got this error for something in the bottom line: return unset($_SESSION[$variable]); Parse error: syntax error, unexpected T_UNSET in /includes/functions/sessions.php on line 75 Appreciate your help! Quote Link to comment https://forums.phpfreaks.com/topic/254826-deprecated-function-session_is_registered-is-deprecated-in/#findComment-1306786 Share on other sites More sharing options...
jcbones Posted January 12, 2012 Share Posted January 12, 2012 unset doesn't return a value, so just move it up a line. function tep_session_unregister($variable) { unset($_SESSION[$variable]); return; } Quote Link to comment https://forums.phpfreaks.com/topic/254826-deprecated-function-session_is_registered-is-deprecated-in/#findComment-1307064 Share on other sites More sharing options...
Function Posted January 13, 2012 Author Share Posted January 13, 2012 I've been trying to get the sessions.php script compatible to PHP 5.3 I now have this error: Fatal error: Cannot redeclare tep_session_unregister() (previously declared in /includes/functions/sessions.php:74) in /home/ecgnatur/public_html/store_us/includes/functions/sessions.php on line 86 Would anyone know what needs to be changed? Here is the code line 74 and 86 are in bold: session_set_save_handler('_sess_open', '_sess_close', '_sess_read', '_sess_write', '_sess_destroy', '_sess_gc'); } function tep_session_start() { return session_start(); } function tep_session_register($variable) { return isset($_SESSION[$variable]); } function tep_session_unregister($variable) { unset($_SESSION[$variable]); return; } function tep_session_is_registered($variable) { return ($_SESSION($variable)); } function tep_session_unregister($variable) { return ($_SESSION($variable)); } function tep_session_id($sessid = '') { if (!empty($sessid)) { return session_id($sessid); } else { return session_id(); } } Appreciate any help Quote Link to comment https://forums.phpfreaks.com/topic/254826-deprecated-function-session_is_registered-is-deprecated-in/#findComment-1307122 Share on other sites More sharing options...
.josh Posted January 13, 2012 Share Posted January 13, 2012 look at your error. It is saying you already have a function called tep_session_unregister defined in another file. It tells you the other file and line. Quote Link to comment https://forums.phpfreaks.com/topic/254826-deprecated-function-session_is_registered-is-deprecated-in/#findComment-1307124 Share on other sites More sharing options...
Function Posted January 13, 2012 Author Share Posted January 13, 2012 look at your error. It is saying you already have a function called tep_session_unregister defined in another file. It tells you the other file and line. Should i just take out the second one? The only difference is the first one has [ ] type brackets around variable and second one has ( ) type brackets around variable. Does that matter? Quote Link to comment https://forums.phpfreaks.com/topic/254826-deprecated-function-session_is_registered-is-deprecated-in/#findComment-1307125 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.