Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Add support for PHP 8. #375

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open

Conversation

whyisjake
Copy link

Let's do it live.

@facebook-github-bot
Copy link

Hi @whyisjake!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

whyisjake and others added 17 commits September 14, 2022 19:50
PHP 8.1 generates a deprecation notice:

> strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated

This changes the `null` to an empty string if it hasn't been set.
Fix strpos() deprecation notice
PHP 8.2 generates a deprecation notice:

> mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead

So this removes the use of the function and uses the existing fallback, albeit with use of htmlentities() as well.
Remove mb_convert_encoding() for HTML entities
PHP 8.2 generates a deprecation notice:

> mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead

This applies the correct fix, as per the suggestion at https://php.watch/versions/8.2/mbstring-qprint-base64-uuencode-html-entities-deprecated#html
With it in `require`, any consuming package running `composer i --no-dev` will still get all of the PHPCS-related packages installed.
Move the dev dependency to require-dev
This restores the original code that caused the PHP 8.2 deprecation notice, because the other native functions all tend to do something slightly different.
Passing null to parameter #2 ($string) of type string is deprecated.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants