-
Notifications
You must be signed in to change notification settings - Fork 15
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 error Profile view articles #911
Comments
solution? $rat = explode(',', (string)$row['rating']); or $rat = explode(',', $row['rating'] ?? ' '); which one is better? |
$rat = !is_null($row['rating']) ? explode(',', $row['rating']) : 0; |
I used this, $rat = explode(',', $row['rating'] ?? ' '); ?? is supported from PHP7.0. |
I personally can’t see an issue today, if PHP decide to throw a error on an empty string it will. I’ve done it the way I put in other places so consistency should be we do one or the other. I personally don’t like having conditionals inside functions as it can be harder to track down an error, but functionally your way will work. |
Access the my articles page from the profile:
https://localhost/vanilla/index.php?action=profile;area=tparticles;u=3
C:/xampp/htdocs/vanilla/Sources/TPSubs.php (Line 2808)
Notice
: explode(): Passing null to parameter #2 ($string) of type string is deprecated in
C:\xampp\htdocs\vanilla\Sources\TPSubs.php
on line
2808
code
The text was updated successfully, but these errors were encountered: