Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.1 Compatibility #2708

Closed
abrookbanks opened this issue Dec 3, 2020 · 12 comments
Closed

PHP 8.1 Compatibility #2708

abrookbanks opened this issue Dec 3, 2020 · 12 comments
Assignees
Milestone

Comments

@abrookbanks
Copy link
Member

This will require a lot of testing!

e.g. https://www.php.net/releases/8.0/en.php#saner-string-to-number-comparisons

@abrookbanks abrookbanks self-assigned this Dec 3, 2020
@bhsmither
Copy link
Contributor

Not to mention Smarty has a lot of work to be done to make it PHP8 Compatible.

Testing the /setup/ of CC642 under PHP8 now.

Setup died on the page asking for database info:

  	<h3>Database Settings</h3>
	<fieldset>
	  <div><label for="form-dbhhost" class="help" rel="" title="This is the database hostname e.g. localhost">Database Host</label><span><input type="text" name="global[dbhost]" id="form-dbhost" value="

and nothing after that.

@abrookbanks
Copy link
Member Author

CubeCart v7 then. Who's in?

@abrookbanks
Copy link
Member Author

smarty-php/smarty#605

@bhsmither
Copy link
Contributor

I've been watching this.

abrookbanks added a commit that referenced this issue Feb 25, 2022
@abrookbanks abrookbanks added this to the 6.4.6 milestone Jun 1, 2022
@abrookbanks abrookbanks changed the title PHP 8 Compatibility PHP 8.1 Compatibility Jun 1, 2022
@bhsmither
Copy link
Contributor

If you haven't seen it yet, I've compiled a report on everything (as of that date) I have found to change for PHP8.1:

https://forums.cubecart.com/topic/57813-php-81-making-cubecart-compatible/

@abrookbanks
Copy link
Member Author

No I hadn't seen this. Thank you so much Brian. It will be a big help.

@abrookbanks
Copy link
Member Author

Thanks Brian. You put a lot of work into this. Some of it had been done already. :)

The following block still needs attention. I have concerns about customisations especially around combine and minification ....

Go to https://github.com/smarty-php/smarty/releases/latest
and download the latest release of Smarty (currently at 4.1.0).

Within CubeCart's /includes/lib/ folder, rename the existing 'smarty' folder to 'smarty-3133'.
Create a new folder named 'smarty'.

Unzip the Smarty 4.1.0 package and copy over the contents of the 'libs' folder into CubeCart's new 'smarty' folder.
Then, from the 'smarty-3133 folder, copy over the 'filters' folder, the 'plugins/minify' folder, and the 'plugins/function.combine.php' file.

Then, in Smarty.class.php, line 169, from:
    public static $_DATE_FORMAT = '%b %e, %Y';
To:
    public static $_DATE_FORMAT = 'M j, Y';

abrookbanks added a commit that referenced this issue Jun 10, 2022
@abrookbanks abrookbanks pinned this issue Jun 10, 2022
abrookbanks added a commit that referenced this issue Jun 10, 2022
@abrookbanks
Copy link
Member Author

All seems to be working well. Thank you boss!

abrookbanks added a commit that referenced this issue Jun 10, 2022
@abrookbanks
Copy link
Member Author

Closing this as everything appears to be working fine. Although closed the error log will be continually monitored and any 8.1 compatibility changes made accordingly.

@bhsmither
Copy link
Contributor

bhsmither commented Jun 10, 2022

In my report, I changed gui.class.php, line 361:

From:
                if (!in_array($_GET['_a'], array('basket', 'cart', 'complete', 'checkout', 'confirm', 'gateway')) && !$GLOBALS['config']->get('config', 'catalogue_mode')) {
To:
                if (isset($_GET['_a']) && !in_array($_GET['_a'], array('basket', 'cart', 'complete', 'checkout', 'confirm', 'gateway')) && !$GLOBALS['config']->get('config', 'catalogue_mode')) {

I find that in some cases, $_GET['_a'] is not set - viewing the homepage, for example. The change in given in the report causes displaySideBasket() to not be executed.

There needs a different solution here. This seems to work:

if (!isset($_GET['_a']) || !in_array($_GET['_a'], array('basket', 'cart', 'complete', 'checkout', 'confirm', 'gateway')) && !$GLOBALS['config']->get('config', 'catalogue_mode')) {

@abrookbanks
Copy link
Member Author

Cool thanks so much for this.

@bhsmither
Copy link
Contributor

Please note a second report has been posted to the forum with some additional findings.

https://forums.cubecart.com/topic/57813-php-81-making-cubecart-compatible/?do=findComment&comment=251467

abrookbanks added a commit that referenced this issue Jun 15, 2022
abrookbanks added a commit that referenced this issue Jul 5, 2022
abrookbanks added a commit that referenced this issue Jul 5, 2022
abrookbanks added a commit that referenced this issue Jul 5, 2022
@abrookbanks abrookbanks unpinned this issue Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants