[wp-trac] [WordPress Trac] #55678: Avoid `filesize()` warnings when storing file size in media metadata
WordPress Trac
noreply at wordpress.org
Sat May 7 01:48:40 UTC 2022
#55678: Avoid `filesize()` warnings when storing file size in media metadata
-------------------------------------------+------------------------
Reporter: johnbillion | Owner: audrasjb
Type: defect (bug) | Status: reviewing
Priority: normal | Milestone: 6.0
Component: Media | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch commit dev-feedback | Focuses:
-------------------------------------------+------------------------
Comment (by costdev):
@johnbillion @spacedmonkey Using `is_readable()` will change the behaviour
of `wp_filesize()`.
`filesize()` still returns the filesize for an unreadable file.
So this change will mean that `wp_filesize()` will have previously
returned `1000000000` for a 1GB unreadable file, but will now return `0`.
IMO, this change of behaviour, if intentional, should be handled
separately from removing error suppression, and the documentation of
`wp_filesize()` should change to reflect the caveat.
If this change of behaviour isn't intentional, then `file_exists()` is
indeed the best conditional to remove the need for error suppression, as
this ''is'' a failure condition of `filesize()`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/55678#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list