PHP 8 compatibility causing error with PHP 7.4 for XML-RPC

Bug #2004137 reported by Ghada El-Zoghbi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
22.10
Fix Released
High
Unassigned
23.04
Fix Released
High
Unassigned

Bug Description

Mahara: 22.10.0
DB: Postgres 14.3
OS: Linux 20.04
Browser: n/a

The use of "mixed" type is supported in PHP 8.0+.

It was introduced in this file:

https://reviews.mahara.org/c/mahara/+/12921/28/htdocs/lib/applicationset.php

with 2 functions:

1. current() : mixed
2. key() : mixed

With PHP 7.4, when configuring institutions with Moodle integration (XML-RPC for example), the following error is received:

"PHP message: [WAR] 40 (lib/errors.php:529) [TypeError]: Return value of ApplicationSet::current() must be an instance of mixed, instance of Application returned at /var/www/site/lib/applicationset.php:45

A type should not be set for these functions until it's fully implemented for PHP 8.0+.

I only found those 2 instances in Mahara 22.10

summary: - Mahara 22.10 - PHP 8.0 compatibility causing error with PHP 7.4
+ PHP 8 compatibility causing error with PHP 7.4 for XML-RPC
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/c/mahara/+/13674
Committed: https://git.mahara.org/mahara/mahara/commit/90b9943a60d9a1f3f81d417ec86ba84f9b11df02
Submitter: "Robert Lyon <email address hidden>"
Branch: main

commit 90b9943a60d9a1f3f81d417ec86ba84f9b11df02
Author: Gold <email address hidden>
Date: Tue Jan 31 12:01:20 2023 +1300

Bug 2004137: Type declaration error in php 7.4

Turns out the type declaration of 'mixed' is not supported in PHP 7.4.
Removing for now.

Signed-off-by: Gold <email address hidden>
Change-Id: I374f2fea81cebdacfaf0e1fa1b04021981b6d878

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "22.10_DEV" branch: https://reviews.mahara.org/c/mahara/+/13809

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/c/mahara/+/13809
Committed: https://git.mahara.org/mahara/mahara/commit/396c0bc0b773e853188dfc8dbcad1e9c8e3fc608
Submitter: "Robert Lyon <email address hidden>"
Branch: 22.10_DEV

commit 396c0bc0b773e853188dfc8dbcad1e9c8e3fc608
Author: Gold <email address hidden>
Date: Tue Jan 31 12:01:20 2023 +1300

Bug 2004137: Type declaration error in php 7.4

Turns out the type declaration of 'mixed' is not supported in PHP 7.4.
Removing for now.

Signed-off-by: Gold <email address hidden>
Change-Id: I374f2fea81cebdacfaf0e1fa1b04021981b6d878
(cherry picked from commit 90b9943a60d9a1f3f81d417ec86ba84f9b11df02)

Robert Lyon (robertl-9)
Changed in mahara:
milestone: 23.04.0 → none
Robert Lyon (robertl-9)
Changed in mahara:
status: Fix Committed → Fix Released
no longer affects: mahara
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.