PHP 7 unrecoverable errors in 16.04

Bug #1588599 reported by hermannkm on 2016-06-03
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Medium
Unassigned
15.04
Medium
Unassigned
15.10
Medium
Unassigned
16.04
Medium
Unassigned
16.10
Medium
Unassigned

Bug Description

I am porting my working instance of mahara 16.04 (debian, php 5.5) to a new server (ubuntu 16.04, php 7.04, using git for installation). Just by chance I stumble upon some crashes which seem to be related to using deprecated PHP functions. At this time I found (and easily repaired) the following files needing fixing for PHP 7:

root@QSKW001:/var/www/mahara# git status
On branch 16.04_STABLE
Your branch is up-to-date with 'origin/16.04_STABLE'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

 modified: htdocs/lib/antispam/SimpleSpamTrap.php
 modified: htdocs/module/multirecipientnotification/inbox.php
 modified: htdocs/module/multirecipientnotification/lib/activityextend.php
 modified: htdocs/module/multirecipientnotification/outbox.php

the first one needing preg_match instead of eregi

diff lib/antispam/SimpleSpamTrap.php ../../mahara-16.04.0/htdocs/lib/antispam/SimpleSpamTrap.php
25c25
< if (preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i", $email)) {
---
> if (eregi("^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$", $email)) {

while the other ones simply needed explode instead of split, e.g.:

root@QSKW001:/var/www/mahara# diff htdocs/module/multirecipientnotification/inbox.php ../mahara-16.04.0/htdocs/module/multirecipientnotification/inbox.php
78c78
< explode(',', $type),
---
> split(',', $type),
179c179
< $types = explode(',', preg_replace('/[^a-z,]+/', '', $type));
---
> $types = split(',', preg_replace('/[^a-z,]+/', '', $type));

These are just quick hacks by me working up to now.

Robert Lyon (robertl-9) on 2016-06-03
Changed in mahara:
milestone: none → 16.10.0

Reviewed: https://reviews.mahara.org/6546
Committed: https://git.mahara.org/mahara/mahara/commit/e7d540e52227cb6306515fa65aa9c17c665cd0f5
Submitter: Aaron Wells (<email address hidden>)
Branch: master

commit e7d540e52227cb6306515fa65aa9c17c665cd0f5
Author: H Klocker <email address hidden>
Date: Fri Jun 3 17:15:15 2016 +1200

Bug 1588599: Fixing up Mahara for php7

Changing deprecated join() and ereg() eregi() functions to their more
robust equivalents

behatnotneeded

Change-Id: I76e928a945a0f4b0a2b7b2a3096200c2f8df9db9
Signed-off-by: Robert Lyon <email address hidden>

Aaron Wells (u-aaronw) on 2016-06-09
tags: added: php7

Reviewed: https://reviews.mahara.org/6590
Committed: https://git.mahara.org/mahara/mahara/commit/4c6573b962f754766e664514bb7a495250c44fb1
Submitter: Son Nguyen (<email address hidden>)
Branch: 16.04_STABLE

commit 4c6573b962f754766e664514bb7a495250c44fb1
Author: H Klocker <email address hidden>
Date: Fri Jun 3 17:15:15 2016 +1200

Bug 1588599: Fixing up Mahara for php7

Changing deprecated join() and ereg() eregi() functions to their more
robust equivalents

behatnotneeded

Change-Id: I76e928a945a0f4b0a2b7b2a3096200c2f8df9db9
Signed-off-by: Robert Lyon <email address hidden>
(cherry picked from commit e7d540e52227cb6306515fa65aa9c17c665cd0f5)

Mahara Bot (dev-mahara) wrote :

Patch for "15.04_STABLE" branch: https://reviews.mahara.org/6687

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

commit 4fd7a0009fcb25e605ca93b00f6c54d26dc7091c
Author: H Klocker <email address hidden>
Date: Fri Jun 3 17:15:15 2016 +1200

Bug 1588599: Fixing up Mahara for php7

Changing deprecated join() and ereg() eregi() functions to their more
robust equivalents

behatnotneeded

Change-Id: I76e928a945a0f4b0a2b7b2a3096200c2f8df9db9
Signed-off-by: Robert Lyon <email address hidden>
(cherry picked from commit e7d540e52227cb6306515fa65aa9c17c665cd0f5)
(cherry picked from commit 4c6573b962f754766e664514bb7a495250c44fb1)

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/6687
Committed: https://git.mahara.org/mahara/mahara/commit/d206bb4ec8ac278bf872f5e6b51f24073bb7df98
Submitter: Robert Lyon (<email address hidden>)
Branch: 15.04_STABLE

commit d206bb4ec8ac278bf872f5e6b51f24073bb7df98
Author: H Klocker <email address hidden>
Date: Fri Jun 3 17:15:15 2016 +1200

Bug 1588599: Fixing up Mahara for php7

Changing deprecated join() and ereg() eregi() functions to their more
robust equivalents

behatnotneeded

Change-Id: I76e928a945a0f4b0a2b7b2a3096200c2f8df9db9
Signed-off-by: Robert Lyon <email address hidden>
(cherry picked from commit e7d540e52227cb6306515fa65aa9c17c665cd0f5)
(cherry picked from commit 4c6573b962f754766e664514bb7a495250c44fb1)

Robert Lyon (robertl-9) on 2016-10-21
Changed in mahara:
milestone: 16.10.0 → none
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