[wp-trac] [WordPress Trac] #54826: PHP 8.0: Fatal errors are no longer suppressed by `@`.

WordPress Trac noreply at wordpress.org
Mon Jan 17 11:39:50 UTC 2022

#54826: PHP 8.0: Fatal errors are no longer suppressed by `@`.
 Reporter:  costdev          |       Owner:  SergeyBiryukov
     Type:  task (blessed)   |      Status:  closed
 Priority:  normal           |   Milestone:  6.0
Component:  Upgrade/Install  |     Version:
 Severity:  normal           |  Resolution:  fixed
 Keywords:  php8 has-patch   |     Focuses:
Changes (by SergeyBiryukov):

 * status:  reviewing => closed
 * resolution:   => fixed


 In [changeset:"52585" 52585]:
 #!CommitTicketReference repository="" revision="52585"
 Upgrade/Install: Check if the `disk_free_space()` function exists before
 calling it.

 In PHP 8+, `@` no longer suppresses fatal errors:
 > The `@` operator will no longer silence fatal errors (`E_ERROR`,

 Reference: [https://www.php.net/manual/en/migration80.incompatible.php PHP
 8: Backward Incompatible Changes].

 `disk_free_space()` may be disabled by hosts, which will throw a fatal
 error on a call to undefined function.

 This change prevents the fatal error, and falls back to `false` when
 `disk_free_space()` is unavailable.

 Follow-up to [25540], [25774], [25776], [25831], [25869].

 Props costdev, jrf, swb1192, SergeyBiryukov.
 Fixes #54826. See #54730.

Ticket URL: <https://core.trac.wordpress.org/ticket/54826#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list