Light 3583835 1920

Service Cloud Upgrades support to PHP version 5.6.18

Oracle announced recently the PHP version included in the Customer Portal will also be upgraded, to version 5.6.18. PHP. We discuss some of these changes that are likely to have an effect on current the Service Cloud sites. 

As part of their on-going effort to provide customers with the best and most reliable experience possible, Oracle has recently announced to partners and customers that with the August Check 2016 release, PHP the programming language that powers the Customer Portal pillar of Oracle Service Cloud, will be upgraded to version 5.6.18. This upgrade will improve the user experience for the Customer Portal pillar of Oracle Service Cloud and also some backend features in the multi-channel Contact Centre.

This upgrade comes with a range of new classes, interfaces, methods and global constants which will give developers more flexibility when customising an Oracle Service Cloud site. We will cover here a few key examples of changes that are likely to have an effect on current Service Cloud sites, especially those with custom PHP code. We will also cover Oracle’s current plans for supporting custom PHP code.

This PHP version has been launched with the aim to fix a number of security bugs within older versions of PHP. Any site upgrading to the August 2016 version of Service Cloud will therefore also be subject to an upgrade exercise from the current PHP version (5.3.2 on the sites we’ve seen) to version 5.6.18. The official PHP release notes should be checked for an overview of all changes since the latest supported PHP version (from 5.3 to 5.6, the recommended documents are 5.3-5.45.4-5.5 and 5.5-5.6).

First of all, the register globals directive has been removed in version 5.4.0 and will no longer be available when upgrading your code from 5.3.* to the 5.6.18 version of PHP. Practically, this means that some variable names will have to be replaced by their appropriate COOKIE predefined counterpart:

< PHP version 5.4.0

if (authenticate_session($sessionid)) { // display sensitive data }

PHP version 5.4.0+

if (authenticate_session($_COOKIE['sessionid'])) { // display sensitive data }


Variable names replaced by their COOKIE counterpart

A second interesting change is related to call-time pass-by-reference. According to the PHP reference documentation, there is no reference sign on a function call - only on function definitions. In PHP 5.3.0, developers would get a warning saying that "call-time pass-by-reference" was deprecated when you use & in a function call (e.g.; foo(&$a)). As of PHP 5.4.0, call-time pass-by-reference was removed, so using it will raise a fatal error. This can easily be fixed by removing the ampersands which indicate pass-by-reference from the function call, while keeping them in function definitions. An example of where this will be relevant is in your hook functions, because a core file which manages the hooks has been updated to reflect the above change. Any function in a custom model being called by a hook will need to include an ampersand in the function definition, as in the example below:

class Test_model extends Model   { function __construct() { parent::__construct(); //This model would be loaded by using $this->load->model('custom/Test_model'); }

function hookTest(&$data) { // do something } }

As a last example, how metadata is retrieved will also be affected when upgrading to PHP 5.6.18, because it is no longer possible to access static variables through an object instance of PHP:

< PHP version 5.6

$md = $incident->_metadata;

PHP version 5.6.18

$md = $incident->getMetadata(); OR $md = RNCPHP\Incident->_metadata;

Metadata can no longer be accessed via an object instance

For more examples, you can read the PHP release notes and change logs mentioned above, and also Oracle’s technical release notes.

Apart from the enhanced security, this upgrade will give developers more flexibility when customising an Oracle Service Cloud site. For example, the “finally” keyword can now be used (introduced in PHP 5.5) to form try-catch-finally blocks, allowing for more advanced error handling.

Conclusion

In summary, regarding Oracle’s support of custom PHP code during this upgrade, an official announcement stated that “In order for this upgrade to be completed as smoothly as possible, the Oracle Service Cloud team will be reviewing all PHP code on your site. Any required changes based upon our review will be made without impacting the functionality of the code. This review will be completed before your site upgrades to Oracle Service Cloud August 2016.” (Our emphasis.) Our Oracle contacts have confirmed that both core and custom code will be part of this review. The remediation exercise will only happen once for each site, after which the responsibility lies with customer and their trusted partners.

Find out more

If you have any questions about this PHP  5.6.18 upgrade or would like to talk to us about getting your Service Cloud sites upgraded, contact us or call us now on +44 203 2834315.

Boxfusion Consulting are a Specialised Oracle Service Cloud Implementation partner.