Opened 5 months ago
Closed 8 weeks ago
#9307 closed defect (bug) (fixed)
closedir() should be called conditionally
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 14.5.0 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Media | Keywords: | commit |
| Cc: | emaralive, GaryJ |
Description
BuddyPress 14.3.4 has a PHP 8 compatibility bug where closedir() is called outside the conditional block that checks if opendir() succeeded. This causes fatal errors on platforms that intentionally return empty strings for avatar directories (e.g. WPVIP's file service).
In two places in BuddyPress, closedir() is called unconditionally:
- Line 571 in
bp_core_fetch_avatar() - Line 865 in
bp_core_delete_existing_avatar()
This generates a noisy set of PHP warnings that can't be worked around with filters, and only a patch being applied to BuddyPress works. If the closedir() called was inside the conditional that uses opendir(), then the same intended behaviour would still work, but without the warning from PHP 8.
Change History (9)
#3
@
5 months ago
- Milestone changed from Awaiting Review to Under Consideration
- Owner set to espellcaste
- Status changed from new to assigned
I can handle this. Thanks for the bug report and the prior art.
#4
@
4 months ago
- Keywords commit added
- Milestone changed from Under Consideration to 15.0.0
- Owner changed from espellcaste to johnjamesjacoby
#6
@
2 months ago
I see some recent changes from other tickets I've opened have been milestoned for 14.5.0. Any chance this one could move from 15.0.0 to 14.5.0 as well please?
See this change for BuddyBoss which tackles the same issue.