Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Get rid of some PHP errors using 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 (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 = [ ] ;


    $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)




Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...
  • 1 month later...


This topic is now archived and is closed to further replies.

  • Create New...