Skip to content

Errors and deprecations findings #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
rikardow opened this issue Jul 9, 2024 · 3 comments
Open

Errors and deprecations findings #145

rikardow opened this issue Jul 9, 2024 · 3 comments

Comments

@rikardow
Copy link

rikardow commented Jul 9, 2024

Hi, thanks for the great work on this plugin

We found some errors and deprecations in the codebase, here's the list

  1. File: filter/wiris/integration/lib/haxe/Utf8.class.php
    Line: 26
    Message: Function utf8_encode() is deprecated since PHP 8.2; Use mb_convert_encoding(), UConverter::transcode() or iconv instead.
    Type: warning

  2. File: filter/wiris/integration/lib/haxe/Utf8.class.php
    Line: 29
    Message: Function utf8_decode() is deprecated since PHP 8.2; Use mb_convert_encoding(), UConverter::transcode() or iconv instead.
    Type: warning

  3. File: filter/wiris/integration/lib/php/Boot.class.php
    Line: 808
    Message: enum' is a soft reserved keyword as of PHP version 8.1 and should not be used to name a class, interface or trait or as part of a namespace (class declaration).
    Type: warning

  4. File: filter/wiris/integration/lib/php/Boot.class.php
    Line: 732
    Message: Method name _hx_type::rfl is discouraged; PHP has reserved all method names with a double underscore prefix for future use.
    Type: warning

  5. File: filter/wiris/integration/lib/com/wiris/system/CallWrapper.class.php
    Line: 9
    Message: Function __autoload() is deprecated since PHP 7.2 and removed since PHP 8.0; Use spl_autoload_register() instead.
    Type: error

Thank you very much for your efforts

@carla-at-wiris
Copy link
Contributor

Hello @rikardow,

Thank you for reporting this! We've moved this suggestion to the next step and will let you know once we start working on it and once it is released. Any further issues, please feel free to contact us again.

@danowar2k
Copy link
Contributor

Going from v.8.8.1, the plugin says to support Moodle 2.2.11 onwards.

So, "officially" v.8.8.1 says it supports all PHP versions from 5.3.2 (https://docs.moodle.org/22/en/Upgrading_to_Moodle_2.2) to 8.3 (Moodle 4.5)

I don't think that this is feasible at all. There could be various limits enforced:

  • Limit support to PHP versions that are still in security support (which would limit this plugin to a minimum of PHP 8.1, so a minimum of Moodle 4.1?)
  • Limit support to Moodle versions that are still in security support (so Moodle 4.1 onwards, so basically PHP 7.4 - 8.3)

If older Moodle versions must be supported, I'd suggest separate branches for those older Moodle versions as not to clutter the regular code with backwards compatibility hacks.

@danowar2k
Copy link
Contributor

Some findings regarding to the OP:

class com_wiris_system_CallWrapper {
	public function __construct() {
		;
	}
	public function autoload($className) {
		if(function_exists('__autoload')) {
			__autoload($className);
		}
	}

So the autoload call is sufficiently enscapsulated and there...well, not really a false positive, but "backwards compatible". But necessary if this plugin supports Moodle 4.1.

FILE: filter/wiris/integration/lib/php/Boot.class.php
------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------
 732 | WARNING | Method name "_hx_type::__rfl__" is discouraged; PHP has reserved all method names with a double
     |         | underscore prefix for future use.
 808 | WARNING | 'enum' is a soft reserved keyword as of PHP version 8.1 and should not be used to name a class,
     |         | interface or trait or as part of a namespace (class declaration)
------------------------------------------------------------------------------------------------------------------

The double underscores are because of the Haxe code generation tool used to generate part of the code for this plugin, I think.

The "enum" class is pretty bad. (It looks like this was missing above). Should be renamed in the source of the code (probably Haxe again).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants