Skip to content

Add PHP 8.6 support - #635

Merged
JanJakes merged 4 commits into
trunkfrom
php-8-6-support
Nov 23, 2026
Merged

JanJakes merged 4 commits into
trunkfrom
php-8-6-support

Conversation

@JanJakes

@JanJakes JanJakes commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

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:

  • Plugin: wpdb::prepare() no longer raises a deprecation. It called ReflectionProperty::setAccessible(), which is deprecated since PHP 8.5 and only needed below PHP 8.1.
  • Proxy: --password-file accepts /dev/stdin and process substitutions on thread-safe PHP builds, such as the official php:8.6-cli Docker image. On these builds, is_readable() fails for a pipe on Linux.
  • CI: The driver tests get a PHP 8.6 job. The parser and proxy tests run on the oldest and the latest PHP version, so they move from 8.5 to 8.6.
  • Docs: README.md and AGENTS.md list 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

  • New Features
    • Support now extends through PHP 8.6.
  • Bug Fixes
    • Password-file checks now correctly handle supported file-descriptor paths while continuing to reject unreadable files.
    • Improved SQLite database compatibility with PHP 8.1 and later.

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0c7b69ba-5ca3-46c4-8ab8-dd27b9722811
Commits

Reviewing files that changed from the base of the PR and between a7a60a4 and b8cb729.

Files selected for processing: 8

  • .github/workflows/mysql-parser-tests.yml
  • .github/workflows/mysql-proxy-tests.yml
  • .github/workflows/phpunit-tests.yml
  • AGENTS.md
  • README.md
  • packages/mysql-proxy/bin/wp-mysql-proxy.php
  • packages/mysql-proxy/tests/WP_MySQL_Proxy_Command_Test.php
  • packages/plugin-sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-db.php

No actionable comments were generated in the recent review.

Walkthrough

The pull request updates PHP test coverage and support documentation for PHP 8.6. It also changes password-file path validation in the MySQL Proxy CLI and reflection accessibility handling in WP_SQLite_DB::prepare().

Changes: PHP 8.6 support

Layer / File(s) Summary
PHP 8.6 test coverage and support range
AGENTS.md, README.md, .github/workflows/mysql-parser-tests.yml, .github/workflows/mysql-proxy-tests.yml, .github/workflows/phpunit-tests.yml
The documentation now states PHP support through 8.6. The test workflows replace PHP 8.5 with 8.6 in two matrices and add PHP 8.6 with the latest SQLite release in the PHPUnit matrix.

MySQL Proxy password-file paths

Layer / File(s) Summary
Map descriptor paths before validation
packages/mysql-proxy/bin/wp-mysql-proxy.php, packages/mysql-proxy/tests/WP_MySQL_Proxy_Command_Test.php
The CLI maps recognized descriptor paths to php://fd before applying readability and directory checks to other paths. The invalid-arguments test includes /dev/fd/99 and expects the existing unreadable-file error.

SQLite reflection accessibility

Layer / File(s) Summary
Guard reflection accessibility by PHP version
packages/plugin-sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-db.php
WP_SQLite_DB::prepare() calls setAccessible(true) only when PHP_VERSION_ID < 80100. It still updates the reflected property and no longer calls setAccessible(false) afterward.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Merge Risk: Minimal · previous review a7a60

This change adds PHP 8.6 to CI and the documented support range. It also avoids a deprecated reflection call and lets the proxy accept descriptor paths for password files. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Add PHP 8.6 support" matches the main objective of the PR. The changes add PHP 8.6 to the CI matrices, update the README and AGENTS.md support ranges to PHP 7.2 through 8.6, and add 8.6-spe…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Add PHP 8.6 support" matches the main objective of the PR. The changes add PHP 8.6 to the CI matrices, update the README and AGENTS.md support ranges to PHP 7.2 through 8.6, and add 8.6-specific code changes such as skipping ReflectionProperty::setAccessible() on PHP 8.1 and later and handling descriptor paths for --password-file. The title is concise and specific, and a reviewer scanning history would understand the primary change.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3f77b024-a7f5-480f-984b-93a651191a31
Commits

Reviewing files that changed from the base of the PR and between e82c914 and a7a60a4.

Files selected for processing: 8

  • .github/workflows/mysql-parser-tests.yml
  • .github/workflows/mysql-proxy-tests.yml
  • .github/workflows/phpunit-tests.yml
  • AGENTS.md
  • README.md
  • packages/mysql-proxy/bin/wp-mysql-proxy.php
  • packages/mysql-proxy/tests/WP_MySQL_Proxy_Command_Test.php
  • packages/plugin-sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-db.php

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

JanJakes added a commit that referenced this pull request Nov 23, 2026
## 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 -->
@JanJakes
JanJakes marked this pull request as ready for review November 23, 2026 12:19
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.
@JanJakes
JanJakes merged commit 2300409 into trunk Nov 23, 2026
22 checks passed
@JanJakes
JanJakes deleted the php-8-6-support branch November 23, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant