PHP 5.3 incompatible array declarations

Bug #1566127 reported by Aaron Wells on 2016-04-05
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Medium
Aaron Wells
15.10
Medium
Aaron Wells
16.04
Medium
Aaron Wells
16.10
Medium
Aaron Wells

Bug Description

In lib/graph.php there's a spot where an array is initialized using the easier array syntax introduced in PHP 5.4:

    $defaultcolours = ['187,35,39','59,140,46','61,132,203','227,171,0','0,74,136','139,62,138','220,109,10','29,183,197','116,116,116','62,35,110'];

Since we're still supporting PHP 5.3, this needs to use the array() pseudo-function instead.

Aaron Wells (u-aaronw) wrote :

I also fixed some occurrences of this in our Behat code, for good measure. (Surprisingly, the Behat core library still supports PHP 5.3!)

The Eclipse PHP validator also notices it in the PHPMailer library, but only in the classes for handling oauth, which we aren't actually using, so that shouldn't be a problem.

summary: - PHP 5.4 array initialization, in lib/graph.php
+ PHP 5.3 incompatible array declarations

Aaron, there is an OAuth auth third-party plugin now available. Would your change impact that negatively?

Reviewed: https://reviews.mahara.org/6309
Committed: https://git.mahara.org/mahara/mahara/commit/d5aef398e98f747009b03ae0b15319ef7a47821c
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit d5aef398e98f747009b03ae0b15319ef7a47821c
Author: Aaron Wells <email address hidden>
Date: Tue Apr 5 16:04:47 2016 +1200

Use PHP 5.3 array syntax

Bug 1566127

Change-Id: I8e249a93fbff7c3bf914099e53f1f29068a36a15
behatnotneeded: Covered by existing tests

Mahara Bot (dev-mahara) wrote :

Patch for "15.10_STABLE" branch: https://reviews.mahara.org/6313

Reviewed: https://reviews.mahara.org/6312
Committed: https://git.mahara.org/mahara/mahara/commit/e04d6761631c832080e7b86896a7dadebd2ead80
Submitter: Robert Lyon (<email address hidden>)
Branch: 16.04_STABLE

commit e04d6761631c832080e7b86896a7dadebd2ead80
Author: Aaron Wells <email address hidden>
Date: Tue Apr 5 16:04:47 2016 +1200

Use PHP 5.3 array syntax

Bug 1566127

Change-Id: I8e249a93fbff7c3bf914099e53f1f29068a36a15
behatnotneeded: Covered by existing tests
(cherry picked from commit d5aef398e98f747009b03ae0b15319ef7a47821c)

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/6313
Committed: https://git.mahara.org/mahara/mahara/commit/cbb2b25b214cf47d5d0c26662768c69cccc62813
Submitter: Robert Lyon (<email address hidden>)
Branch: 15.10_STABLE

commit cbb2b25b214cf47d5d0c26662768c69cccc62813
Author: Aaron Wells <email address hidden>
Date: Tue Apr 5 16:04:47 2016 +1200

Use PHP 5.3 array syntax

Bug 1566127

Change-Id: I8e249a93fbff7c3bf914099e53f1f29068a36a15
behatnotneeded: Covered by existing tests
(cherry picked from commit d5aef398e98f747009b03ae0b15319ef7a47821c)

Aaron Wells (u-aaronw) wrote :

Kristina,

Regarding OAuth, this particular issue actually has nothing to do with OAuth itself. It's just that the phpmailer OAuth module happens to be where the affected code is located. Probably because the OAuth module was written more recently than the rest, since the "$x = []" array declaration syntax is newer than the "$x = array()" declaration syntax.

Robert Lyon (robertl-9) on 2016-10-21
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers