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

[Bug]: PHP 8.1 PHP Deprecated: Constant Inpsyde\Wonolog\Data\FILTER_SANITIZE_STRING is deprecated #67

Closed
1 task done
thefrosty opened this issue Jun 22, 2022 · 9 comments
Assignees
Labels

Comments

@thefrosty
Copy link

Description of the bug

Using FILTER_SANITIZE_STRING is deprecated in PHP 8.1.

PHP Deprecated:  Constant Inpsyde\Wonolog\Data\FILTER_SANITIZE_STRING is deprecated in /usr/local/wordpress/vendor/inpsyde/wonolog/src/PhpErrorController.php on line 100

Reproduction instructions

Install PHP 8.1, and turn on WP_DEBUG, note logs after logging in a traversing the admin core pages.

Expected behavior

No deprecation notices.

Environment info

  • Wonolog ^1.0
  • WordPress 6.0
  • PHP 8.1

Relevant log output

No response

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@thefrosty thefrosty added the bug label Jun 22, 2022
@gmazzap
Copy link
Contributor

gmazzap commented Jun 24, 2022

@thefrosty we have a couple of lefotover instances of that string in v2, because PHP did not provide a replacement for it :(, and so we need to refactor https://github.com/inpsyde/Wonolog/blob/2.x/src/Data/Log.php

I will fix them in v2, but likely not in in v1

@thefrosty
Copy link
Author

That's fine, I wasn't aware of a v2, would love to see a beta or alpha tag to try out.

@gmazzap
Copy link
Contributor

gmazzap commented Jun 25, 2022

@thefrosty The branch "2.x" is the alpha right now https://github.com/inpsyde/Wonolog/tree/2.x

And it needs testing :)

Docs: https://github.com/inpsyde/Wonolog/tree/2.x/docs are already updated

@pierre-dargham
Copy link
Contributor

pierre-dargham commented Feb 21, 2023

Hello @gmazzap,

Any news regarding this issue ?

We are already using branch 2.x in production on a few projects, and it seems pretty much stable at this point, but we're still running them in PHP 8.0.

Now, with PHP 8.0 end of support coming before the end of the year, upgrade to 8.1 or 8.2 is becoming urgent.

I started to work on a PR a few weeks ago, but I didn't manage to have a strictly equivalent behavior with htmlspecialchars(), and I wasn't sure of the logic here, so I didn't achieve it..

Bests regards,
Pierre

@gmazzap
Copy link
Contributor

gmazzap commented Feb 28, 2023

Hi @pierre-dargham I should be able to fix this and release v2 in beta very soon.

@gmazzap
Copy link
Contributor

gmazzap commented Mar 1, 2023

v2.0.0-beta.1 Should fix this already.

@gmazzap gmazzap self-assigned this Mar 1, 2023
@gmazzap
Copy link
Contributor

gmazzap commented Mar 1, 2023

v2 already tests in both unit and integration in all PHP version from 7.2 to 8.2.
I'm closing this. If anyone has feedback, please share, thanks!

@gmazzap gmazzap closed this as completed Mar 1, 2023
@braders
Copy link

braders commented Apr 20, 2023

@gmazzap We are looking to test Wonolog 2.x in order to fix these PHP 8 deprecations. I've looked through the docs, but cannot see any sort of upgrade guide. Does that mean Wonolog 2.x should be a drop-in replacement for Wonolog 1.x.

In other words - are there breaking changes we need to be aware of?

@gmazzap
Copy link
Contributor

gmazzap commented Apr 20, 2023

@braders It's not a drop-in replacement.

As you know, Wonolog is very extensible and can do many things. The "basics" that you get out of the box are the same for v1 and v2.

But if you have extended v1 in some way, it might need adjustment to get the same extension work in v2, even if we tried to make it as much backward compatible as possible. But it is still a major version, so some breaking changes exist.

However, there're relevant changes in the configuration.

You right, we need to work on an upgrade guide, in the meantime if you tell me how you're configuring your v1 I can tell you the way to obtain same things in v2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants