#52825 closed defect (bug) (fixed)
[PHP 8.1] MySQLi error reporting value changes
Reported by: | ayeshrajans | Owned by: | jrf |
---|---|---|---|
Milestone: | 5.9 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Database | Keywords: | php81 has-patch commit early |
Focuses: | Cc: |
Description
I suppose this is the first ticket for PHP 8.1 - Exciting :)
In PHP 8.1, the default error reporting is set to always throw an exception, as opposed to emitting a warning. WordPress gracefully handles the database errors by inspecting the error codes.
I suggest that WordPress set the error reporting mode to off, which is the default value prior to this change. Unless we do this, any bad MySQLi connection will throw an exception, leading to a WSOD, or a blank page with the uncaught exception error.
(linking to a PR)
Change History (6)
This ticket was mentioned in PR #1099 on WordPress/wordpress-develop by Ayesh.
4 years ago
#1
#2
@
3 years ago
- Keywords commit early added
- Milestone changed from Awaiting Review to 5.9
- Owner set to jrf
- Status changed from new to accepted
This patch is a prerequisite before CI testing against PHP 8.1 can be enabled as the CI build fails in the "Install WordPress" step while running the tools/local-env/scripts/install.js
script due to this issue.
Failing build where this can be seen
I've reviewed the patch and this is exactly what needs to be done. Only remark I could make is that the comment should probably use /* .. */
multi-line style 😄
Build without the mysqli error (but still erroring) which includes the PHPUnit patches + this patch
A commit at the earliest convenience would be appreciated. /cc @SergeyBiryukov
SergeyBiryukov commented on PR #1099:
3 years ago
#4
Thanks for the PR! Merged in https://core.trac.wordpress.org/changeset/51582.
In PHP 8.1, the default error reporting is set to always throw an exception, as opposed to emitting a warning. WordPress gracefully handles the database errors by inspecting the error codes.
I suggest that WordPress set the error reporting mode to off, which is the default value prior to this change. Unless we do this, any bad MySQLi connection will throw an exception, leading to a WSOD, or a blank page with the uncaught exception error.
Trac ticket: https://core.trac.wordpress.org/ticket/52825