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

Deprecations with PHP 8.4 #89

Closed
acelaya opened this issue Oct 28, 2024 · 8 comments · Fixed by #91
Closed

Deprecations with PHP 8.4 #89

acelaya opened this issue Oct 28, 2024 · 8 comments · Fixed by #91

Comments

@acelaya
Copy link

acelaya commented Oct 28, 2024

I noticed a few deprecation warnings when using this library with PHP 8.4

  1. IPLib\Factory::rangeFromBoundaryAddresses(): Implicitly marking parameter $from as nullable is deprecated, the explicit nullable type must be used instead
  2. IPLib\Factory::rangeFromBoundaryAddresses(): Implicitly marking parameter $to as nullable is deprecated, the explicit nullable type must be used instead

I can provide a PR fixing those and adding PHP 8.3 and 8.4 to the pipelines if desired.

@mlocati
Copy link
Owner

mlocati commented Oct 28, 2024

I can provide a PR fixing those and adding PHP 8.3 and 8.4 to the pipelines if desired.

Sure it'd be very welcome (unless it doesn't require increasing the minimum PHP version supported to something greater than 5.5)

@acelaya
Copy link
Author

acelaya commented Oct 28, 2024

(unless it doesn't require increasing the minimum PHP version supported to something greater than 5.5)

I'm afraid the only way to fix it is by explicitly marking types as nullable (eg. ?string $foo = null instead of string $foo = null) which is only supported by PHP 7.1 and newer.

I guess another option would be using a different default value instead of null, like an empty string, but I don't know if the same functionality would be possible. I'll check it.

That said, PHP versions older than 7.1 are more than 8 years old and unsupported for a long time. What's the point on keeping support for those?

@acelaya
Copy link
Author

acelaya commented Oct 28, 2024

Perhaps this helps choosing the right PHP versions to support https://packagist.org/packages/mlocati/ip-lib/php-stats#1.18

According to that, more than 95% of installs for the last version came from PHP >=7.1

@mlocati
Copy link
Owner

mlocati commented Oct 28, 2024

I belong to the remaining 5%

@acelaya
Copy link
Author

acelaya commented Oct 28, 2024

I belong to the remaining 5%

Wow 😅

I'll try to find an approach that doesn't require using nullable types.

@acelaya
Copy link
Author

acelaya commented Oct 29, 2024

I have just provided a PR fixing the deprecation warning in a way that does not require dropping support for older PHP versions #90

It's potentially a breaking change though, but I don't see a way around this that isn't.

@mlocati
Copy link
Owner

mlocati commented Oct 29, 2024

@acelaya Thank you for the report: I've just published version 1.18.1 which includes a fix for this issue

@acelaya
Copy link
Author

acelaya commented Oct 29, 2024

Thanks! I'll go test it.

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 a pull request may close this issue.

2 participants