Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)

 
Reply
   X-Cart forums > News and Announcements
 
Thread Tools
  #11  
Old 11-13-2013, 10:22 PM
 
aim aim is offline
Advanced Staff Users
 

X-Cart team
  
Join Date: Dec 2008
Posts: 928
 

Default Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)

Quote:
Originally Posted by michaelt13
I used your trick and it solved a few problems, but I still running into these warnings:

Code:
Warning: Invalid argument supplied for foreach() in /home/rebe/public_html/shop/prepare.php on line 240 Warning: Invalid argument supplied for foreach() in /home/rebe/public_html/shop/prepare.php on line 245 Warning: Invalid argument supplied for foreach() in /home/rebe/public_html/shop/prepare.php on line 251 Warning: Invalid argument supplied for foreach() in /home/rebe/public_html/shop/prepare.php on line 254 Warning: Invalid argument supplied for foreach() in /home/rebe/public_html/shop/prepare.php on line 307 Warning: reset() expects parameter 1 to be array, string given in /home/rebeccac/public_html/shop/prepare.php on line 314 Warning: Invalid argument supplied for foreach() in /home/rebeccac/public_html/shop/prepare.php on line 307 Warning: reset() expects parameter 1 to be array, string given in /home/rebe/public_html/shop/prepare.php on line 314 Warning: Invalid argument supplied for foreach() in /home/rebe/public_html/shop/prepare.php on line 307 Warning: reset() expects parameter 1 to be array, string given in /home/rebe/public_html/shop/prepare.php on line 314 Warning: Invalid argument supplied for foreach() in /home/rebe/public_html/shop/prepare.php on line 307 Warning: reset() expects parameter 1 to be array, null given in /home/rebe/public_html/shop/prepare.php on line 314 Warning: Invalid argument supplied for foreach() in /home/rebe/public_html/shop/prepare.php on line 317



http://bt.x-cart.com/file_download.php?file_id=11530&type=bug


http://bt.x-cart.com/view.php?id=43030


IMPORTANT UPDATE based on post #11 of this thread:

Versions 4.1.9 and older require an additional patch (register_long_arrays_for_xc_lt_4.1.10.ver2.diff )

This patch is provided as is, upon request, without testing, as these X-Cart versions are out of guarantee.
__________________
Sincerely yours,
Ildar Amankulov
Head of Maintenance group
Reply With Quote
  #12  
Old 12-05-2013, 11:50 PM
 
spwestwood spwestwood is offline
 

Member
  
Join Date: Aug 2007
Posts: 17
 

Default Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)

In case someone who finds this is running X-Cart's Mediatemple's DV server, and they upgrade you from DV 3.5 to DV 4.0 (and thereby to PHP 5.4.13, breaking your xcart and giving you the "Please contact your host administrators and ask them to correct PHP-settings for your site according to the requirements above." error for the register_long_arrays flag):

You can use the scripts on this page to reinstall PHP 5.2.17 on CentOS 6.4 x64, register it with Parallels Plesk, and get X-Cart up and running again:

http://forum.parallels.com/showthread.php?290399-Plesk-11-5-Easy-Install-Script-for-Multiple-PHP-CentOS-6-4-x64
__________________
spwestwood.
Version 4.1.9
Version 4.4
Reply With Quote
  #13  
Old 12-27-2013, 01:59 AM
 
alvaro_nv alvaro_nv is offline
 

Newbie
  
Join Date: Dec 2013
Posts: 3
 

Default Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)

Hello

I cant find the php patch, can somebody help with it?

Thank you
__________________
Xcart 4.5.0
Reply With Quote
  #14  
Old 12-27-2013, 02:10 AM
  Ksenia's Avatar 
Ksenia Ksenia is offline
 

X-Cart team
  
Join Date: Apr 2013
Posts: 735
 

Default Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)

Quote:
Originally Posted by alvaro_nv
I cant find the php patch, can somebody help with it?
It depends on the version of your store. So please consider submitting a new ticket to the HelpDesk. Specify the URL of the store or its version there, and the specialists will give out the corresponding patch.
__________________
X-Cart team
Reply With Quote

The following user thanks Ksenia for this useful post:
alvaro_nv (12-27-2013)
  #15  
Old 01-02-2014, 02:45 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)

WARNING!!!

Anyone running older XC versions - you need to either upgrade or do NOT switch to PHP 5.4.x. Talk to your host first and make sure they know about this (Emerson EWD Hosting knows now)

