Jump to content

php version


keat

Recommended Posts

if you use any third party modules, they are typically encoded for a specific PHP version. if you swap out your PHP version you may need to replace the installed version of the module with the version targeting your new PHP version. 

I provide support for PHP 5.4 to the latest version of PHP for all my modules and downloads for various PHP versions can be found via the CubeCart marketplace our my website downloads area.

 

Link to comment
Share on other sites

1 minute ago, Al Brookbanks said:

Yes this can be a real problem. It would be good if we could avoid encrypting code at all. 

We need to protect our IP, otherwise I would agree. Until there is a more viable method there isn't much choice. happy to explore alternatives should you know of any viable ones?

Link to comment
Share on other sites

My server is currently on 7.0.33 ( I think).

Im considering a server migration and wondered if I just stick with V7.0 or upgrade to 7.3.

Maybe I'll stick with 7.0 in the short term and consider 7.3 when I know the migration is stable.

 

makes sense I guess to get it working first I guess.

Link to comment
Share on other sites

6 minutes ago, keat said:

My server is currently on 7.0.33 ( I think).

Im considering a server migration and wondered if I just stick with V7.0 or upgrade to 7.3.

Maybe I'll stick with 7.0 in the short term and consider 7.3 when I know the migration is stable.

 

makes sense I guess to get it working first I guess.

Totally understand. 

Link to comment
Share on other sites

I tried it briefly this evening and got the following error.

 

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /home/user-acc/public_html/classes/db/mysql.class.php:40 Stack trace: #0 /home/user-acc/public_html/classes/db/mysql.class.php(68): Database->__construct(Array) #1 /home/user-acc/public_html/controllers/controller.index.inc.php(22): Database::getInstance(Array) #2 /home/user-acc/public_html/index.php(20): include('/home/user-acc...') #3 {main} thrown in /home/user-acc/public_html/classes/db/mysql.class.php on line 40

 

Line 40 shows:

if (($this->_db_connect_id = mysql_connect($config['dbhost'].$dbport, $config['dbusername'], $config['dbpassword'], false, MYSQL_CLIENT_COMPRESS)) === false) {
      

 

Any ideas ?

Link to comment
Share on other sites

I think I may have narrowed this down to a missing PHP module.

I messed about with a few modules, but suspect it was php73-php-mysqlnd

Now the site loads with PHP 7.3, but I've uncovered another issue on some of the older V6 sites.

Deprecated: Function create_function() is deprecated in /home/cabletie/public_html/classes/config.class.php on line 266

Link to comment
Share on other sites

I tried to be clever thinking I could copy the script from:

 

private function _clean($array) {
        array_walk_recursive($array, create_function('&$s,$k', '$s=stripslashes($s);'));
        return $array;

 

to:

 

private function _clean($array)
    {
        array_walk_recursive($array, function (&$s, $k) {
            return $this->_stripslashes($s);
        });
        return $array;

 

But this just chucks up another error.

Could anyone suggest a simple fix ?

 

 

Link to comment
Share on other sites

Fatal error: Uncaught Error: Call to undefined method Config::_stripslashes() in /home/zzzzzzzzzzzzz/public_html/classes/config.class.php:268 Stack trace: #0 [internal function]: Config->{closure}('xxxxxxxxxx', 'store_name') #1 /home/zzzzzzzzz/public_html/classes/config.class.php(269): array_walk_recursive(Array, Object(Closure)) #2 /home/zzzzzz/public_html/classes/config.class.php(69): Config->_clean(Array) #3 /home/zzzzzzzzzzzzz/public_html/classes/config.class.php(110): Config->__construct(Array) #4 /home/zzzzzzzzzz/public_html/controllers/controller.index.inc.php(22): Config::getInstance(Array) #5 /home/zzzzzzzz/public_html/index.php(20): include('/home/zzzzzzz...') #6 {main} thrown in /home/zzzzzz/public_html/classes/config.class.php on line 268

 

 

Also may I add.

If I copy config.class.php from my 6.2.6 site to this 6.1.5 site, the site appears to function correctly.

However, I don't know what the implications of leaving it are, so I rolled back.

Link to comment
Share on other sites

Have you made any edits to the /classes/config.class.php file?

In a stock CC615 (I assumed you were working with CC628), the problem that PHP is complaining about is on line 266.

Also in that file, there is the method _stripslashes() on line 322.

If you have changed anything in that file, review the changes. You may wish to download the CC615 package and compare the stock file with your copy.

Link to comment
Share on other sites

Disregard my two previous posts, as these came about after my ham fisted attempt to try and fix this in my own clumsy manner.

They only probably confuse matters.

I don't see any errors on the 6.1.5 sites when running PHP7.0

On the 6.1.5 site i see the following error when running on  PHP 7.3

Deprecated: Function create_function() is deprecated in /home/cabletie/public_html/classes/config.class.php on line 266

 

I understand that ' create_function ' was depreciated in PHP 7.2, but as I don't profess to understand PHP, I don't know how to fix it.

Link to comment
Share on other sites

Regardless, let's do this:

In config.class.php, near line 265, find what looks like (yours might be slightly different):

	private function _clean($array) {
		array_walk_recursive($array, function(&$s,$k){return $this->_stripslashes($s);});
		return $array;
	}

Change to:

	private function _clean($array) {
		array_walk_recursive($array, function(&$s,$k){$s = $this->_stripslashes($s);});
		return $array;
	}


Also, near line 221, find what looks like (yours might be slightly different):

		//Clean up the config array
		if (is_array($data) && !empty($element)) {
  			array_walk_recursive($data, function(&$s,$k){return $this->_stripslashes($s);});
  			$data = $this->_json_encode($data);
		} else if (is_array($data)) {
  			array_walk_recursive($data, function(&$s,$k){return $this->_stripslashes($s);});

Change to:

		//Clean up the config array
		if (is_array($data) && !empty($element)) {
  			array_walk_recursive($data, function(&$s,$k){$s = $this->_stripslashes($s);});
  			$data = $this->_json_encode($data);
		} else if (is_array($data)) {
  			array_walk_recursive($data, function(&$s,$k){$s = $this->_stripslashes($s);});

When I say yours might be slightly different, I mean that CC615 does not use create_function() on line 266. I still recommend you download CC615 from CubeCart HQ's Downloads page and compare the two versions of this file.

The edits above implements the suggested change as posted in the Github.

Link to comment
Share on other sites

I applied the code changes on one site and changed php to use 7.3 on just that site.

I don't see the error any more.

 

I'll compare the two files on monday when I'm back in the office.

Thanks for this yet again.

 

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...