Forums | Mahara Community

Developers /
PHP 7


Kevin Rickis's profile picture
Posts: 67

23 June 2016, 2:13 AM

Hi All,

I've just carried out a little experiment and tried running a 15.04.7 system and a 16.04.1 system on PHP 7. Yes, I know that's the way that madness lies but some of you have met me and we can agree that's not a new issue.  Anyway, both broke to some extent, 15.04.7 more than 16.04.1 in the main I think due to the Smarty/Dwoo stuff in 15.04.7.

One thing that broke was multirecipientnotification which uses split() at lines 34 and 419, as split() was removed in php7. Replacing split() with explode() works fine. 

However, in 15.04.7 the items in the inbox are not displayed as after the foreach on line 5 in inboxmr.tpl there are no values in $i although they are there when $items is checked before the loop. I didn't really look at this in 16.04.1

As is to be expected there are a lot of warnings, they mainly seem to be where a child method has a different signature from its parent. Here is an example from lib/activity.php

Existing:
protected function update_url($internalid) {
$this->url = 'user/sendmessage.php?id=' . $this->userfrom . '&replyto=' . $internalid . '&returnto=inbox';
return true;
}
Gives no warning with PHP 7:
    protected function update_url() {
        list($internalid) = func_get_args();
        $this->url = 'user/sendmessage.php?id=' . $this->userfrom . '&replyto=' . $internalid . '&returnto=inbox';
        return true; 
    }

 

 

Is there a roadmap for support of php7 and beyond? I don't actually expect the 15.04.x branch to support anything above 5.6  I was just trying it out as I have two customers still running it, and they will probably be upgraded in the next month anyway.

I hope this serves some purpose if only to kick off a discussion.

Kevin.

Robert Lyon's profile picture
Posts: 405

23 June 2016, 9:06 AM

Hi Kevin,

There is no 'roadmap' as yet but there are a bunch of bugs/patches dealing with PHP7 issues, some of which have been back-ported to older versions and some that still need to be done:

https://reviews.mahara.org/#/c/6408/1 : Bug 1575955: fixing function signatures for PHP7

https://reviews.mahara.org/#/c/6409/2 : PHP7 changes the type required for exception handler

https://reviews.mahara.org/#/c/6455/3 : Bug 1577259: fix dynamic property references in dwoo for php7

https://reviews.mahara.org/#/c/6454/2 : Bug 1577258: Fixing more function signatures for PHP7

https://reviews.mahara.org/#/c/6546/1 : Bug 1588599: Fixing up Mahara for php7

https://reviews.mahara.org/#/c/6527/ : Bug 1393536: fix php-7.0 issues

I don't believe the example you mention has been tackled yet - so the best bet to get PHP7 related issues fixed up will be to add a bug report for the issues on our bug tracker

Cheers

Robert

 

Kevin Rickis's profile picture
Posts: 67

23 June 2016, 6:58 PM

Hi Robert,

thank you for the links. I'll try and add what I found to the bug tracker if I can, it frequently rejects me as being a bot for some reason. 

Cheers,

Kevin

Kristina Hoeppner's profile picture
Posts: 3542

24 June 2016, 10:56 PM

Hello Kevin,

You and mad? I doubt it and rather think it's Ubuntu 16.04 with PHP 7. ;-)

It would be fantastic if you were able to test the PHP7 changes that are in master. Aaron also updated our instructions for the setup of the developer environment as Ubuntu changed a few things around...

https://wiki.mahara.org/wiki/Developer_Area/Developer_Environment

Cheers

Kristina

 

Kevin Rickis's profile picture
Posts: 67

25 June 2016, 8:06 AM

Hi Kristina,

It was Centos 7 that I was using in VirtualBox. We use Centos on our production servers. I plan to get a dedicated Raspberry PI development server set up with Ubuntu and Postgres in the next few weeks so the link will be very useful, thank you. I think I've fixed the problem I was having with Launchpad and I also managed to get the Gerrit stuff set up. :)

Cheers,

Kevin

Kristina Hoeppner's profile picture
Posts: 3542

28 June 2016, 7:57 AM

Hello Kevin,

Great that you are back up and running.

Cheers

Kristina

 

6 results