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

Fix deprecation of strtoupper receiving null #149

Conversation

remyvanlerberghe
Copy link

This PR fixes following deprecation by moving exception throw before the call to strtoupper
Deprecated: strtoupper(): Passing null to parameter #1 ($string) of type string is deprecated in /app/vendor/rlanvin/php-rrule/src/RRule.php on line 242

@remyvanlerberghe remyvanlerberghe force-pushed the fix-strtoupper-deprecation branch 2 times, most recently from aa192a9 to 427f212 Compare May 22, 2024 06:12
@rlanvin
Copy link
Owner

rlanvin commented Jun 8, 2024

array_key_exists is case sensitive to this PR makes a lot of tests fail. Why not just cast the parameter to string?

@remyvanlerberghe remyvanlerberghe force-pushed the fix-strtoupper-deprecation branch from 427f212 to c47fd49 Compare June 12, 2024 07:38
rlanvin added a commit that referenced this pull request Jun 23, 2024
In some cases non-string types would end up passed to strtoupper
which causes a deprecation warning from PHP 8.3.
There might be other places where stricter type check is needed
Ref #149
@rlanvin
Copy link
Owner

rlanvin commented Jun 23, 2024

Hello, looking at this issue in more details I realised this isn't the right way to solve it. Non-string types shouldn't end up in strtoupper in the first place, so I refactored the code to add better type checks. Thanks for reporting the issue.

@rlanvin rlanvin closed this Jun 23, 2024
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