Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/mysql-parser-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '7.2', '8.5' ]
php: [ '7.2', '8.6' ]

steps:
- name: Checkout repository
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mysql-proxy-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/phpunit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down
12 changes: 6 additions & 6 deletions packages/mysql-proxy/bin/wp-mysql-proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions packages/mysql-proxy/tests/WP_MySQL_Proxy_Command_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
Loading