Skip to content
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

[3.10] [PHP 8.1] compatibility of htmlentities types in tinymce.php (fixes Deprecated tinymce.php on line 603) #36804

Merged
merged 1 commit into from
Jan 23, 2022

Conversation

beat
Copy link
Contributor

@beat beat commented Jan 23, 2022

Pull Request for Issue # none.

Summary of Changes

Fixes Deprecated: htmlentities(): Passing null to parameter #2 ($flags) of type int is deprecated in plugins/editors/tinymce/tinymce.php on line 603
Joomla 3.10 version of Joomla 4.0 #36761

In PHP, htmlentities() has following parameters types: 2nd is a non-null int, 4th is à non-null bool.

 htmlentities(
    string $string,
    int $flags = ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401,
    ?string $encoding = null,
    bool $double_encode = true
): string

ref.: https://www.php.net/manual/en/function.htmlentities.php

This PR does replace null by their type-conversions: (int) null -> 0, and (bool) null -> false.

Disclaimer: I'm only fixing PHP 8.1 compatibility here.

Testing Instructions

A code-review should be enough here.

I found it with CB internal PMS / New Message, but I guess PHP 8.1 with all errors on and joomla debug on on any tinymce window should show it too.

Actual result BEFORE applying this Pull Request

Deprecated: htmlentities(): Passing null to parameter #2 ($flags) of type int is deprecated in plugins/editors/tinymce/tinymce.php on line 603

Expected result AFTER applying this Pull Request

No errors.

Documentation Changes Required

None.

Fixes `Fixes `Deprecated: DateTime::__construct(): Passing null to parameter #1 ($datetime) of type string is deprecated in libraries/src/Date/Date.php on line 112` error on login`
@beat beat marked this pull request as ready for review January 23, 2022 13:21
@zero-24 zero-24 added this to the Joomla 3.10.6 milestone Jan 23, 2022
@zero-24
Copy link
Contributor

zero-24 commented Jan 23, 2022

Taking this in thanks @beat

@zero-24 zero-24 merged commit aae1bb8 into joomla:3.10-dev Jan 23, 2022
@beat beat changed the title [3.10] [PHP 8.1] Fixes Table User for Date/Date.php warning on login [3.10] [PHP 8.1] compatibility of htmlentities types in tinymce.php (fixes Deprecated tinymce.php on line 603) Jan 24, 2022
@beat
Copy link
Contributor Author

beat commented Jan 24, 2022

Thank you! Could you please also test-review and merge the corresponding Joomla 4 PR #36761 ?

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

Successfully merging this pull request may close these issues.

3 participants