This has been tested (understand - it shutted down a site) on a site running 4.1.8 but it very well may be the case for any XC version below 4.4.x. The site had both 5.3.x and 5.4.x patches applied. All that was accessible on it was home page and direct php scripts.

The reason (from what I found) - XC relies on register_globals to be ON. This php setting has been deprecated in PHP 5.3.x and completely taken out in PHP 5.4.x and up. So this url

www.domain.com/home.php?cat=10

will not pass cat variable to XC scripts in PHP 5.4.x because XC uses it directly as

$cat

instead of

$cat = $_GET['cat'];

type of code, causing $cat in this case to be always 0 which is home page. Same applies to $page, $productid, etc variables passed to the scripts by the urls.

Site in question is now running just fine after host downgraded to PHP 5.3.x, of course this should not have happen and site owner is advised, but....

QT - this post is misleading since the patch provided doesn't fix older XC versions for use with PHP 5.4.x and up. Please fix and provide new 5.4.x patch.

This does not affect newer XC releases like 4.5.x and 4.6.x

P.S. If anyone had tested or running older versions of XC on PHP 5.4.x without any issues please share so we can get to the bottom of this....
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #16  
Old 01-03-2014, 07:08 AM
 
exsecror exsecror is offline
 

X-Wizard
  
Join Date: Apr 2007
Posts: 1,284
 

Default Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)

We're running 4.2.3 with PHP 5.5.7 and haven't encountered any issues. The only thing we had to do was replace some deprecated eregi methods.
Reply With Quote
  #17  
Old 01-03-2014, 08:23 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)

Quote:
Originally Posted by exsecror
We're running 4.2.3 with PHP 5.5.7 and haven't encountered any issues. The only thing we had to do was replace some deprecated eregi methods.

That was my understanding as well and yet there is definitely something with XC 4.1.x and PHP 5.4.x.

4.1.8 auth.php

PHP Code:
$cat intval(@$cat);
$page intval(@$page); 

and cart was serving home page only under PHP 5.4.x no matter which category you click on. $cat and $page were always 0. As soon as I changed them to

PHP Code:
$cat intval(@$_GET['cat']);
$page intval(@$_GET['page']); 

they were assigned their proper values and category pages started to show up. Same with $productid in product.php....

So I thought it is the register_globals, reverted everything back and host downgraded to PHP 5.3.x - and no issues.

Although now host is saying register_globals is still OFF yet site works....

So there is definitely something with XC 4.1.x and PHP 5.4.x

The other thing that comes to mind and could be the reason is the "register_long_arrays" - also removed in PHP 5.4.x and required to be ON in older versions of XC
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #18  
Old 01-03-2014, 08:36 AM
  photo's Avatar 
photo photo is offline
 

X-Wizard
  
Join Date: Feb 2006
Location: UK
Posts: 1,146
 

Default Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)

I just tested Xcart 4.1.10 on PHP 5.4.22 and the site will not load. I get the following error messages,

1. register_long_arrays = Failed Please check php.ini to correct problem
2. register_globals = Warning Emulation is used
__________________
v4.1.10
In Dev v4.5.x


"If you don't keep an eye on your business, someone else will."
Reply With Quote

The following user thanks photo for this useful post:
cflsystems (01-03-2014)
  #19  
Old 01-03-2014, 08:42 AM
  chamberinternet's Avatar 
chamberinternet chamberinternet is offline
 

X-Wizard
  
Join Date: Sep 2005
Location: Lancashire, UK
Posts: 1,470
 

Default Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)

I get the following running XC 4.1.3 on PHP 5.4.21 (See Attachment)
Attached Images
File Type: jpg XC-4.1.3.jpg (67.7 KB, 31 views)
__________________
Developing in 4.7.x now (Dipping into v5 - Slowly!)
Have used 4.1.x, 4.2.x, 4.4.x, 4.5.x, 4.6.x & 4.7.x
Multiple Instances of X-Cart
MySQL 5.6.37
CentOS 7.4


Chamber Internet
- Lancashire, United Kingdom
http://www.chamberelancs.co.uk
Reply With Quote

The following user thanks chamberinternet for this useful post:
cflsystems (01-03-2014)
  #20  
Old 01-03-2014, 08:43 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)

Thanks for confirming. Is this going to be another not tested patch?
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
Reply
   X-Cart forums > News and Announcements


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 03:01 AM.

   

 
X-Cart forums © 2001-2020