Panopto / Moodle-2.0-plugin-for-Panopto

Panopto's integration with the Moodle LMS.
http://www.panopto.com
GNU General Public License v3.0
18 stars 38 forks source link

2023083100 release code #205

Closed zeroAps closed 11 months ago

zeroAps commented 11 months ago

This is the current stable release version of the Panopto plug-in for Moodle. It is recommended that customers update to this version of the block.

This version supports (a) Moodle 3.9, 3.11, 4.0, 4.1, 4.2 running with PHP 7.4 and 8.0 and (b) Panopto version 10.6.1 or later.

Below is the list of updates from the previous beta release (2023031400).

jrchamp commented 11 months ago

I saw that you fixed the PHP 8.1 issue (#197, #198), for example: https://github.com/Panopto/Moodle-2.0-plugin-for-Panopto/blob/2ff5dc020adcec51b21f100d62da920084228814/lib/AuthManagement/AuthManagementWsdlClass.php#L643

Just so you know, the mixed return type is only available beginning in PHP 8.0 and the minimum Moodle version for PHP 8.0 is Moodle 3.11.8.

Right now, this plugin programmatically claims to support Moodle 2.7: https://github.com/Panopto/Moodle-2.0-plugin-for-Panopto/blob/2ff5dc020adcec51b21f100d62da920084228814/version.php#L34-L35

In case you don't already have the Moodle version strings: https://moodledev.io/general/releases

sharpchi commented 11 months ago

@jrchamp - really good spot, was about to update our site with this. Mixed return types are not valid in PHP 7.4. It will throw a fatal error. Running this sample code

<?php

/**
 * Test me return values
 * @return mixed
 */
function testme(): mixed {
    return [1,2,3];
}

print_r(testme());

In PHP 7.4 returns

Fatal error: Uncaught TypeError: Return value of testme() must be an instance of mixed, array returned in /home/user/scripts/code.php:8
Stack trace:
#0 /home/user/scripts/code.php(11): testme()
#1 {main}
  thrown in /home/user/scripts/code.php on line 8

Unless the code requires a min PHP 8.0, the mixed return type should only be in the phpdoc block

jrchamp commented 11 months ago

To allow for backward compatibility while avoiding Deprecated warnings in PHP 8.1, you may need to use the ReturnTypeWillChange attribute

    #[\ReturnTypeWillChange]
    public function current() {

That example was pulled directly from PHP's Iterator examples

zeroAps commented 11 months ago

Thank you for reporting this. We just made a new release which added attribute for backward compatibility.