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

ENH PHP 8.1 compatibility #483

Merged
merged 1 commit into from
Apr 22, 2022

Conversation

emteknetnz
Copy link
Member

@emteknetnz emteknetnz marked this pull request as draft April 4, 2022 09:42
@emteknetnz emteknetnz force-pushed the pulls/1/php81 branch 4 times, most recently from 641fed3 to f249b7a Compare April 7, 2022 22:29
@emteknetnz emteknetnz marked this pull request as ready for review April 20, 2022 05:08
Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really long PR so I stopped marking them pretty quickly but there are a lot of examples of the below regex functions getting an empty string where an empty regex is needed. Probably worth amending the automated thing and re-running it rather than trying to go through them all by hand.

src/Dev/Tasks/SecureAssetsMigrationHelper.php Show resolved Hide resolved
src/Dev/Tasks/TagsToShortcodeHelper.php Show resolved Hide resolved
src/Dev/Tasks/TagsToShortcodeHelper.php Show resolved Hide resolved
src/Dev/Tasks/TagsToShortcodeHelper.php Show resolved Hide resolved
Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For posterity: See discussion in silverstripe/silverstripe-admin#1294 about the general approach. tl;dr:

the purposes of this PR is to avoid passing null (specifically null) from built-in functions that as of php 8.1 will throw deprecation warnings if null is passed in. The approach is necessarily heavy-handed, and while there are many situations where it isn't needed, it would be prohibitively laborious to find all of those situations by hand.

Looks good to me, but I'll hold off merging until the outstanding questions about file_get_contents(), and file_put_contents(), and unlink() have been answered on the other PRs.
Edit: Question was answered. There is no problem - the approach here is correct.

@GuySartorelli GuySartorelli merged commit e5ca733 into silverstripe:1 Apr 22, 2022
@GuySartorelli GuySartorelli deleted the pulls/1/php81 branch April 22, 2022 04:19
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.

2 participants