Forum Moderators: buckworks

Message Too Old, No Replies

osCommerce - PHP5

osCommerce is broken in PHP5. How to fix?

         

bomdemais

7:01 am on Jul 7, 2005 (gmt 0)

10+ Year Member



I just upgraded to PHP 5 (on Redhat Linux) and it broke osCommerce. I saw this comment in an old post about how to make osCommerce work in PHP5:

> all you need to do is to open up admin\includes\classes\upload.php and edit the line on or about line #31 that says
$this = null; to be
//$this >= null; and that should fix the issue.

That fixed one problem. But then the next problem I encountered was this:

PHP Fatal error: main() [<a href='function.main'>function.main</a>]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition &quot;navigationHistory&quot; of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in /var/cvsroot/lc_all/webapps/ecommerce/catalog/includes/application_top.php on line 316

The 2nd oscommerce page you visit, when the navigationHistory object is found in the session, it is an "incomplete class." Dumping with print_r:


(
[__PHP_Incomplete_Class_Name] => navigationHistory
[path] => Array
(
[0] => Array
(
[page] => index.php
[mode] => NONSSL
[get] => Array
(
)

[post] => Array
(
)

)

)

[snapshot] => Array
(
)

)


Anybody know how to fix this? What other probs are there?

Thanks!

bomdemais

8:02 am on Jul 7, 2005 (gmt 0)

10+ Year Member



OK, I figured out the answer to my own question. I thot I'd post it in case anyone has the same prob.

I changed the navigation history code in application_top.php to this:

[pre]
// navigation history
if (tep_session_is_registered('navigation')) {
if (PHP_VERSION < 4 ¦¦ PHP_VERSION >= 5) {
$broken_navigation = $navigation;
$navigation = new navigationHistory;
$navigation->unserialize($broken_navigation);
}
} else {
tep_session_register('navigation');
$navigation = new navigationHistory;
}
$navigation->add_current_page();
[/pre]

I'm not sure _why_ we need to "fix" the navigationHistory in PHP5, but oh well, it works.

I also had to add a php5 section for session.auto_start in .htaccess to get rid of warning (since i run with session.auto_start turned on):
<IfModule mod_php4.c>
php_value session.auto_start 0
</IfModule>
<IfModule mod_php5.c>
php_value session.auto_start 0
</IfModule>

Hope this helps someone.

Anybody found any other PHP5 issues with oscommerce?

henry0

10:48 pm on Jul 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Bomdemai
Good tips
Thanks, and welcome to WebmasterWorld.

lorax

2:17 am on Jul 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Asked and answered. I like it! ;)

Welcome to the forums bomdemais!

bomdemais

7:57 am on Jul 9, 2005 (gmt 0)

10+ Year Member



thanx... friendly forum