onOffice-Web-Org / oo-wp-plugin

onOffice for WP-Websites
https://wp-plugin.onoffice.com
GNU General Public License v3.0
9 stars 9 forks source link

Deprecated notices on PHP 8.3 #910

Open sephentos opened 1 month ago

sephentos commented 1 month ago

I could not find any information about the supported PHP versions, other than the info "PHP 7.4 or higher". Therefore, I would just like to informally pass on that I receive the following deprecated notices under PHP 8.3.

Plugin v5.1.2 with WP 6.6.2 is being used. Messages appearing on all pages.

Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in [redacted]/wp-content/plugins/onoffice-for-wp-websites/plugin/FormPostHandler.php on line 82

Deprecated: Return type of onOffice\WPlugin\ArrayContainer::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in [redacted]/wp-content/plugins/onoffice-for-wp-websites/plugin/ArrayContainer.php on line 59

fredericalpers commented 1 month ago

@sephentos Thank you for raising this issue. We are aware of the deprecations and will take care of them in the future. Unfortunately I cannot give a fixed date for this just yet.

fredericalpers commented 1 month ago

@yeneastgate @dai-eastgate Please investigate this further and give me your assessment and possible solutions. The deprecations do not break anything therefore do not have the highest priority.

dai-eastgate commented 1 month ago

Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in [redacted]/wp-content/plugins/onoffice-for-wp-websites/plugin/FormPostHandler.php on line 82

@fredericalpers @sephentos Currently, the documentation suggests using the htmlspecialchars() function instead. However, htmlspecialchars() only converts special characters to HTML entities and does not strip tags, which may not fully address the issue.

Additionally, there's a deprecation notice:

Deprecated: Return type of onOffice\WPlugin\ArrayContainer::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in [redacted]/wp-content/plugins/onoffice-for-wp-websites/plugin/ArrayContainer.php on line 59

To address this, I added a return type for cases where the return type is bool. For return types like mixed or void, the notice can only be suppressed, as adding a return type would cause severe errors in versions lower than PHP 8.1

I have temporarily implemented a solution to hide the notices and created a PR #935 for issue.

Please take a look at my demo video and let me know your opinions. Thank you!

https://files.fm/f/5jzmt92mk7