Build 420 - Foundation framework upgrade (Laravel 5.5 LTS)

Release Note 9

Due to overwhelming support from the community, October CMS is updating its foundation framework to the latest Long Term Support (LTS) release. As a result, there are some new requirements to run October and some code changes required.

From the proposed date of 1st August 2017* (Build 420) your webserver will require PHP 7.0 or above to use October CMS. After this date, websites using PHP 5.5.9 will still function normally but will no longer be able to receive updates or install the latest version.

There are mandatory code changes required, including code found in plugins and themes, both private and public. Instructions marked with a can be performed immediately to ensure forward compatibility. In other words the change is compatible with all versions of October, now and after the release. It is recommended to make these changes as soon as possible.

* Build 420 is available as a test update from 29th July 2017. Stable release date to be announced.

New system requirements

  • PHP 7.0 or greater
  • MySQL 5.6 or greater

Known issues

  • First update fails: When updating to Build 420 via the backend, the first update will fail with message Update failed. Simply refresh the page and run the update process a second time.

  • Unsupported cipher: An error is shown The only supported ciphers are.... See Release Note 5 for details on how to fix. Use AES-128-CBC to support legacy key values.

  • Nullable validation: Any model attributes that have validation rules on them now need the nullable rule added if they are optional fields. This was introduced in Laravel version 5.2.

  • Middleware using session: The session is no longer started by default for middleware. You may need to add ->middleware('web') to your route to access session variables.

Required code changes

Console command method renamed

Custom console commands previously relied on a method definition called fire, this has since been renamed to handle.

 * Execute the console command.
 * @return void
public function handle()

For classes that extend Illuminate\Console\Command, rename the fire method to handle.

Database queries now return Collections instead of arrays

The query builder now returns October\Rain\Support\Collection instances instead of plain arrays.

// This now returns a Collection object

// Add all() method to keep returning an array

Cast to an array after calling get() to remain compatible.

// Forwards compatible version
(array) Db::table('users')->get();

Since Collection objects implement ArrayAccess, they behave like arrays so looping over them should be fine. However here are some notable differences.

// An empty array will return false
if (!$array) { /* pass */ }

// Collections cannot be converted to booleans
if (!$collection) { /* fail */ }

// Use the isEmpty() method to check if empty
if (!$collection->isEmpty()) { /* pass */ }

Importantly, native PHP array manipulation functions will no longer behave correctly.

// Array functions will not work
$array = array_reverse($collection);

// Either cast to an array
$array = array_reverse((array) $collection);

// Or use the equivalent Collection method
$collection = $collection->reverse();

Database query pluck method has changed

The pluck() method called on a database query has changed radically and now returns a collection. It should be replaced with value() to retain the previous functionality of returning a string value.

// This will return a collection containing one item
Db::table('users')->where('id', 1)->pluck('username');

Replace pluck() with value() to remain compatible.

// Returns the username value as a string
Db::table('users')->where('id', 1)->value('username');

Twig has been updated to v2.0

Twig v2 is mostly compatible with Twig v1, there are some minor differences in the internals that may need updating. This is unlikely to impact the majority of websites.

Check Twig features in use are not deprecated.

Queue command runs in daemon mode by default

If your crontab was previously running the queue:work command on a schedule to process a single queue item at a time. It should be updated to include the --once flag.

php artisan queue:work --once

Updated minimum requirements

As noted PHP 7.0 is now required at a minimum to install and update the platform. If you are unable to upgrade your server to PHP 7.0 and still wish to use October, you can still install the older build (419) that supports PHP 5.5.9, however bear in mind that no support path will be provided.

Installing old version

October Build 419 was the last build to support PHP 5.5.9, it can be installed using composer. Run the following command:

composer create-project october/october october v1.0.419

One this command completes, it will fail. Open the composer.json file and update the following references:

"october/rain": "1.0.419",
"october/system": "1.0.419",
"october/backend": "1.0.419",
"october/cms": "1.0.419",

You may now run composer update to pull in the depedencies locked to Build 419.

comments powered by Disqus