? ? ? Pending

User tests: Successful: Unsuccessful:

avatar beat
beat
20 Jan 2022

Pull Request for Issue # : None, found and fixed it directly here.

Summary of Changes

This is the Joomla 4.0 identical pendent of this Joomla 3.10 PR #36804 that got merged.

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 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 /home/beat/www/4.0/plugins/editors/tinymce/tinymce.php on line 538
  • Deprecated: htmlentities(): Passing null to parameter # 4 ($double_encode) of type bool is deprecated in /home/beat/www/4.0/plugins/editors/tinymce/tinymce.php on line 538

Expected result AFTER applying this Pull Request

No errors.

Documentation Changes Required

None.

avatar beat beat - open - 20 Jan 2022
avatar beat beat - change - 20 Jan 2022
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 20 Jan 2022
Category Front End Plugins
avatar beat beat - change - 20 Jan 2022
The description was changed
avatar beat beat - edited - 20 Jan 2022
avatar beat beat - change - 23 Jan 2022
Title
Fix PHP 8.1 compatibility of htmlentities types in tinymce.php (fixes Deprecated tinymce.php on line 538)
[4.0] [PHP 8.1] compatibility of htmlentities types in tinymce.php (fixes Deprecated tinymce.php on line 538)
avatar beat beat - edited - 23 Jan 2022
avatar beat beat - change - 24 Jan 2022
The description was changed
avatar beat beat - edited - 24 Jan 2022
avatar beat beat - change - 24 Jan 2022
The description was changed
avatar beat beat - edited - 24 Jan 2022
avatar brianteeman
brianteeman - comment - 24 Jan 2022

In theory you dont need to create this as it will be merged up from 3.x

avatar beat beat - change - 24 Jan 2022
The description was changed
avatar beat beat - edited - 24 Jan 2022
avatar beat
beat - comment - 24 Jan 2022

This is the Joomla 4.0 identical pendent of this Joomla 3.10 PR #36804 (had wrong title, fixed) that got merged.
In Joomla 4, there is only one use of htmlentities() without correctly typed parameters, instead of 2 in Joomla 3.10.

avatar beat
beat - comment - 24 Jan 2022

In theory you dont need to create this as it will be merged up from 3.x

Nice! Good to know for all my other 3.10 PRs that just got merged.

Then in practice this PR might still help as the tinymce.php code changed quite a bit, So, keeping it open.

Of course, in case the corresponding #36804 Joomla 3.10 PR gets adapted and merged into 4.x-dev branches, feel free to comment commit # and close this PR.

avatar zero-24
zero-24 - comment - 24 Jan 2022

As brian said that should be fixed on the merge up and when we merge here it results into conflicts. So i would like to hear @bembelimen 's opinion first whether he wants to merge here or merge 3.10 into 4.0/4.1 first. My proposal would be the latter once merged up we can check whether this PR is still needed.

avatar beat beat - change - 25 Jan 2022
Title
[4.0] [PHP 8.1] compatibility of htmlentities types in tinymce.php (fixes Deprecated tinymce.php on line 538)
[4.1] [PHP 8.1] compatibility of htmlentities types in tinymce.php (fixes Deprecated tinymce.php on line 538)
avatar beat beat - edited - 25 Jan 2022
avatar beat
beat - comment - 25 Jan 2022

Closing in favor of #36846 as there is no chance that PR #36804 gets up-merged automatically from 3.10-dev, since the code got split into Traits.

avatar beat beat - change - 25 Jan 2022
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2022-01-25 12:19:40
Closed_By beat
Labels Added: ? ? ?
avatar beat beat - close - 25 Jan 2022

Add a Comment

Login with GitHub to post a comment