June '23 Office Hours Recap - PHP 8.2 Upgrade & Rector Demo

Our focus was on the PHP 8.2 upgrade in SugarCloud and the steps necessary to get custom code PHP 8.2 compatible. Upgrades will begin soon on SugarCloud stacks so act now!

Session Highlights

PHP 8.2 Upgrade Plan

Rafa has reviewed the content of his Prepare for SugarCloud PHP 8.2 Upgrade blog post which gives an overview of the plan to upgrade to PHP 8.2 in July later in the year and introduces Rector as a tool for updating PHP code to be PHP 8.2 compatible.

We shared that SugarOutfitters add-ons installed in SugarCloud that have PHP 8.2 issues have already been contacted and that other partners will be contacted in the coming days and weeks.

Some questions from the audience included: 

What SugarCloud regions will be updated first?
We will be upgrading our worldwide clone and sandbox stacks first. Regional production upgrades will happen once those environments are fully upgraded to Sugar 13.0.

What kind of performance improvement is expected after PHP 8.2 upgrade?
Informal testing has shown that PHP 8.2 provides about a 5-10% performance improvement over PHP 7 on non-database-related operations.

Rector Demo

Rafa handed over to our guest Alexey Klimko, Distinguished Engineer from SugarCRM, who gave a live demo of how to update Sugar customizations to be PHP 8.2 compatible using Rector.

He described how to set up Git so that files changed by Rector can be tracked properly. You can run Rector in a “dry-run” mode that will allow it to output the changes it wants to make to your code.

Rector Dry Run

Alexey walked thru each change in the Rector output to explain why Rector wanted to change each piece of code. 

You can then run Rector without the dry-run option to allow it to change your code automatically.

He also showed how to set up the Rector configuration to allow it to also check for compatibility with PHP 7.4. That way you can make sure your PHP code works across all supported Sugar versions running PHP 7.4 or PHP 8.2.

A highlight for me was when Alexey showed us the 3v4l.org website that allows you to test how a snippet of PHP code behaves in different PHP versions.

 3v4l website

For example, you can use it to pinpoint the version of PHP that breaks a piece of code.

Anybody that works on Sugar PHP code customizations should watch the recording. Rector is a powerful tool to help you maintain your Sugar PHP code customizations. Additionally, we have a detailed Automated PHP Compatibility Tool guide on how to use Rector available in the Dev Club.

Special Thanks

Thank you, Alexey, for joining us and leading the Rector demo, and sharing your insights!

Session Recording  

This session was recorded on June 7th, see here for the recording and here for the slides. 

Let us know how we are doing!  

We want to make sure our Developer Office Hours sessions continue to be relevant and valuable. Please provide feedback so we can continue to improve and better serve you!  

Share your feedback with this short survey.  

Next Session Sign-Up  

Developer Office Hours are held on the first Wednesday of every month at 10 am ET / 7 am PT.

We are skipping July 5th since that falls on a holiday week in the USA. So, our next live office hours will be August 2nd instead. Please register for the Office Hours series so you don’t miss a session.