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 compatibility #11

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

swordfox
Copy link

No description provided.

@DorsetDigital
Copy link
Owner

Thanks for the PR. I was curious about the addition of the ternary operation on the body variable. What's the issue in
PHP8.1 that fixes?

Cheers
Tim

@swordfox
Copy link
Author

Hey Tim,

See below error that it threw:

[Deprecated] str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
GET /dev/build
Line 154 in /vendor/dorsetdigital/silverstripe-cdnrewrite/src/CDNMiddleware.php

I'm not sure if what I have done is the best way to fix the issue but it works.

Cheers

@DorsetDigital
Copy link
Owner

Ah, interesting. I didn't think there would be a situation when the body would be null.
Would you mind updating your PR to add the same functionality to the addPrefetch() function as well? I figure that would throw the same warning if the body is null and prefetch tags are active.

@swordfox
Copy link
Author

Hey Tim,

I've done quite a few tests and weirdly it only throws an error for rewriteTags() and only when doing dev/build.

Cheers

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