Repository navigation
Add PHP 8.6 support - #635
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 11 minutes. View limit details
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
## Summary This PR fixes **bit literals and `BIT` column defaults of 64 or more bits**, and it makes the driver **reject invalid `BIT` widths and defaults** with the same errors as MySQL. The fixes: - **Bit literals of any length** translate to the correct bytes. A literal such as `b'101'` or `0b101` is converted byte by byte, instead of through a number. - **Hex defaults of `BIT` columns** are converted digit by digit, so `BIT(64) DEFAULT 0xFFFFFFFFFFFFFFFF` works. - **The `BIT` width** must be 1 to 64 bits. `BIT(65)` gives error 1439 and `BIT(0)` gives error 3013. - **A literal `BIT` default** must fit the column width. Otherwise, it gives error 1067. Expression defaults are not checked, as in MySQL. ## Why The driver converted these values with `base_convert()`, `bindec()`, and `hexdec()`. They lose precision above `PHP_INT_MAX`, so the results were wrong for 64 or more bits. **PHP 8.6 also raises a notice for these calls**, so this PR needs to land before the PHP 8.6 support in #635. The driver also accepted `BIT` columns and defaults that MySQL rejects. With the new checks, a stored `BIT` default always has at most 64 bits, which keeps its conversion for SQLite simple and exact. These results now match MySQL 8.4: | Query | Before | After | | --- | --- | --- | | `SELECT HEX(b'1…1')` with 64 bits | SQLite syntax error | `FFFFFFFFFFFFFFFF` | | `SELECT HEX(b'')` | SQLite syntax error | Empty string | | `SELECT HEX(0b…)` with 72 bits | Wrong last byte | The correct bytes | | `BIT(64) DEFAULT 0xFFFFFFFFFFFFFFFF` | `TypeError` | `b'1…1'` in `SHOW CREATE TABLE` | | `BIT(65)` | Accepted | Error 1439 | | `BIT(0)` | Accepted | Error 3013 | | `BIT(8) DEFAULT b'111111111'` | Accepted | Error 1067 | ## Notes Some `BIT` behavior still differs from MySQL. This PR doesn't change it: - **Values that use the 64th bit can't be stored**, because SQLite integers are signed. Inserting one fails with an SQLite error. - **Decimal defaults of 2^63 or more** are capped to 63 ones. - **Literals longer than 8 bytes** are accepted when the value fits. MySQL rejects them in strict mode. - **Quoted strings** are read as numbers, and fractions are truncated. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Improved handling of binary literals, including values that don’t contain a whole number of bytes and values up to 64 bits. * BIT column defaults are now validated against the column’s width and the 64-bit limit, with accepted values formatted consistently. * Invalid BIT widths and defaults now return MySQL-compatible errors with details about the affected column. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
792228a to
a7a60a4
Compare
On thread-safe PHP builds on Linux, is_readable() fails for the path of a pipe, so the proxy rejected "--password-file=/dev/stdin" and process substitutions. The official PHP 8.6 Docker image is such a build. Skip the check for descriptor paths. A descriptor that can't be read is still reported when it is read.
The method has no effect since PHP 8.1 and is deprecated since PHP 8.5. Call it only on older PHP versions, and drop the call that reset it on a discarded object.
The driver suite gets a PHP 8.6 job. The parser and proxy suites, which test the oldest and the latest PHP version, move from 8.5 to 8.6.
a7a60a4 to
b8cb729
Compare
Summary
This PR adds support for PHP 8.6. It fixes two issues found while testing on PHP 8.6, and it adds PHP 8.6 to CI:
wpdb::prepare()no longer raises a deprecation. It calledReflectionProperty::setAccessible(), which is deprecated since PHP 8.5 and only needed below PHP 8.1.--password-fileaccepts/dev/stdinand process substitutions on thread-safe PHP builds, such as the officialphp:8.6-cliDocker image. On these builds,is_readable()fails for a pipe on Linux.README.mdandAGENTS.mdlist PHP 7.2 through 8.6 as supported.Why
PHP 8.6 was released, and the project should run on it without notices and deprecations.
Note
The WordPress test jobs run on a PHP image pinned to 8.3.10, so they don't test the plugin on PHP 8.5 or 8.6. That is why CI didn't catch the
setAccessible()deprecation.Summary by CodeRabbit