vampyr07au Posted September 18, 2010 Posted September 18, 2010 Can these depricated functions be left in and the error reporting be told to ignore them without this causing any issues with the site ? or do they have to have to be updated to current functions ?
Guest Posted September 18, 2010 Posted September 18, 2010 Mick, Here is the patches for that: http://addons.oscommerce.com/info/7394 Chris
vampyr07au Posted September 18, 2010 Author Posted September 18, 2010 Thanks Chris but that doesnt help me ... the deprecated code that is giving me problems is "session_" functions and that isn't in the patches that you linked. Just need to know if leaving the deprecated code in there will adversely affect the site or not.
Guest Posted September 18, 2010 Posted September 18, 2010 Mick, Actually, if you check. Only one file has to be updated for sessions errors, that's the server_info.php. The manual edits does not state this code change but the server_info.php file has the code edits applied. SO, if you use a comparison tool you will find the edits so you can apply them to your site. More than likely, you can just drop on top with that file as there aren't very many contributions that change the server_info.php file. Chris
vampyr07au Posted September 18, 2010 Author Posted September 18, 2010 Updated the server_info.php file and the depricated errors are still there.
Guest Posted September 18, 2010 Posted September 18, 2010 Mick, There are 24 files that required code changes to make c2.2 RC2a PHP 5.3 compatible. All 24 files are in the contribution you downloaded. If you have custom code or contributions that have deprecated code in them, then you will have to contact the contribution creator for an update. You can also learn more about deprecated sessions here: http://ca3.php.net/manual/en/ref.session.php Chris
vampyr07au Posted September 18, 2010 Author Posted September 18, 2010 OK will have a further look in the morning ... One thing I did notice is that the deprectaed code message points to a sessions.php file in the "functions" folder but in the contribution that I downloaded from you the only sessions file resides inside the "classes" folder. I checked my osCommerce folders and I have a sessions file in both locations and they are 2 different files.
vampyr07au Posted September 19, 2010 Author Posted September 19, 2010 I've had a further look at the files in the package you gave me ... I don't understand ANYTHING about php code at all so I don't know if any of it is customised or not ... I don't have access to the person who set this up anymore. I am completely lost. and I have already seem those pages that you linked in your last post - the deprecated sessions links - but the problem is that it does not explain clearly to me where the replacement code is supposed to be used. :( Once again I will state that I have found out how to change the error reporting so that my site does not display all the deprecated code errors but I need to know whether or not leaving the deprecated code inn the files will ahve a negative effect on the site.
Guest Posted September 19, 2010 Posted September 19, 2010 Mick, Hiding an error doesn't correct an error. You should take the time to correct ALL errors as the site would never pass validation without those corrections. Chris
vampyr07au Posted September 19, 2010 Author Posted September 19, 2010 Thanks Chris .... that answers that question, which means that we're back to the original problem, I don't know or understand php so I have no idea how to fix the errors. All the searching that I am doing is telling me that the errors are caused by out of use code but it does not explain how to fix it in terms that someone like myself can understand. The solutions I found online tell me to replace the deprecated code with other code but do not explain clearley (FOR ME) where I am supposed to put that code.
Guest Posted September 19, 2010 Posted September 19, 2010 Mick, Ok let's approach it differently, can you post the EXACT error you are receiving so I can see what it is and what file it is in ? Chris
vampyr07au Posted September 19, 2010 Author Posted September 19, 2010 ok there are several of them. First there are 2 deprecated code messages that post themselves continuously on the site index page: Deprecated: Function session_is_registered() is deprecated in /home/paradise/public_html/includes/functions/sessions.php on line 111 Deprecated: Function session_register() is deprecated in /home/paradise/public_html/includes/functions/sessions.php on line 104 Then there are also some other errors which i'm not sure about either: Warning: session_save_path() [function.session-save-path]: SAFE MODE Restriction in effect. The script whose uid is 2696 is not allowed to access /tmp owned by uid 0 in /home/paradise/public_html/includes/functions/sessions.php on line 148 Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/paradise/public_html/includes/functions/sessions.php:148) in /home/paradise/public_html/includes/functions/sessions.php on line 97 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/paradise/public_html/includes/functions/sessions.php:148) in /home/paradise/public_html/includes/functions/sessions.php on line 97 Warning: date() [function.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 'Australia/Perth' for 'WST/8.0/no DST' instead in /home/paradise/public_html/includes/languages/english.php on line 329 Warning: I am able to write to the configuration file: /home/paradise/public_html/includes/configure.php. This is a potential security risk - please set the right user permissions on this file. As I said before the searches I hahve done have told me I need to replace the deprecated code with "$_Session" code but not where I am supposed to do this.
Guest Posted September 19, 2010 Posted September 19, 2010 Mick, Since all of the errors relate to one file, please post the code for sessions.php so we can look at what you have. Chris
vampyr07au Posted September 19, 2010 Author Posted September 19, 2010 This is the file in its entirety : <?php /* $Id: sessions.php,v 1.19 2003/07/02 22:10:34 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ if (STORE_SESSIONS == 'mysql') { if (!$SESS_LIFE = get_cfg_var('session.gc_maxlifetime')) { $SESS_LIFE = 1440; } function _sess_open($save_path, $session_name) { return true; } function _sess_close() { return true; } function _sess_read($key) { $value_query = tep_db_query("select value from " . TABLE_SESSIONS . " where sesskey = '" . tep_db_input($key) . "' and expiry > '" . time() . "'"); $value = tep_db_fetch_array($value_query); if (isset($value['value'])) { return $value['value']; } return false; } function _sess_write($key, $val) { global $SESS_LIFE; $expiry = time() + $SESS_LIFE; $value = $val; $check_query = tep_db_query("select count(*) as total from " . TABLE_SESSIONS . " where sesskey = '" . tep_db_input($key) . "'"); $check = tep_db_fetch_array($check_query); if ($check['total'] > 0) { return tep_db_query("update " . TABLE_SESSIONS . " set expiry = '" . tep_db_input($expiry) . "', value = '" . tep_db_input($value) . "' where sesskey = '" . tep_db_input($key) . "'"); } else { return tep_db_query("insert into " . TABLE_SESSIONS . " values ('" . tep_db_input($key) . "', '" . tep_db_input($expiry) . "', '" . tep_db_input($value) . "')"); } } function _sess_destroy($key) { return tep_db_query("delete from " . TABLE_SESSIONS . " where sesskey = '" . tep_db_input($key) . "'"); } function _sess_gc($maxlifetime) { tep_db_query("delete from " . TABLE_SESSIONS . " where expiry < '" . time() . "'"); return true; } session_set_save_handler('_sess_open', '_sess_close', '_sess_read', '_sess_write', '_sess_destroy', '_sess_gc'); } function tep_session_start() { global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS; $sane_session_id = true; if (isset($HTTP_GET_VARS[tep_session_name()])) { if (preg_match('/^[a-zA-Z0-9]+$/', $HTTP_GET_VARS[tep_session_name()]) == false) { unset($HTTP_GET_VARS[tep_session_name()]); $sane_session_id = false; } } elseif (isset($HTTP_POST_VARS[tep_session_name()])) { if (preg_match('/^[a-zA-Z0-9]+$/', $HTTP_POST_VARS[tep_session_name()]) == false) { unset($HTTP_POST_VARS[tep_session_name()]); $sane_session_id = false; } } elseif (isset($HTTP_COOKIE_VARS[tep_session_name()])) { if (preg_match('/^[a-zA-Z0-9]+$/', $HTTP_COOKIE_VARS[tep_session_name()]) == false) { $session_data = session_get_cookie_params(); setcookie(tep_session_name(), '', time()-42000, $session_data['path'], $session_data['domain']); $sane_session_id = false; } } if ($sane_session_id == false) { tep_redirect(tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false)); } return session_start(); } function tep_session_register($variable) { global $session_started; if ($session_started == true) { return session_register($variable); } else { return false; } } function tep_session_is_registered($variable) { return session_is_registered($variable); } function tep_session_unregister($variable) { return session_unregister($variable); } function tep_session_id($sessid = '') { if (!empty($sessid)) { return session_id($sessid); } else { return session_id(); } } function tep_session_name($name = '') { if (!empty($name)) { return session_name($name); } else { return session_name(); } } function tep_session_close() { if (PHP_VERSION >= '4.0.4') { return session_write_close(); } elseif (function_exists('session_close')) { return session_close(); } } function tep_session_destroy() { return session_destroy(); } function tep_session_save_path($path = '') { if (!empty($path)) { return session_save_path($path); } else { return session_save_path(); } } function tep_session_recreate() { if (PHP_VERSION >= 4.1) { $session_backup = $_SESSION; unset($_COOKIE[tep_session_name()]); tep_session_destroy(); if (STORE_SESSIONS == 'mysql') { session_set_save_handler('_sess_open', '_sess_close', '_sess_read', '_sess_write', '_sess_destroy', '_sess_gc'); } tep_session_start(); $_SESSION = $session_backup; unset($session_backup); } } ?>
Guest Posted September 19, 2010 Posted September 19, 2010 Mick, You are running an outdated version of osCommerce, perhaps Rc1. You should download RC2a and update to the latest version. Your File ID should look like this: $Id: sessions.php 1830 2008-01-30 00:58:21Z hpdl $ Chris
FIMBLE Posted September 19, 2010 Posted September 19, 2010 You can try to replace the whole page with this later one, it might help you. The /tmp error can be addressed by using this add on http://addons.oscommerce.com/info/6593 <?php /* $Id: sessions.php 1830 2008-01-30 00:58:21Z hpdl $ osCommerce, Open Source E-Commerce Solutions [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url] Copyright (c) 2008 osCommerce Released under the GNU General Public License */ if ( (PHP_VERSION >= 4.3) && ((bool)ini_get('register_globals') == false) ) { @ini_set('session.bug_compat_42', 1); @ini_set('session.bug_compat_warn', 0); } if (STORE_SESSIONS == 'mysql') { if (!$SESS_LIFE = get_cfg_var('session.gc_maxlifetime')) { $SESS_LIFE = 1440; } function _sess_open($save_path, $session_name) { return true; } function _sess_close() { return true; } function _sess_read($key) { $value_query = tep_db_query("select value from " . TABLE_SESSIONS . " where sesskey = '" . tep_db_input($key) . "' and expiry > '" . time() . "'"); $value = tep_db_fetch_array($value_query); if (isset($value['value'])) { return $value['value']; } return ''; } function _sess_write($key, $val) { global $SESS_LIFE; $expiry = time() + $SESS_LIFE; $value = $val; $check_query = tep_db_query("select count(*) as total from " . TABLE_SESSIONS . " where sesskey = '" . tep_db_input($key) . "'"); $check = tep_db_fetch_array($check_query); if ($check['total'] > 0) { return tep_db_query("update " . TABLE_SESSIONS . " set expiry = '" . tep_db_input($expiry) . "', value = '" . tep_db_input($value) . "' where sesskey = '" . tep_db_input($key) . "'"); } else { return tep_db_query("insert into " . TABLE_SESSIONS . " values ('" . tep_db_input($key) . "', '" . tep_db_input($expiry) . "', '" . tep_db_input($value) . "')"); } } function _sess_destroy($key) { return tep_db_query("delete from " . TABLE_SESSIONS . " where sesskey = '" . tep_db_input($key) . "'"); } function _sess_gc($maxlifetime) { tep_db_query("delete from " . TABLE_SESSIONS . " where expiry < '" . time() . "'"); return true; } session_set_save_handler('_sess_open', '_sess_close', '_sess_read', '_sess_write', '_sess_destroy', '_sess_gc'); } function tep_session_start() { global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS; $sane_session_id = true; if (isset($HTTP_GET_VARS[tep_session_name()])) { if (preg_match('/^[a-zA-Z0-9]+$/', $HTTP_GET_VARS[tep_session_name()]) == false) { unset($HTTP_GET_VARS[tep_session_name()]); $sane_session_id = false; } } elseif (isset($HTTP_POST_VARS[tep_session_name()])) { if (preg_match('/^[a-zA-Z0-9]+$/', $HTTP_POST_VARS[tep_session_name()]) == false) { unset($HTTP_POST_VARS[tep_session_name()]); $sane_session_id = false; } } elseif (isset($HTTP_COOKIE_VARS[tep_session_name()])) { if (preg_match('/^[a-zA-Z0-9]+$/', $HTTP_COOKIE_VARS[tep_session_name()]) == false) { $session_data = session_get_cookie_params(); setcookie(tep_session_name(), '', time()-42000, $session_data['path'], $session_data['domain']); $sane_session_id = false; } } if ($sane_session_id == false) { tep_redirect(tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false)); } return session_start(); } function tep_session_register($variable) { if (PHP_VERSION < 4.3) { return session_register($variable); } else { if (isset($GLOBALS[$variable])) { $_SESSION[$variable] =& $GLOBALS[$variable]; } else { $_SESSION[$variable] = null; } } return false; } function tep_session_is_registered($variable) { if (PHP_VERSION < 4.3) { return session_is_registered($variable); } else { return isset($_SESSION) && array_key_exists($variable, $_SESSION); } } function tep_session_unregister($variable) { if (PHP_VERSION < 4.3) { return session_unregister($variable); } else { unset($_SESSION[$variable]); } } function tep_session_id($sessid = '') { if ($sessid != '') { return session_id($sessid); } else { return session_id(); } } function tep_session_name($name = '') { if ($name != '') { return session_name($name); } else { return session_name(); } } function tep_session_close() { if (PHP_VERSION >= '4.0.4') { return session_write_close(); } elseif (function_exists('session_close')) { return session_close(); } } function tep_session_destroy() { return session_destroy(); } function tep_session_save_path($path = '') { if ($path != '') { return session_save_path($path); } else { return session_save_path(); } } ?> Sometimes you're the dog and sometimes the lamp post [/url] My Contributions
MrPhil Posted September 19, 2010 Posted September 19, 2010 Deprecated: Function session_is_registered() is deprecated in /home/paradise/public_html/includes/functions/sessions.php on line 111 Deprecated: Function session_register() is deprecated in /home/paradise/public_html/includes/functions/sessions.php on line 104 PHP 5 has started "deprecating" certain function calls which are scheduled to be removed some time around PHP 6.0. This is to encourage you to move to more up to date function calls. It is certainly possible to suppress the "deprecated" warnings (with the appropriate error settings) and continue to run, but there's no promises as to how long this will work (i.e., when your host upgrades PHP and those functions are no longer available at all). N.B.: The fate of PHP 6.0 seems to be rather uncertain right now. I've heard claims that it's been scrapped. Warning: session_save_path() [function.session-save-path]: SAFE MODE Restriction in effect. The script whose uid is 2696 is not allowed to access /tmp owned by uid 0 in /home/paradise/public_html/includes/functions/sessions.php on line 148 You can either get your host to turn "off" SAFE MODE, or stop trying to use the directory /tmp (which SAFE MODE forbids access to) and use a "temp" directory of your own. Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/paradise/public_html/includes/functions/sessions.php:148) in /home/paradise/public_html/includes/functions/sessions.php on line 97 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/paradise/public_html/includes/functions/sessions.php:148) in /home/paradise/public_html/includes/functions/sessions.php on line 97 Clean up the other errors that are putting out error messages on your screen, and these will go away. Warning: date() [function.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 'Australia/Perth' for 'WST/8.0/no DST' instead in /home/paradise/public_html/includes/languages/english.php on line 329 PHP 5 uses a better time and date handling system, where it wants to know your actual timezone (given by city), and to initialize the setting with date_default_timezone_set('Australia/Perth'); on every page (say, in both application_top.php files). Or, you can put date.timezone = 'Australia/Perth'; in your php.ini file (I think that's the format, but you should check). Warning: I am able to write to the configuration file: /home/paradise/public_html/includes/configure.php. This is a potential security risk - please set the right user permissions on this file. That ones a Duh! You're supposed to change the permissions on both your configure.php files so that they are "read only" to the general public and to the program (osC/PHP), so that these important files can't be accidentally or maliciously changed. Depending on your server setup, 644 may be sufficient, or 444 may be required. On a Windows server, you would need to set "Read Only" flag in some way. If you end up making the files unwritable to the owner (you), don't forget to temporarily restore your "write" access before trying to edit them or upload new copies. As I said before the searches I hahve done have told me I need to replace the deprecated code with "$_Session" code but not where I am supposed to do this. I'm not sure exactly what changes you're referring to, but note that it's all CAPS: $_SESSION.
vampyr07au Posted September 19, 2010 Author Posted September 19, 2010 Chris The installed ver of OsCommerce is 2.2 MS2 (051113) Is the upgrade a simple drag and drop or click on the upgrade link button at the host and will this affect the current customer base list and product lists that are already in place ? The reason all this has happened is that we are moving the site from one host to another ... the old host uses php 5.2 and the new host php 5.3 .... is there an easy way to just install oscommerce at the new host from their fantastico (which is the latest version) and then migrate the customer and product lists etc ?
vampyr07au Posted September 20, 2010 Author Posted September 20, 2010 MrPhil You can either get your host to turn "off" SAFE MODE, or stop trying to use the directory /tmp (which SAFE MODE forbids access to) and use a "temp" directory of your own. Thanks I'll look into that. That ones a Duh! You're supposed to change the permissions on both your configure.php files so that they are "read only" to the general public and to the program (osC/PHP), so that these important files can't be accidentally or maliciously changed. Depending on your server setup, 644 may be sufficient, or 444 may be required. On a Windows server, you would need to set "Read Only" flag in some way. If you end up making the files unwritable to the owner (you), don't forget to temporarily restore your "write" access before trying to edit them or upload new copies. yeah i sorta figured that. Will get that fixed. PHP 5 uses a better time and date handling system, where it wants to know your actual timezone (given by city), and to initialize the setting with date_default_timezone_set('Australia/Perth'); on every page (say, in both application_top.php files). Or, you can put date.timezone = 'Australia/Perth'; in your php.ini file (I think that's the format, but you should check). OK thanks :)
Guest Posted September 20, 2010 Posted September 20, 2010 Mick, It's time to update to the latest stable version as you will find more incompatibilities and security problems with the MS2 version as time goes on. Chris
vampyr07au Posted September 20, 2010 Author Posted September 20, 2010 Once again I need someone to clarify for me whether or not this is a simple reinstall process or if I will lose my client and product data ? Is it as simple as drag & drop or push a button to install latest version over the top without affecting the current client and product data ?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.