PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
Hi folks.
More and more hosting providers tend to upgrade PHP to v 5.4. At the same time, there are some stores powered by X-Cart v.4.0.x; 4.1.x, which are not compatible with it out of the box. The maintenance team has developed the PHP 5.4 compatibility patch for them. WHAT ABOUT OTHER VERSIONS: 4.2.0 - 4.2.2 do NOT require this patch if older '4.5.3-compatibility patch' is installed ( it makes your store PHP 5.4 compatible too). 4.2.3 or higher is PHP 5.4 compatible out of the box. APPLY THESE FIRST: Before you apply this patch, you should make sure that the corresponding '4.5.3-compatibility patch' is already installed: for 4.0.19: php5.3.x-patch-2010-06-15_4.0.19.tgz for 4.1.12: php5.3.x-patch-2010-04-12_4.1.12.tgz AFTER THE PATCH IS APPLIED: Make sure $debug_mode is NOT set to 3 in config.php WHERE TO FIND THE PATCHES Download the patch (the 'patch-name-{date}_{version}.tgz' archive file) from the 'File area' section of your Qualiteam account. You can find the patch at X-Cart -> X-Cart supporting files for prev versions -> {Your X-Cart branch} -> {Your X-Cart version} -> Updates and patches 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. |
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
Excellent. Our hosting provider has just updated to 5.4 and our store went down. They've reverted us back to 5.2 but are phasing it out by EOM (supposedly). Thank you for creating a patch!
|
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
I'm looking at applying the php 5.3 patches to our 4.1.10 x-cart.
All seems like it's going to work except: func.compat.php not found - but I saw the work around for that in another thread. init.php - could not patch - patch cannot be applied to this file automatically because it was significantly modified, the patch for this file should be applied manually, I compare the script for both versions and it seems the only difference I can find is to add: x_load('db','files', 'compat'); func_set_memory_limit("16M"); # # Aloow displaying content in functions, registered in register_shutdown_function() # $zlib_oc = ini_get("zlib.output_compression"); if (!empty($zlib_oc) || func_version_compare(phpversion(), "4.0.6") <= 0) define("NO_RSFUNCTION", true); unset($zlib_oc); if (func_version_compare(phpversion(), "5.3.0") >= 0) { define('X_PHP530_COMPAT', true); } if (function_exists('date_default_timezone_get') && function_exists('date_default_timezone_set')) @date_default_timezone_set(@date_default_timezone_ get()); if (!@is_readable($xcart_dir."/config.php")) { echo "Can't read config!"; exit; } Before I go ahead and screw it up, can you confirm that's all I need to do? |
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
Nevermind, I did it anyway and it worked. Now running PHP5.3 which should keep us going for a little while longer.
|
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
Just a heads up on the patches, cart code and php warning messages. I do not see this with 4.6.x but I see it on 4.5.x and earlier version
PHP 5.4.x will throw out a warning message on some of the XC stock code. Just an example from 4.4.x but I suspect earlier versions is even worst Quote:
The code there is Code:
foreach ($cart['products'] as $cart_item) { and the warning is caused by the fact that most likely $cart_item['variantid'] has no value or its value is not numeric From PHP docs - http://docs.php.net/manual/da/language.types.array.php Quote:
This happens on like dozen places in stock XC code from what I've seen. It won't prevent cart from working but makes the patches incomplete |
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
Hi Steve,
Thank you for letting us know. We have reuploaded these patches: php5.3.x-patch-2010-04-12_4.1.12.tgz php5.3.x-patch-2010-04-12_4.2.0.tgz php5.3.x-patch-2010-04-12_4.2.1.tgz php5.3.x-patch-2010-04-12_4.2.2.tgz php5.3.x-patch-2010-06-15_4.0.19.tgz We have implemented the workaround, the changes are in init.php - $x_error_reporting = $x_error_reporting & !(E_DEPRECATED | E_USER_DEPRECATED); + $x_error_reporting = $x_error_reporting & ~(E_DEPRECATED | E_USER_DEPRECATED); After applying the patch, if $debug_mode = 2, PHP notices will be recorded into the logs, but not displayed. To completely fix these warnings/notices, a very large patch ( 60-80 commitments) is required, so because of large scope of work the team of architects decided not to dig into it further, as the problem is not critical. We're concentrating on the current branch instead. |
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
Thanks Ksenia, this post was more of to bring QT's attention to the issue so you guys can fix it and have proper code in 4.6.x. The error reporting is not a fix, it just hides the problem from front end :)
Anyway since these are not critical but just warnings I guess this works sort of |
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
Quote:
Does this work for X-Cart 4.1.9? I've been trying to look for patch in folder version 4.1.9 but I do not see patch file. Can you help with version 4.1.9? |
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
The patch is under 4.1.12 directory. You will have to apply it manually to 4.1.9
|
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
Quote:
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 |
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
Quote:
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. |
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 |
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 |
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
Quote:
|
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.... |
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.
|
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
Quote:
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:
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:
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 |
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 |
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
1 Attachment(s)
I get the following running XC 4.1.3 on PHP 5.4.21 (See Attachment)
|
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?
|
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
Quote:
Thanks for bringing this issue up Steve. Please update this thread if/when you find out anything. Lets hope we get a responce from QT on this asap. I am looking to upgrade to v4.6.x but with not saving annon customer data not yet resolved as well as a couple of other issues I been dragging my feet. |
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
Wasn't this already addressed by QT in
http://bt.x-cart.com/view.php?id=43030 See the extra patch added there. Basically you need to add to top.inc.php: # If register_long_arrays = off (php5) if (empty($HTTP_SERVER_VARS)) { $HTTP_SERVER_VARS = (array)$_SERVER; $HTTP_GET_VARS = (array)$_GET; $HTTP_POST_VARS = (array)$_POST; $HTTP_COOKIE_VARS = (array)$_COOKIE; $HTTP_POST_FILES = (array)$_FILES; $HTTP_ENV_VARS = (array)$_ENV; } |
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
Thank you for this link.
This is the problem - first the bugtracker does not work and it is easier to find a fly on elephant's ass than something in the bugtracker; and the link to this very important fix is just posted without any explanation of what it is or for what - I missed it.... FOR THE OTHERs WHICH SEEMS TO MISSED IT AS WELL - POST #11 This is still a major flow of how to handle the situation given the fact that the bug tracker basically does not exist in the shape it is right now and Post#11 could have mentioned something to bring up everyones attanetion to this.... |
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
Is it too much to ask for Bug Tracker to at least be back to what it was before the recent change, some context on the BT links in this thread, and the first post be updated so it reads as a single comprehensive guide?
|
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
Thank you, the 1st post of the thread is updated to include the info from post #11.
|
Re: PHP 5.4 compatibility for older versions of X-Cart (4.1.19; 4.1.12)
I am not sure if anyone has thought of this until it may have been too late, but has anyone taken add on mods into consideration with php 5.4 comparability?
I see everyone has spoken of cart compatibility from as early as inception, but no one has said if they had issues with their mods or add ons. I have a lot of both, and I wonder if anyone has had issues with any of BCS's, Jon's CDSEO, Altered Cart, Firetank mods or add ons etc? Would anyone like to chime in and let us know if they upgraded to 5.4.x and lost the use of some mods? The reason I say this is MySQL is also upgraded when updating php to 5.4.x, and once it is updated you cannot downgrade MySQL so it would be a total loss and big issues. Have you had issues or total success, or have you not tested add ons or mods post update and just don't know? |
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
I have applied the php5.3.x-patch-2010-04-12_4.1.12 to my 4.1.11 X-cart store as I have been prompted by our ISP they will be changing soon to PHP 5.3 .
When looking into summary under php info, the site is still saying that is running PHP 5.2.17. How can I check that the patch has been applied properly ? |
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
If you have applied the patch (modified the files) then it is applied. The PHP version under Summary is the PHP installed on the server - it has nothing to do with XC. This number will change if/when your host upgrades PHP.
|
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
i was able to fix my XCART Version 4.1.10 to perfect work under PHP 5.4 just by going to the check_requirements.php and editing line 162 from 1 to 0 for the option :
if (phpversion() >= "5.0.0") { $CHECK_REQUIREMENTS["req_vars"][] = array ( "option" =>"register_long_arrays", "req_val" =>1, "real_val"=>"", "critical"=>0); } i hope this can help anybody else with the same issue :D Junior |
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
Quote:
The crash was due to a PHP5.3 entry in the php.ini file that conflicted with PHP5.4. The php.ini file was not needed so it was removed and the cart was back online. However, later in the day I found hundreds of those dreaded "Illegal string offset" warnings caused by xcart's modules and third party add-on modules. I understand that these warnings will not cause the cart to fail. However, I decided that rather than fill the logs with warnings (or force their suppression), I instead reverted back to PHP5.3. Fortunately my host's control panel allows the users to select the version they want. The default PHP5.3 settings were chosen; All is back to normal now. |
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
Have have recently revised our code in 4.0.19 to take on all the security fixes and these updates to fix PHP 5.4. On the surface all looks OK, but in the x-errors_php.txt error log we are now seeing various issues, these first 2 were fine under PHP 5.3, the last seems to be worst or more obvious since we have started to look at the logs more:
Issue1: Alot of these (1 every 20-40 seconds Code:
[22-Jul-2014 20:49:11 Europe/London] PHP Strict Standards: Only variables should be passed by reference in /home/user/public_html/Smarty-2.6.9/Smarty_Compiler.class.php on line 804 Issue 2: Seems MKTime() is depreciated: Quote:
Code:
[21-Jul-2014 18:27:41 UTC] PHP Strict Standards: mktime(): You should be using the time() function instead in /home/user/public_html/admin/statistics.php on line 98 I have looked at mktime() - I understand what is happening there, but a bit lost for a viable solution to replace it. Issue 3: Now these been around since our logs go back - is this a Hack attempt? Should we be worried? Code:
[19-Jul-2014 21:13:00 Europe/London] PHP Warning: include(/home/user/public_html/templates_c/%%3D^3DF^3DF7CB4F%%checkout.tpl.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in /home/user/public_html/Smarty-2.6.9/Smarty.class.php on line 1861 I have searched to see if anyone else reported this, but cant find anything. Surely we can not be the only site to see this if it is a hack/exploit attempt? Thanks |
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
1. Can't help on this one.
2. The php manual states that mktime()'s $is_dst param is depreciated, not the entire function. So look for mktime() useage that has 7 parameters (ignore those with 6 or less). The 7th param (when used) is the depreciated $is_dst. As a cheap workaround perhaps you could try removing the offending extra param and see what happens. 3. The weird names in the templatesC directory are the compiled templates. Have you tried admin->Maintenance: Clear templates/X-Cart cache? Or maybe temporarily disable Settings->General Settings: Do not check if templates are changed (Smarty compile_check), and see if any of the related warnings are suppressed. Not sure if you have this feature in your version, so don't panic if it's missing. |
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
For Issue 1, I'm taken the folder Smarty-2.6.19 from X-Cart 4.1.12 and testing that - this seems to have stopped the issues there (I thinking that is more PHP 5.4 happy). This means editing prepare.php and smarty.php to point to the new folder.
For Issue 2, from what I can see in the logs it appears when just mktime() is used, so I have replaced that with time() and that seems to have cureced that. A quick seach through the code base shows that users.php also has an ocurrance, so I have amended that also. Quote:
I am leaning toward my paranoia of hacks and malware, but when its on the live system I will see if the copy of Smarty in Issue 1 may clear this too. |
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
Quote:
I am unable to access the php5.3.x-patch-2010-04-12_4.1.12.tgz Please advise Thank You |
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
I was provided the patch by the great folks at Qualiteam, thanks!
|
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
I did the patches explained here to update a 4.1.8 store. I am having an issue where now the order id numbers are not incrementing. Each order coming in is using the previous order number and overwriting the previous order. Does anyone have any suggestions?
|
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
Have you checked the MySQL tables for orders make sure integraty check is all OK?
My understanding is the number is auto generated there that XCart then reads back and uses. Might be worth just running a check / repair |
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
ok so as an update it appears the problem is related to only orders processed through our credit card processor and not other payment methods. I will contact the developer of the mod we are using.
|
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
Quote:
Could you please advise: 1. How do you count 162 lines? My Notepad has 15 long lines for this file. 2. Did you change it already in this code? "req_val" =>1, "real_val"=>"", "critical"=>0) In other words, did you have "req_val" =>1 and then change it to "req_val" =>0 ? Or did you have "critical"=>1) and then changed it to "critical"=>0) ? Which one? Thanks! |
Re: PHP 5.4 compatibility for older versions of X-Cart (4.0.19; 4.1.12)
Disappointed that T-HUB won't be supporting PHP7, causing such a delay for us to launch PHP7. :|
|
All times are GMT -8. The time now is 10:29 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.