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

PHP 8.1 deprecation fixes #36306

Merged
merged 4 commits into from Jan 8, 2022
Merged

Conversation

wilsonge
Copy link
Contributor

Summary of Changes

Backport several PHP 8.1 deprecation fixes to the 3.10 branch. Not all these fixes are mine - I'm just assembling them together for the backport

Testing Instructions

Setup PHP 8.1 and run 3.10 on it. Currently install still won't run properly if deprecation warnings are output to screen (as it requires some backports in the framework 1.0 packages for Registry and Input). But there should be significantly less deprecation warnings.

Documentation Changes Required

None

@richard67
Copy link
Member

@wilsonge It seems on J3 the PHP CS fails with the "#" comments: https://ci.joomla.org/joomla/joomla-cms/49245/1/3 .

@wilsonge
Copy link
Contributor Author

Its because we're using the old version of PHP Sniffer :/

@alikon alikon added the PHP 8.x PHP 8.x deprecated issues label Dec 22, 2021
@zero-24 zero-24 added this to the Joomla 3.10.5 milestone Jan 8, 2022
@wilsonge wilsonge marked this pull request as ready for review January 8, 2022 17:36
@zero-24
Copy link
Member

zero-24 commented Jan 8, 2022

Merging here thanks George :)

@zero-24 zero-24 merged commit 1809509 into joomla:3.10-dev Jan 8, 2022
@wilsonge wilsonge deleted the php81-deprecation-fixes branch January 8, 2022 18:27
bembelimen added a commit that referenced this pull request Jan 15, 2022
* [4.0] Backup message (#36487)

Many users who use their hosts backup facility and this is typically __only__ for files

This update reminds them to backup the database as well

* Remove reference & in usort callback function (#36503)

* Update paragonie sodium_compat to 1.17.0 (#36491)

Co-authored-by: Benjamin Trenkle <bembelimen@users.noreply.github.com>

* [3.10] Finder plugins modify component params registry / Backport #35855 (#36141)

* Backport #35855 to 3.10

* one space to much

* [4.0]  xml code style (#36532)

Fixes a few spaces to tabs issues

* [4.0] media manager breadcrumbs (#36154)

* [4.0] media manager breadcrumbs

The RTL specific css was wrong as can be seen in the before screenshot

This PR removes the RTL specific css (should have been scss) and updates the scss to use logical properties instead.

This PR also removes an unused class `breadcrumb-item`.

To test RTL you will need to install arabic or persian.

and dont forget to npm ci

There is no visible change in LTR and the RTL changes are as shown below

## Before LTR

## Before RTL

## After LTR

## After RTL

* revert

* [4.0] RTL: Correcting Admin login 2factor and feedback hints (#36024)

This is a replacement to the merged PR #32104

It does exactly the same thing but by using css logical properties we avoid the need to maintain both an LTR and an RTL version[4.0]

There is no visual change

* [4.0] Category list (#36536)

Remove extra div that is not needed

* [4.0] Make routing work in console applications (#36332)

* Update list-fancy-select.php (#36543)

replace tab with space

code review

* [4.0] archive icon (#36263)

All the state icons are grey so that the published icon, which is green, stands out visually.

The archived icon however was black. This PR changes that icon to grey.

### Before

### After

* [4.0] Banner Client tips (#36262)

* [4.0] Banner Client tips

Adds a tooltip to the banner client numbers so that they appear the same as category numbers. Also corrects the class on the trashed number so that it has the correct colour

To test
Create one banner client
Create a banner for the client in each of the published states

* Update administrator/components/com_banners/tmpl/clients/default.php

oops

Co-authored-by: Quy <quy@fluxbb.org>

Co-authored-by: Quy <quy@fluxbb.org>

* Fix article creation from frontend (#36542)

* [4.0] Handle when toggle icon is not available (#36329)

* Handle when toggle icon is not available

* cs

* Take workflow extension into account when setting a default (#36527)

* Fix uploadlimits checks (#36023)

* Make edit_lock layout reusable for other extensions (#35112)

* Allow to set a value for SubformField (#35921)

* [4.0] Fix example in cleanImageURL docblock (#36554)

* Fix Codemirror behind tabs (#36140)

* Fix Codemirror behind tabs

* jscs

* Remove dependency on Factory in AdminController

* [4.0] Ensure path contains api in the router (#36315)

* [4.0] Check model is set before calling its methods (#36378)

* Check model is set before calling its methods

* Update OverridesController.php

* Category edit form should use return url (#36560)

Currently the article edit form respects return URLs; the category edit form does not. Adding it here makes for a more consistent editing experience.

* [4.0] Sample Data plugin images (#36237)

Updates the plugin to use the new image data used in lazy loading etc. This avoids confusion for users who see different source code for their created articles when compared to the same data plugins

To test. Just make sure the sample data still installs and works as expected

* [4.0] If the Mail Template was not found in the db, return false (#36489)

* [4.0] Code Style (#36564)

* Use an absolute path in image list field (#36063)

* Correct Cache setWorkarounds to take account of multiple script or style declarations being used that mean that we have an array of scripts or stylesheets to be cached and not just a string (#36068)

Cache setWorkarounds returns an array not a string

* [3] privacy request by logged in user only (#35470)

* privacy request logged in only

* privacy request logged in only

* privacy request logged in only

* privacy request logged in only

* privacy request logged in only

* Update components/com_privacy/controller.php

Co-authored-by: Quy <quy@fluxbb.org>

Co-authored-by: Quy <quy@fluxbb.org>

* Feature - Add always count option to 404 redirects (#34640)

* Feature - Add always count option to 404 redirects

* Add missiing space for code sniffer

* Return line for if statement

* Update plugins/system/redirect/redirect.php

Co-authored-by: Quy <quy@fluxbb.org>

* Alpha Ordering - Change Constant too.

* update constant

* Update en-GB.plg_system_redirect.ini

* remove trailing whtiespace

* Remove Added Language Strings

* Update plugins/system/redirect/redirect.php

Co-authored-by: Phil E. Taylor <phil@phil-taylor.com>

* Update redirect.xml

* Update redirect.php

* Update plugins/system/redirect/redirect.php

Co-authored-by: Quy <quy@fluxbb.org>

* Update plugins/system/redirect/redirect.php

Co-authored-by: Benjamin Trenkle <bembelimen@users.noreply.github.com>

* Update plugins/system/redirect/redirect.php

Co-authored-by: Quy <quy@fluxbb.org>
Co-authored-by: Phil E. Taylor <phil@phil-taylor.com>
Co-authored-by: Tobias Zulauf <zero-24@users.noreply.github.com>
Co-authored-by: Benjamin Trenkle <bembelimen@users.noreply.github.com>

* php8 deprecation str_replace Passing null to param (#36400)

* add php 8.1 to the version array (#36577)

* Add function parameters for callbacks. Fixes #36010

* PHP 8.1 deprecation fixes (#36306)

* Backport some deprecation fixes from the J4 branch

* Ensure htmlspecialchars is passed a string

* Ignore PHPCS errors

Co-authored-by: Tobias Zulauf <zero-24@users.noreply.github.com>

* Update simplepie to 1.3.3 (#36358)

* Update simplepie to 1.3.2 & phar-stream-wrapper to 2.2.2

* update to simplepie 1.3.3 to fix the version

* [3.10] Dont show the pre upgrade checker when the upgrade is not supported (#36312)

* [3.10] Fix Progressive caching to cache modules per custom menu assignment (#36324)

* Fix progressive caching

* Update libraries/src/Document/HtmlDocument.php

Co-authored-by: Phil E. Taylor <phil@phil-taylor.com>

* cast int

* Update libraries/src/Document/HtmlDocument.php

* Update libraries/src/Document/HtmlDocument.php

* Update libraries/src/Document/HtmlDocument.php

* Update libraries/src/Document/HtmlDocument.php

* Update libraries/src/Document/HtmlDocument.php

* Update libraries/src/Document/HtmlDocument.php

Co-authored-by: Phil E. Taylor <phil@phil-taylor.com>
Co-authored-by: Tobias Zulauf <zero-24@users.noreply.github.com>

* Bump registry to 1.6.4 (#36611)

* [4.0] Load the subform data correctly (#36598)

* Load the subform data correctly

* correct order

* don't remove <joomla-hidden-mail> (#36602)

* [4.0] Function to unregister a provider in media manager (#36594)

* [4.0] Latests/Popular Admin modules permissions (#36559)

* Allow our phpcode sniffer composer plugin to run

* PHP 8.1 fixes ported from #36355

* Fix codestyle. Thanks @brianteeman

* Improve security and type checking of the installer task

* Ensure the rule modifier is a string by default

* Ensure cpanel dashboard name is type safe (PHP 8.1)

* Fix mistake in param ordering

* Fix PHP 8.1 notice when creating an article

* Fix URL Field giving deprecated notices in PHP 8.1

* [4.0] Fix template preview (#36268)

* Fix template preview

* Fix template preview

* Fix Progressive caching to cache modules per custom menu assignment (#36193)

* Cross Origin for Google Fonts (#36592)

* Update Tobscure library to be PHP 8.1 compat

* Tag 4.0.6 RC1

* Reset to dev

* Translation Update (#36356)

* [4.0] Fix images (#35780)

* [4.0] Joomla Update Silent fails (#36492)

* [4.0] Joomla Update Silent fails

I am not 100% certain that this is the best approach to this. @nikosdion @wilsonge please advise

## The Problem
As reported in # if during an update a sql query fails then the updater quits the sql part of the update process and moves on. The joomla_update log gives no indication that there has been a problem etc.

## Proposed Partial Solution
Adds a Start SQL and End SQL to the logs
If there is an error in the sql then that is written to the logs as well AND it now says End SQL incomplete

### Testing
For the testing we will be using the "Update your site by manually uploading the update package." and to make things quick I have prepared an empty update that you should download and use.

### Before Test 1
Update your install and then check the `administrator\logs\joomla_update.php`
It should look like

### Before Test 2
Update your database to change the value in the #__schemas table so that the version_id is 4.0.0-2018-5-15
Update your install and then check the `administrator\logs\joomla_update.php`
It should look like

### Before Test 3
Update your database to change the value in the #__schemas table so that the version_id is 4.0.3
Update your install and then check the `administrator\logs\joomla_update.php`
It should look like

### After - Test 1
Update your database to change the value in the #__schemas table so that the version_id is 4.0.4

Update your install and then check the `administrator\logs\joomla_update.php`
It should look like

### After -  Test 2
Update your database to change the value in the #__schemas table so that the version_id is 4.0.0-2018-5-15
Update your install and then check the `administrator\logs\joomla_update.php`
It should look like

### Before Test 3
Update your database to change the value in the #__schemas table so that the version_id is 4.0.3
Update your install and then check the `administrator\logs\joomla_update.php`
It should look like

* Fix null being passed to DateTime::__construct causing PHP 8.1 deprecation error

* Missing param default to fix uploads in PHP 8.1

* Tag 4.0.6 RC2

* Reset to dev

* Missing param default to fix renaming media in PHP 8.1

* Stub generator now handles deprecated namespaced classes (#35144)

* Fix error in article model (#36617)

* Fix code comment

* Temporary remove phpnext tests (#36624)

* Sign drone.yml

* Translation Update (#36645)

* Update extract.php (#36635)

* Update composer.lock

Co-authored-by: Brian Teeman <brian@teeman.net>
Co-authored-by: Harald Leithner <leithner@itronic.at>
Co-authored-by: Tobias Zulauf <zero-24@users.noreply.github.com>
Co-authored-by: Allon Moritz <allon.moritz@digital-peak.com>
Co-authored-by: Quy <quy@fluxbb.org>
Co-authored-by: Nicola Galgano <optimus4joomla@gmail.com>
Co-authored-by: Roland Dalmulder <contact@rolandd.com>
Co-authored-by: Tuan Pham Ngoc <github@joomdonation.com>
Co-authored-by: Fedir Zinchuk <getthesite@gmail.com>
Co-authored-by: wilsonge <georgejameswilson@googlemail.com>
Co-authored-by: Phil E. Taylor <phil@phil-taylor.com>
Co-authored-by: Crystal Dionysopoulos <9141288+crystalenka@users.noreply.github.com>
Co-authored-by: heelc29 <66922325+heelc29@users.noreply.github.com>
Co-authored-by: Geraint Edwards <github@copyn.plus.com>
Co-authored-by: Tony Partridge <tony@xws.im>
Co-authored-by: frostmakk <sveinung.larsen@lyse.net>
Co-authored-by: Dimitris Grammatikogiannis <d.grammatiko@gmail.com>
Co-authored-by: joomla-translation-bot <87496051+joomla-translation-bot@users.noreply.github.com>
Co-authored-by: Richard Fath <richard67@users.noreply.github.com>
Co-authored-by: Sveinung Larsen <frostmakk@users.noreply.github.com>
bembelimen added a commit that referenced this pull request Jan 15, 2022
* [4.0] Backup message (#36487)

Many users who use their hosts backup facility and this is typically __only__ for files

This update reminds them to backup the database as well

* Remove reference & in usort callback function (#36503)

* Update paragonie sodium_compat to 1.17.0 (#36491)

Co-authored-by: Benjamin Trenkle <bembelimen@users.noreply.github.com>

* [3.10] Finder plugins modify component params registry / Backport #35855 (#36141)

* Backport #35855 to 3.10

* one space to much

* [4.0]  xml code style (#36532)

Fixes a few spaces to tabs issues

* [4.0] media manager breadcrumbs (#36154)

* [4.0] media manager breadcrumbs

The RTL specific css was wrong as can be seen in the before screenshot

This PR removes the RTL specific css (should have been scss) and updates the scss to use logical properties instead.

This PR also removes an unused class `breadcrumb-item`.

To test RTL you will need to install arabic or persian.

and dont forget to npm ci

There is no visible change in LTR and the RTL changes are as shown below

## Before LTR

## Before RTL

## After LTR

## After RTL

* revert

* [4.0] RTL: Correcting Admin login 2factor and feedback hints (#36024)

This is a replacement to the merged PR #32104

It does exactly the same thing but by using css logical properties we avoid the need to maintain both an LTR and an RTL version[4.0]

There is no visual change

* [4.0] Category list (#36536)

Remove extra div that is not needed

* [4.0] Make routing work in console applications (#36332)

* Update list-fancy-select.php (#36543)

replace tab with space

code review

* [4.0] archive icon (#36263)

All the state icons are grey so that the published icon, which is green, stands out visually.

The archived icon however was black. This PR changes that icon to grey.

### Before

### After

* [4.0] Banner Client tips (#36262)

* [4.0] Banner Client tips

Adds a tooltip to the banner client numbers so that they appear the same as category numbers. Also corrects the class on the trashed number so that it has the correct colour

To test
Create one banner client
Create a banner for the client in each of the published states

* Update administrator/components/com_banners/tmpl/clients/default.php

oops

Co-authored-by: Quy <quy@fluxbb.org>

Co-authored-by: Quy <quy@fluxbb.org>

* Fix article creation from frontend (#36542)

* [4.0] Handle when toggle icon is not available (#36329)

* Handle when toggle icon is not available

* cs

* Take workflow extension into account when setting a default (#36527)

* Fix uploadlimits checks (#36023)

* Make edit_lock layout reusable for other extensions (#35112)

* Allow to set a value for SubformField (#35921)

* [4.0] Fix example in cleanImageURL docblock (#36554)

* Fix Codemirror behind tabs (#36140)

* Fix Codemirror behind tabs

* jscs

* Remove dependency on Factory in AdminController

* [4.0] Ensure path contains api in the router (#36315)

* [4.0] Check model is set before calling its methods (#36378)

* Check model is set before calling its methods

* Update OverridesController.php

* Category edit form should use return url (#36560)

Currently the article edit form respects return URLs; the category edit form does not. Adding it here makes for a more consistent editing experience.

* [4.0] Sample Data plugin images (#36237)

Updates the plugin to use the new image data used in lazy loading etc. This avoids confusion for users who see different source code for their created articles when compared to the same data plugins

To test. Just make sure the sample data still installs and works as expected

* [4.0] If the Mail Template was not found in the db, return false (#36489)

* [4.0] Code Style (#36564)

* Use an absolute path in image list field (#36063)

* Correct Cache setWorkarounds to take account of multiple script or style declarations being used that mean that we have an array of scripts or stylesheets to be cached and not just a string (#36068)

Cache setWorkarounds returns an array not a string

* [3] privacy request by logged in user only (#35470)

* privacy request logged in only

* privacy request logged in only

* privacy request logged in only

* privacy request logged in only

* privacy request logged in only

* Update components/com_privacy/controller.php

Co-authored-by: Quy <quy@fluxbb.org>

Co-authored-by: Quy <quy@fluxbb.org>

* Feature - Add always count option to 404 redirects (#34640)

* Feature - Add always count option to 404 redirects

* Add missiing space for code sniffer

* Return line for if statement

* Update plugins/system/redirect/redirect.php

Co-authored-by: Quy <quy@fluxbb.org>

* Alpha Ordering - Change Constant too.

* update constant

* Update en-GB.plg_system_redirect.ini

* remove trailing whtiespace

* Remove Added Language Strings

* Update plugins/system/redirect/redirect.php

Co-authored-by: Phil E. Taylor <phil@phil-taylor.com>

* Update redirect.xml

* Update redirect.php

* Update plugins/system/redirect/redirect.php

Co-authored-by: Quy <quy@fluxbb.org>

* Update plugins/system/redirect/redirect.php

Co-authored-by: Benjamin Trenkle <bembelimen@users.noreply.github.com>

* Update plugins/system/redirect/redirect.php

Co-authored-by: Quy <quy@fluxbb.org>
Co-authored-by: Phil E. Taylor <phil@phil-taylor.com>
Co-authored-by: Tobias Zulauf <zero-24@users.noreply.github.com>
Co-authored-by: Benjamin Trenkle <bembelimen@users.noreply.github.com>

* php8 deprecation str_replace Passing null to param (#36400)

* add php 8.1 to the version array (#36577)

* Add function parameters for callbacks. Fixes #36010

* PHP 8.1 deprecation fixes (#36306)

* Backport some deprecation fixes from the J4 branch

* Ensure htmlspecialchars is passed a string

* Ignore PHPCS errors

Co-authored-by: Tobias Zulauf <zero-24@users.noreply.github.com>

* Update simplepie to 1.3.3 (#36358)

* Update simplepie to 1.3.2 & phar-stream-wrapper to 2.2.2

* update to simplepie 1.3.3 to fix the version

* [3.10] Dont show the pre upgrade checker when the upgrade is not supported (#36312)

* [3.10] Fix Progressive caching to cache modules per custom menu assignment (#36324)

* Fix progressive caching

* Update libraries/src/Document/HtmlDocument.php

Co-authored-by: Phil E. Taylor <phil@phil-taylor.com>

* cast int

* Update libraries/src/Document/HtmlDocument.php

* Update libraries/src/Document/HtmlDocument.php

* Update libraries/src/Document/HtmlDocument.php

* Update libraries/src/Document/HtmlDocument.php

* Update libraries/src/Document/HtmlDocument.php

* Update libraries/src/Document/HtmlDocument.php

Co-authored-by: Phil E. Taylor <phil@phil-taylor.com>
Co-authored-by: Tobias Zulauf <zero-24@users.noreply.github.com>

* Bump registry to 1.6.4 (#36611)

* [4.0] Load the subform data correctly (#36598)

* Load the subform data correctly

* correct order

* don't remove <joomla-hidden-mail> (#36602)

* [4.0] Function to unregister a provider in media manager (#36594)

* Joomla! 3.10.5 Release Candidate 1

* [4.0] Latests/Popular Admin modules permissions (#36559)

* Allow our phpcode sniffer composer plugin to run

* PHP 8.1 fixes ported from #36355

* Fix codestyle. Thanks @brianteeman

* Improve security and type checking of the installer task

* Ensure the rule modifier is a string by default

* Ensure cpanel dashboard name is type safe (PHP 8.1)

* Fix mistake in param ordering

* Fix PHP 8.1 notice when creating an article

* Fix URL Field giving deprecated notices in PHP 8.1

* [4.0] Fix template preview (#36268)

* Fix template preview

* Fix template preview

* Fix Progressive caching to cache modules per custom menu assignment (#36193)

* Cross Origin for Google Fonts (#36592)

* Update Tobscure library to be PHP 8.1 compat

* Tag 4.0.6 RC1

* Reset to dev

* reset to dev

* Translation Update (#36356)

* [4.0] Fix images (#35780)

* [4.0] Joomla Update Silent fails (#36492)

* [4.0] Joomla Update Silent fails

I am not 100% certain that this is the best approach to this. @nikosdion @wilsonge please advise

## The Problem
As reported in # if during an update a sql query fails then the updater quits the sql part of the update process and moves on. The joomla_update log gives no indication that there has been a problem etc.

## Proposed Partial Solution
Adds a Start SQL and End SQL to the logs
If there is an error in the sql then that is written to the logs as well AND it now says End SQL incomplete

### Testing
For the testing we will be using the "Update your site by manually uploading the update package." and to make things quick I have prepared an empty update that you should download and use.

### Before Test 1
Update your install and then check the `administrator\logs\joomla_update.php`
It should look like

### Before Test 2
Update your database to change the value in the #__schemas table so that the version_id is 4.0.0-2018-5-15
Update your install and then check the `administrator\logs\joomla_update.php`
It should look like

### Before Test 3
Update your database to change the value in the #__schemas table so that the version_id is 4.0.3
Update your install and then check the `administrator\logs\joomla_update.php`
It should look like

### After - Test 1
Update your database to change the value in the #__schemas table so that the version_id is 4.0.4

Update your install and then check the `administrator\logs\joomla_update.php`
It should look like

### After -  Test 2
Update your database to change the value in the #__schemas table so that the version_id is 4.0.0-2018-5-15
Update your install and then check the `administrator\logs\joomla_update.php`
It should look like

### Before Test 3
Update your database to change the value in the #__schemas table so that the version_id is 4.0.3
Update your install and then check the `administrator\logs\joomla_update.php`
It should look like

* Fix null being passed to DateTime::__construct causing PHP 8.1 deprecation error

* Missing param default to fix uploads in PHP 8.1

* Tag 4.0.6 RC2

* Reset to dev

* Missing param default to fix renaming media in PHP 8.1

* Stub generator now handles deprecated namespaced classes (#35144)

* Fix error in article model (#36617)

* Fix code comment

* Temporary remove phpnext tests (#36624)

* Sign drone.yml

* Use the correct namespace for the taggable trait (#36640)

* Translation Update (#36645)

* Update extract.php (#36635)

* Updated MediaHelper::canUpload function

* Tag RC3

* Reset to dev

Co-authored-by: Brian Teeman <brian@teeman.net>
Co-authored-by: Harald Leithner <leithner@itronic.at>
Co-authored-by: Tobias Zulauf <zero-24@users.noreply.github.com>
Co-authored-by: Allon Moritz <allon.moritz@digital-peak.com>
Co-authored-by: Quy <quy@fluxbb.org>
Co-authored-by: Nicola Galgano <optimus4joomla@gmail.com>
Co-authored-by: Roland Dalmulder <contact@rolandd.com>
Co-authored-by: Tuan Pham Ngoc <github@joomdonation.com>
Co-authored-by: Fedir Zinchuk <getthesite@gmail.com>
Co-authored-by: wilsonge <georgejameswilson@googlemail.com>
Co-authored-by: Phil E. Taylor <phil@phil-taylor.com>
Co-authored-by: Crystal Dionysopoulos <9141288+crystalenka@users.noreply.github.com>
Co-authored-by: heelc29 <66922325+heelc29@users.noreply.github.com>
Co-authored-by: Geraint Edwards <github@copyn.plus.com>
Co-authored-by: Tony Partridge <tony@xws.im>
Co-authored-by: frostmakk <sveinung.larsen@lyse.net>
Co-authored-by: Dimitris Grammatikogiannis <d.grammatiko@gmail.com>
Co-authored-by: joomla-translation-bot <87496051+joomla-translation-bot@users.noreply.github.com>
Co-authored-by: Richard Fath <richard67@users.noreply.github.com>
Co-authored-by: Sveinung Larsen <frostmakk@users.noreply.github.com>
Co-authored-by: Akshit Rattan <akshitrattan@Akshits-MacBook-Air.local>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PHP 8.x PHP 8.x deprecated issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants