Jump to content
user_lambda

Get rid of some PHP errors using 2.3.4.1 and PHP 7+

Recommended Posts

Well, just found out how to solve 2 php errors I've got using php7+.

Let's share it:

If you run 2.3.4.1 (latest official version), it runs fine on php5+ (for exemple with the last release 5.6.40 which is from 2019!).

But, when you switch to php7 you get (at least) two errors at admin panels :

1. at "Categories / Products" :

Warning: sizeof(): Parameter must be an array or an object that implements Countable in C:\EasyPHP-Devserver-17\eds-www\oscommerce2341\catalog\adminUyhGTfDES458\includes\functions\general.php on line 89
AND categories.php on line 909

SOLUTION:  find "application_top.php" under admin/includes

somewhere around line 231, find :

    $current_category_id = $cPath_array[(sizeof($cPath_array)-1)];
  } else {

just add this line   $cPath_array = [ ] ;

before

    $current_category_id = 0;
  }

and you are done.
 

The second error I've got is at tools / "Security Checks" panel (that didn't work at all) :

Warning: Creating default object from empty value in C:\EasyPHP-Devserver-17\eds-www\oscommerce2341\catalog\adminUyhGTfDES458\security_checks.php on line 87
Fatal error: Uncaught Error: Call to undefined method stdClass::pass() in C:\EasyPHP-Devserver-17\eds-www\oscommerce2341\catalog\adminUyhGTfDES458\security_checks.php:92 Stack trace: #0 {main} thrown in C:\EasyPHP-Devserver-17\eds-www\oscommerce2341\catalog\adminUyhGTfDES458\security_checks.php on line 92

Look into the file admin / "security_checks.php". 

Find and replace : $secCheck = $$module['class'];   by  $secCheck = $GLOBALS[$module['class']];   (somewhere around line 81)

and you are done.

I found this out (the lucky way) by examining the related code in "osCommerce2-2.4.2 Joli Beta" which works fine on php7 (but unfortunately some of its fonctions were not implemented, and I'm not a pro coder).

Hope it can help for someone. (files modified attached if you need it)

 

security_checks.php

application_top.php

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×