diff --git a/.github/workflows/mysql-parser-tests.yml b/.github/workflows/mysql-parser-tests.yml index f6465e4f1..05e7b0ea7 100644 --- a/.github/workflows/mysql-parser-tests.yml +++ b/.github/workflows/mysql-parser-tests.yml @@ -32,7 +32,7 @@ jobs: strategy: fail-fast: false matrix: - php: [ '7.2', '8.5' ] + php: [ '7.2', '8.6' ] steps: - name: Checkout repository diff --git a/.github/workflows/mysql-proxy-tests.yml b/.github/workflows/mysql-proxy-tests.yml index f560ba747..88509d200 100644 --- a/.github/workflows/mysql-proxy-tests.yml +++ b/.github/workflows/mysql-proxy-tests.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - php: ['7.2', '8.5'] + php: ['7.2', '8.6'] permissions: contents: read # Required to clone the repo. diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml index 74daffa4b..67b744fa0 100644 --- a/.github/workflows/phpunit-tests.yml +++ b/.github/workflows/phpunit-tests.yml @@ -47,6 +47,7 @@ jobs: - { php: '8.3', sqlite: '3.46.1' } # Debian 13 (Trixie) - { php: '8.4', sqlite: '3.51.2' } # First 2026 release - { php: '8.5', sqlite: 'latest' } + - { php: '8.6', sqlite: 'latest' } steps: - name: Checkout repository diff --git a/AGENTS.md b/AGENTS.md index fc62f7abe..59a4fc601 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -24,7 +24,7 @@ The monorepo packages are placed under the `packages` directory. The WordPress plugin links the MySQL on SQLite package using a symlink. The build script replaces the symlink with a copy of the package for release. -The codebase is pure PHP with zero dependencies. It supports PHP 7.2 through 8.5, +The codebase is pure PHP with zero dependencies. It supports PHP 7.2 through 8.6, MySQL syntax from version 5.7 onward, and requires SQLite 3.37.0 or newer (with legacy mode down to 3.27.0). diff --git a/README.md b/README.md index 2683d73ee..9eff93f29 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ The monorepo packages are placed under the `packages` directory. The WordPress plugin links the MySQL on SQLite package using a symlink. The build script replaces the symlink with a copy of the package for release. -The codebase is pure PHP with zero dependencies. It supports PHP 7.2 through 8.5, +The codebase is pure PHP with zero dependencies. It supports PHP 7.2 through 8.6, MySQL syntax from version 5.7 onward, and requires SQLite 3.37.0 or newer (with legacy mode down to 3.27.0). diff --git a/packages/mysql-proxy/bin/wp-mysql-proxy.php b/packages/mysql-proxy/bin/wp-mysql-proxy.php index c908ffac1..820a7f744 100644 --- a/packages/mysql-proxy/bin/wp-mysql-proxy.php +++ b/packages/mysql-proxy/bin/wp-mysql-proxy.php @@ -125,18 +125,18 @@ $password_file = $opts['password-file']; // Pipes, such as /dev/stdin or a process substitution, keep the password off the disk. - if ( ! is_readable( $password_file ) || is_dir( $password_file ) ) { - fwrite( STDERR, "Error: --password-file must name a readable file.\n" ); - exit( 1 ); - } - // On Linux, PHP can't open a pipe by its /dev/fd path, so read a descriptor of // this process through php://fd. See https://github.com/php/php-src/issues/9551. $source = $password_file; if ( '/dev/stdin' === $password_file ) { $source = 'php://fd/0'; - } elseif ( preg_match( '~^/(?:dev|proc/self)/fd/(\d+)$~', $password_file, $match ) ) { + } elseif ( preg_match( '~^/(?:dev|proc/self)/fd/(\d+)\z~', $password_file, $match ) ) { $source = 'php://fd/' . $match[1]; + } elseif ( ! is_readable( $password_file ) || is_dir( $password_file ) ) { + // Only other paths are checked, as is_readable() fails for the path of + // a pipe on thread-safe PHP builds. + fwrite( STDERR, "Error: --password-file must name a readable file.\n" ); + exit( 1 ); } // Report a failed read without PHP's warning, which names the path. diff --git a/packages/mysql-proxy/tests/WP_MySQL_Proxy_Command_Test.php b/packages/mysql-proxy/tests/WP_MySQL_Proxy_Command_Test.php index e5bf5cc5e..4794b5d92 100644 --- a/packages/mysql-proxy/tests/WP_MySQL_Proxy_Command_Test.php +++ b/packages/mysql-proxy/tests/WP_MySQL_Proxy_Command_Test.php @@ -59,6 +59,9 @@ public function invalid_arguments(): array { array( array( '--user=user' ), '', 'Error: A nonempty password without NUL bytes is required.' ), array( array( '--user=user', '--password-file=/nonexistent/proxy-password' ), 'password', 'must name a readable file' ), array( array( '--user=user', '--password-file=' . __DIR__ ), 'password', 'must name a readable file' ), + // A descriptor number beyond PHP's limit, so it can't be open in the test process. + array( array( '--user=user', '--password-file=/dev/fd/9999999999' ), 'password', '--password-file could not be read' ), + array( array( '--user=user', "--password-file=/dev/fd/0\n" ), 'password', 'must name a readable file' ), array( array( '--user=user', '--user=other' ), 'password', 'Invalid command-line options' ), array( array( '--user=user', '--auth-plugin=mysql_clear_password' ), 'password', 'Error: The authentication plugin must be one of' ), array( array( '--user=user', '--auth-plugin=' ), 'password', 'Error: The authentication plugin must be one of' ), diff --git a/packages/plugin-sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-db.php b/packages/plugin-sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-db.php index 15d5dc954..e26aa4fb8 100644 --- a/packages/plugin-sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-db.php +++ b/packages/plugin-sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-db.php @@ -524,9 +524,12 @@ public function prepare( $query, ...$args ) { $wpdb_allow_unsafe_unquoted_parameters = $this->__get( 'allow_unsafe_unquoted_parameters' ); if ( $wpdb_allow_unsafe_unquoted_parameters !== $this->allow_unsafe_unquoted_parameters ) { $property = new ReflectionProperty( 'wpdb', 'allow_unsafe_unquoted_parameters' ); - $property->setAccessible( true ); + + // Private properties are accessible since PHP 8.1, and the method is deprecated since PHP 8.5. + if ( PHP_VERSION_ID < 80100 ) { + $property->setAccessible( true ); + } $property->setValue( $this, $this->allow_unsafe_unquoted_parameters ); - $property->setAccessible( false ); } return parent::prepare( $query, ...$args );