Opened 9 years ago
Closed 9 years ago
#41484 closed defect (bug) (fixed)
PHP 7.1 error in wp_star_rating()
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 4.9 | Priority: | normal |
| Severity: | normal | Version: | 4.9 |
| Component: | Plugins | Keywords: | has-patch needs-testing |
| Focuses: | administration | Cc: |
Description
In PHP 7.1, passing a null or empty value to round() results in a PHP warning on the Add Plugin page. This happens when the star rating is 0.
This from line 2121 from /wp-admin/includes/template.php .
Attachments (1)
Change History (5)
Note: See
TracTickets for help on using
tickets.
Apparently
$ratingcan be a float (0..5 in .5 increments) if$r['type']israting. Core only usespercenttype, but float usage should also be documented.I could not reproduce the actual warning with
'0'as$r['rating']. Reproduced with'', but the API seems to return the former. Seems like a good fix anyway.