This commit is contained in:
Javier Casares 2026-11-04 14:37:18 +00:00
commit 7379505d20
32 changed files with 912 additions and 139 deletions

View file

@ -1,5 +1,33 @@
== Changelog == == Changelog ==
= 1.6.9 =
_Release date: 2026-11-03_
**Changed**
* Compatibility floors raised: minimum WordPress moved from 5.6 to 7.0 and minimum PHP from 8.0 to 8.3, matching the support policy (latest stable WordPress plus the two previous majors). The full-range compatibility review (WordPress 4.7-7.2 walked down with wp-compat; PHP 5.6-8.6 scanned with PHPCompatibility) confirmed the plugin uses no WordPress symbols newer than 6.0 and no PHP syntax newer than 8.0, so the real code floors are lower — the declared floors are the supported ones. WordPress 7.2 (beta 4, single-site) and WordPress 7.0 (multisite) were live-tested; PHP 8.6 (RC 3) was live-tested and PHP 8.3-8.6 scanned clean.
* The admin menu icon is now a brand SVG (shield with keyhole, base64 data URI) instead of `dashicons-shield`, on both single-site and network admin menus. WordPress core natively renders base64 SVG menu icons (centered at 20px), so the icon works identically on WordPress 7.0, 7.1 and 7.2, stays crisp on high-density screens, and is future-proof against the admin-wide move from Dashicons to SVG icons tracked in WordPress core (PR #12270 / Trac ticket #65089). Dashicons continue to work everywhere else.
* Composer tooling updated: wp-compat 3.0.1, PHPStan 2.3.5, wordpress-stubs 7.1.2, PHPUnit 9.6.38, maxmind-db/reader 1.14.0; `composer audit` reports no known vulnerabilities.
**Fixed**
* PHP 8.6 deprecation removed: the REST controller declared a class constant named `namespace` (case-insensitively), which PHP 8.6 deprecates and PHP 9 will reject as a fatal error. Renamed to `REST_NAMESPACE` with no functional change (the constant was private).
* Static-analysis hardening to pass PHPStan at the new maximum level (10) without a baseline: `$wpdb`, `$wp_filter` and `$post` globals are now properly typed; the uninstall routine deletes user meta through the `$wpdb->delete()` WordPress API instead of hand-built SQL; role names from `get_editable_roles()` are validated before translation; `AUTH_SALT` and `COOKIEPATH` are validated as strings before use in the trusted-device cookie; the trusted-device map discards corrupted non-string keys; `get_users()` results are instance-checked before use; a misplaced translators comment on an `_n()` call was fixed (WPCS error).
**Compatibility**
* WordPress: 7.0 - 7.2
* PHP: 8.3 - 8.6
**Tests**
* PHP Coding Standards: PHP_CodeSniffer 3.13.6 / WPCS 3.4.1 — 0 errors, 1 accepted advisory warning (urlencode mirrors WordPress core's wp_login_url())
* PHPStan: 2.3.5 level max (10), no baseline — 0 errors
* PHPCompatibility: 9.3.5, testVersion 8.3-8.6 — 0 issues
* PHPUnit: 9.6.38 — 110 tests, 220 assertions (PHP 8.6.0RC3 and PHP 8.3.36)
* Live smoke tests: WordPress 7.2-beta4 (single site) and WordPress 7.0 (multisite) on PHP 8.6.0RC3, MariaDB 11.8.9
= 1.6.8 = = 1.6.8 =
_Release date: 2026-09-21_ _Release date: 2026-09-21_

View file

@ -24,6 +24,18 @@ class Dashboard_Page {
*/ */
public const PAGE_SLUG = 'robotstxt-2fa-dashboard'; public const PAGE_SLUG = 'robotstxt-2fa-dashboard';
/**
* Brand SVG menu icon (shield with keyhole) as a base64 data URI.
*
* WordPress core renders base64-encoded SVG data URIs natively in admin
* menus (centered at 20px via the .wp-menu-image.svg CSS class), which
* keeps the icon crisp and independent of the Dashicons font while
* remaining fully backward compatible.
*
* @since 1.6.9
*/
public const MENU_ICON = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgdmlld0JveD0iMCAwIDIwIDIwIiByb2xlPSJpbWciIGFyaWEtaGlkZGVuPSJ0cnVlIiBmb2N1c2FibGU9ImZhbHNlIj48cGF0aCBmaWxsPSIjMDM4N2M5IiBkPSJNMTAgMSAxOCAzLjl2NS4zYzAgNS40LTMuMyA4LjYtOCA5LjgtNC43LTEuMi04LTQuNC04LTkuOFYzLjlaIi8+PGNpcmNsZSBjeD0iMTAiIGN5PSI4IiByPSIyLjIiIGZpbGw9IiNmZmVmZDQiLz48cGF0aCBmaWxsPSIjZmZlZmQ0IiBkPSJNOC44IDkuOSA3LjYgMTMuN2g0LjhMMTEuMiA5LjlaIi8+PC9zdmc+';
/** /**
* Failed attempts log. * Failed attempts log.
* *
@ -108,7 +120,7 @@ class Dashboard_Page {
'manage_options', 'manage_options',
self::PAGE_SLUG, self::PAGE_SLUG,
array( $this, 'render_page' ), array( $this, 'render_page' ),
'dashicons-shield' self::MENU_ICON
); );
add_submenu_page( add_submenu_page(

View file

@ -538,6 +538,11 @@ class Migration_Page {
* @return array<int, array{user: \WP_User, source: string}> * @return array<int, array{user: \WP_User, source: string}>
*/ */
private function get_candidates_from_wordfence(): array { private function get_candidates_from_wordfence(): array {
/**
* WordPress database abstraction. Typed for PHPStan level max.
*
* @var \wpdb $wpdb
*/
global $wpdb; global $wpdb;
$table = $wpdb->prefix . self::WORDFENCE_TABLE; $table = $wpdb->prefix . self::WORDFENCE_TABLE;
@ -550,21 +555,17 @@ class Migration_Page {
return array(); return array();
} }
// phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table names are trusted constants. // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name is a trusted prefix constant; the user ID is a validated integer.
$rows = $wpdb->get_results( $rows = $wpdb->get_results(
"SELECT s.user_id, s.secret FROM `{$table}` s", "SELECT s.user_id, s.secret FROM `{$table}` s",
ARRAY_A ARRAY_A
); );
// phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared // phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
if ( ! is_array( $rows ) ) {
return array();
}
$candidates = array(); $candidates = array();
foreach ( $rows as $row ) { foreach ( $rows as $row ) {
if ( ! is_array( $row ) || ! isset( $row['user_id'] ) || ! is_numeric( $row['user_id'] ) ) { if ( ! isset( $row['user_id'] ) || ! is_numeric( $row['user_id'] ) ) {
continue; continue;
} }
@ -716,14 +717,19 @@ class Migration_Page {
* @return string * @return string
*/ */
private function read_wordfence_secret( int $user_id ): string { private function read_wordfence_secret( int $user_id ): string {
/**
* WordPress database abstraction. Typed for PHPStan level max.
*
* @var \wpdb $wpdb
*/
global $wpdb; global $wpdb;
$table = $wpdb->prefix . self::WORDFENCE_TABLE; $table = $wpdb->prefix . self::WORDFENCE_TABLE;
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name is a trusted constant. // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name is a trusted prefix constant; the user ID is a validated integer.
$secret_binary = $wpdb->get_var( $wpdb->prepare( "SELECT `secret` FROM `{$table}` WHERE `user_id` = %d LIMIT 1", $user_id ) ); $secret_binary = $wpdb->get_var( "SELECT `secret` FROM `{$table}` WHERE `user_id` = {$user_id} LIMIT 1" );
if ( ! is_string( $secret_binary ) || '' === $secret_binary ) { if ( ! is_string( $secret_binary ) ) {
return ''; return '';
} }

View file

@ -431,8 +431,13 @@ class Settings_Page {
</thead> </thead>
<tbody> <tbody>
<?php foreach ( $roles as $role_key => $role_details ) : ?> <?php foreach ( $roles as $role_key => $role_details ) : ?>
<?php
$role_name = isset( $role_details['name'] ) && is_string( $role_details['name'] )
? $role_details['name']
: $role_key;
?>
<tr data-2fa-role="<?php echo esc_attr( $role_key ); ?>"> <tr data-2fa-role="<?php echo esc_attr( $role_key ); ?>">
<td><?php echo esc_html( translate_user_role( $role_details['name'] ) ); ?></td> <td><?php echo esc_html( translate_user_role( $role_name ) ); ?></td>
<?php foreach ( $methods as $method_key => $method_label ) : ?> <?php foreach ( $methods as $method_key => $method_label ) : ?>
<td style="text-align:center;"> <td style="text-align:center;">
<label> <label>
@ -441,7 +446,7 @@ class Settings_Page {
printf( printf(
/* translators: 1: role name, 2: method name. */ /* translators: 1: role name, 2: method name. */
esc_html__( '%1$s: require %2$s', 'robotstxt-2fa' ), esc_html__( '%1$s: require %2$s', 'robotstxt-2fa' ),
esc_html( translate_user_role( $role_details['name'] ) ), esc_html( translate_user_role( $role_name ) ),
esc_html( $method_label ) esc_html( $method_label )
); );
?> ?>
@ -802,7 +807,7 @@ class Settings_Page {
/** /**
* Resolve role_methods from stored options, migrating legacy force_roles + default_method if needed. * Resolve role_methods from stored options, migrating legacy force_roles + default_method if needed.
* *
* @param array<string, mixed> $options Raw stored options. * @param array<mixed> $options Raw stored options (untyped values from the options table).
* *
* @return array<string, array<int, string>> * @return array<string, array<int, string>>
*/ */
@ -1145,7 +1150,7 @@ class Settings_Page {
$capability, $capability,
self::PAGE_SLUG, self::PAGE_SLUG,
array( $this, 'render_page' ), array( $this, 'render_page' ),
'dashicons-shield' Dashboard_Page::MENU_ICON
); );
// Rename the first auto-created submenu entry to "Settings". // Rename the first auto-created submenu entry to "Settings".

View file

@ -338,9 +338,14 @@ class Users_List_Table extends \WP_List_Table {
<div class="alignleft actions"> <div class="alignleft actions">
<select name="role_filter"> <select name="role_filter">
<option value=""><?php esc_html_e( '— All roles —', 'robotstxt-2fa' ); ?></option> <option value=""><?php esc_html_e( '— All roles —', 'robotstxt-2fa' ); ?></option>
<?php foreach ( $roles as $role_key => $role_info ) : ?> <?php
foreach ( $roles as $role_key => $role_info ) :
$role_name = isset( $role_info['name'] ) && is_string( $role_info['name'] )
? $role_info['name']
: $role_key;
?>
<option value="<?php echo esc_attr( $role_key ); ?>" <?php selected( $current_role, $role_key ); ?>> <option value="<?php echo esc_attr( $role_key ); ?>" <?php selected( $current_role, $role_key ); ?>>
<?php echo esc_html( translate_user_role( $role_info['name'] ) ); ?> <?php echo esc_html( translate_user_role( $role_name ) ); ?>
</option> </option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>

View file

@ -405,6 +405,10 @@ Failed 2FA attempts (last 7 days): %4$d
$admins = get_users( array( 'capability' => 'manage_options' ) ); $admins = get_users( array( 'capability' => 'manage_options' ) );
foreach ( $admins as $admin ) { foreach ( $admins as $admin ) {
if ( ! $admin instanceof \WP_User ) {
continue;
}
$this->send_mail( $admin->user_email, $subject, $message ); $this->send_mail( $admin->user_email, $subject, $message );
} }
} }

View file

@ -299,14 +299,22 @@ class Login_Form_Manager {
return; return;
} }
/**
* Registered filters and actions. Values are WP_Hook objects, but a
* corrupted container from third-party code is tolerated, hence mixed.
*
* @var array<string, mixed>|null $wp_filter
*/
global $wp_filter; global $wp_filter;
if ( ! isset( $wp_filter['init'] ) || ! $wp_filter['init'] instanceof \WP_Hook ) { $init_hooks = $wp_filter['init'] ?? null;
if ( ! $init_hooks instanceof \WP_Hook ) {
return; return;
} }
foreach ( array_keys( $wp_filter['init']->callbacks ) as $priority ) { foreach ( array_keys( $init_hooks->callbacks ) as $priority ) {
if ( isset( $wp_filter['init']->callbacks[ $priority ]['altcha_interceptor'] ) ) { if ( isset( $init_hooks->callbacks[ $priority ]['altcha_interceptor'] ) ) {
remove_action( 'init', 'altcha_interceptor', (int) $priority ); remove_action( 'init', 'altcha_interceptor', (int) $priority );
return; return;

View file

@ -33,8 +33,11 @@ class Rest_Controller {
/** /**
* REST namespace. * REST namespace.
*
* Named REST_NAMESPACE instead of NAMESPACE: a class constant named
* "namespace" (case-insensitively) is deprecated in PHP 8.6.
*/ */
private const NAMESPACE = 'robotstxt-2fa/v1'; private const REST_NAMESPACE = 'robotstxt-2fa/v1';
/** /**
* Capability required to access any endpoint. * Capability required to access any endpoint.
@ -103,7 +106,7 @@ class Rest_Controller {
*/ */
public function register_routes(): void { public function register_routes(): void {
register_rest_route( register_rest_route(
self::NAMESPACE, self::REST_NAMESPACE,
'/settings', '/settings',
array( array(
array( array(
@ -120,7 +123,7 @@ class Rest_Controller {
); );
register_rest_route( register_rest_route(
self::NAMESPACE, self::REST_NAMESPACE,
'/users', '/users',
array( array(
'methods' => WP_REST_Server::READABLE, 'methods' => WP_REST_Server::READABLE,

View file

@ -182,9 +182,14 @@ class Frontend_Profile {
* @return void * @return void
*/ */
public function maybe_enqueue_assets(): void { public function maybe_enqueue_assets(): void {
/**
* Current post. Typed for PHPStan level max.
*
* @var \WP_Post|string|null $post
*/
global $post; global $post;
if ( ! is_a( $post, 'WP_Post' ) || ! has_shortcode( $post->post_content, 'robotstxt_2fa_profile' ) ) { if ( ! $post instanceof \WP_Post || ! has_shortcode( $post->post_content, 'robotstxt_2fa_profile' ) ) {
return; return;
} }

View file

@ -205,8 +205,8 @@ class Profile_Settings {
if ( $grace_days > 0 && $this->grace_period->is_active( $user, $grace_days ) ) { if ( $grace_days > 0 && $this->grace_period->is_active( $user, $grace_days ) ) {
$remaining = $this->grace_period->get_days_remaining( $user, $grace_days ); $remaining = $this->grace_period->get_days_remaining( $user, $grace_days );
/* translators: %d: number of days remaining to complete the setup. */
$grace_note = sprintf( $grace_note = sprintf(
/* translators: %d: number of days remaining to complete the setup. */
_n( _n(
'You have %d day left to complete the setup.', 'You have %d day left to complete the setup.',
'You have %d days left to complete the setup.', 'You have %d days left to complete the setup.',

View file

@ -251,7 +251,7 @@ class Trusted_Devices {
return false; return false;
} }
if ( ! defined( 'AUTH_SALT' ) || '' === AUTH_SALT ) { if ( ! defined( 'AUTH_SALT' ) || ! is_string( AUTH_SALT ) || '' === AUTH_SALT ) {
return false; return false;
} }
@ -283,7 +283,7 @@ class Trusted_Devices {
* @return void * @return void
*/ */
private function set_cookie( int $user_id, string $token, int $expires_at ): void { private function set_cookie( int $user_id, string $token, int $expires_at ): void {
if ( ! defined( 'AUTH_SALT' ) || '' === AUTH_SALT ) { if ( ! defined( 'AUTH_SALT' ) || ! is_string( AUTH_SALT ) || '' === AUTH_SALT ) {
return; return;
} }
@ -295,7 +295,7 @@ class Trusted_Devices {
$value, $value,
array( array(
'expires' => $expires_at, 'expires' => $expires_at,
'path' => defined( 'COOKIEPATH' ) ? COOKIEPATH : '/', 'path' => defined( 'COOKIEPATH' ) && is_string( COOKIEPATH ) ? COOKIEPATH : '/',
'domain' => defined( 'COOKIE_DOMAIN' ) ? COOKIE_DOMAIN : '', 'domain' => defined( 'COOKIE_DOMAIN' ) ? COOKIE_DOMAIN : '',
'secure' => is_ssl(), 'secure' => is_ssl(),
'httponly' => true, 'httponly' => true,
@ -315,7 +315,7 @@ class Trusted_Devices {
'', '',
array( array(
'expires' => time() - YEAR_IN_SECONDS, 'expires' => time() - YEAR_IN_SECONDS,
'path' => defined( 'COOKIEPATH' ) ? COOKIEPATH : '/', 'path' => defined( 'COOKIEPATH' ) && is_string( COOKIEPATH ) ? COOKIEPATH : '/',
'domain' => defined( 'COOKIE_DOMAIN' ) ? COOKIE_DOMAIN : '', 'domain' => defined( 'COOKIE_DOMAIN' ) ? COOKIE_DOMAIN : '',
'secure' => is_ssl(), 'secure' => is_ssl(),
'httponly' => true, 'httponly' => true,
@ -364,12 +364,20 @@ class Trusted_Devices {
/** /**
* Retrieve the raw device map from user meta. * Retrieve the raw device map from user meta.
* *
* Non-string keys (corrupted meta) are discarded so callers always
* receive a token-hash-keyed map.
*
* @param int $user_id User ID. * @param int $user_id User ID.
* *
* @return array<string, mixed> * @return array<string, mixed>
*/ */
private function get_raw_devices( int $user_id ): array { private function get_raw_devices( int $user_id ): array {
$raw = get_user_meta( $user_id, self::META_KEY, true ); $raw = get_user_meta( $user_id, self::META_KEY, true );
return is_array( $raw ) ? $raw : array();
if ( ! is_array( $raw ) ) {
return array();
}
return array_filter( $raw, 'is_string', ARRAY_FILTER_USE_KEY );
} }
} }

View file

@ -1,10 +1,10 @@
=== 2FA (by ROBOTSTXT) === === 2FA (by ROBOTSTXT) ===
Contributors: robotstxt, javiercasares Contributors: robotstxt, javiercasares
Tags: security, two-factor authentication, login, otp Tags: security, two-factor authentication, login, otp
Requires at least: 5.6 Requires at least: 7.0
Tested up to: 7.0 Tested up to: 7.2
Requires PHP: 8.0 Requires PHP: 8.3
Stable tag: 1.6.8 Stable tag: 1.6.9
License: GPLv3 or later License: GPLv3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html License URI: https://www.gnu.org/licenses/gpl-3.0.html
@ -53,12 +53,37 @@ Yes. Activate the plugin at the network level. Network administrators can set an
== Compatibility == == Compatibility ==
* WordPress: 5.6 – 7.0 * WordPress: 7.0 - 7.2
* PHP: 8.0 – 8.5 * PHP: 8.3 - 8.6
* MariaDB: 11.4 or newer * MariaDB: 11.4 or newer
== Changelog == == Changelog ==
= 1.6.9 =
_Release date: 2026-11-03_
**Changed**
* Compatibility floors raised to WordPress 7.0 and PHP 8.3, verified with full-range compatibility scans (WordPress 4.7-7.2, PHP 5.6-8.6). WordPress 7.2 and PHP 8.6 are now tested and documented.
* The admin menu icon is now a brand SVG (shield with keyhole) instead of the Dashicons shield. Rendered through WordPress' native SVG menu-icon support, it stays crisp on high-density screens, works identically on WordPress 7.0/7.1/7.2, and is future-proof against the ongoing move from Dashicons to SVG icons in the WordPress admin.
**Fixed**
* PHP 8.6 deprecation removed: a REST-controller class constant named `namespace` (case-insensitive) triggered a deprecation notice on PHP 8.6 and would become a fatal error on PHP 9.
**Compatibility**
* WordPress: 7.0 - 7.2
* PHP: 8.3 - 8.6
**Tests**
* PHP Coding Standards: PHP_CodeSniffer 3.13.6 / WPCS 3.4.1 — 0 errors
* PHPStan: level max (10), no baseline — 0 errors
* PHPCompatibility: 8.3-8.6 — 0 issues
* PHPUnit: 9.6.38 — 110 tests, 220 assertions
= 1.6.8 = = 1.6.8 =
_Release date: 2026-09-21_ _Release date: 2026-09-21_
@ -79,14 +104,6 @@ _Release date: 2026-09-17_
* The forced-setup wizard felt like a broken redirect loop: the wizard redirect bounced users to the profile with no explanation (it now carries a flag that renders a clear "activate at least one verification method, then save" warning), and saving with an expired form nonce silently did nothing (it now raises a visible "form session expired" error so users know to try again). * The forced-setup wizard felt like a broken redirect loop: the wizard redirect bounced users to the profile with no explanation (it now carries a flag that renders a clear "activate at least one verification method, then save" warning), and saving with an expired form nonce silently did nothing (it now raises a visible "form session expired" error so users know to try again).
= 1.6.6 =
_Release date: 2026-09-17_
**Added**
* Forced-enrollment warning on the profile 2FA section: when a user's role enforces 2FA but they have no verification method configured yet, the 2FA section of their profile (wp-admin and the frontend shortcode) opens with a warning notice asking them to activate at least one method. While a grace period is active, the notice appends the remaining days.
= Previous versions = = Previous versions =
For the full changelog see the [changelog](https://www.robotstxt.software/plugins/robotstxt-2fa/) page. For the full changelog see the [changelog](https://www.robotstxt.software/plugins/robotstxt-2fa/) page.

View file

@ -4,13 +4,13 @@
* Plugin URI: https://www.robotstxt.software/plugins/robotstxt-2fa/ * Plugin URI: https://www.robotstxt.software/plugins/robotstxt-2fa/
* Update URI: https://www.robotstxt.software/plugins/robotstxt-2fa/ * Update URI: https://www.robotstxt.software/plugins/robotstxt-2fa/
* Description: Adds two-factor authentication to the WordPress login flow. * Description: Adds two-factor authentication to the WordPress login flow.
* Version: 1.6.8 * Version: 1.6.9
* Author: ROBOTSTXT * Author: ROBOTSTXT
* Author URI: https://www.robotstxt.software/ * Author URI: https://www.robotstxt.software/
* Text Domain: robotstxt-2fa * Text Domain: robotstxt-2fa
* Domain Path: /languages * Domain Path: /languages
* Requires at least: 5.6 * Requires at least: 7.0
* Requires PHP: 8.0 * Requires PHP: 8.3
* Network: true * Network: true
* License: GPLv3 or later * License: GPLv3 or later
* License URI: https://www.gnu.org/licenses/gpl-3.0.html * License URI: https://www.gnu.org/licenses/gpl-3.0.html
@ -25,7 +25,7 @@ if ( ! defined( 'ABSPATH' ) ) {
} }
if ( ! defined( 'ROBOTSTXT_2FA_VERSION' ) ) { if ( ! defined( 'ROBOTSTXT_2FA_VERSION' ) ) {
define( 'ROBOTSTXT_2FA_VERSION', '1.6.8' ); define( 'ROBOTSTXT_2FA_VERSION', '1.6.9' );
} }
if ( ! defined( 'ROBOTSTXT_2FA_FILE' ) ) { if ( ! defined( 'ROBOTSTXT_2FA_FILE' ) ) {

View file

@ -62,6 +62,11 @@ if ( ! empty( $robotstxt_2fa_uploads['basedir'] ) ) {
} }
} }
/**
* WordPress database abstraction. Typed for PHPStan level max.
*
* @var \wpdb $wpdb
*/
global $wpdb; global $wpdb;
$robotstxt_2fa_meta_keys = array( $robotstxt_2fa_meta_keys = array(
@ -76,10 +81,5 @@ $robotstxt_2fa_meta_keys = array(
); );
foreach ( $robotstxt_2fa_meta_keys as $robotstxt_2fa_meta_key ) { foreach ( $robotstxt_2fa_meta_keys as $robotstxt_2fa_meta_key ) {
$wpdb->query( $wpdb->delete( $wpdb->usermeta, array( 'meta_key' => $robotstxt_2fa_meta_key ) );
$wpdb->prepare(
"DELETE FROM {$wpdb->usermeta} WHERE meta_key = %s",
$robotstxt_2fa_meta_key
)
);
} }

View file

@ -113,30 +113,31 @@
}, },
{ {
"name": "maxmind-db/reader", "name": "maxmind-db/reader",
"version": "v1.13.1", "version": "v1.14.0",
"version_normalized": "1.13.1.0", "version_normalized": "1.14.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/maxmind/MaxMind-DB-Reader-php.git", "url": "https://github.com/maxmind/MaxMind-DB-Reader-php.git",
"reference": "2194f58d0f024ce923e685cdf92af3daf9951908" "reference": "f3c92f68b3bec42a9aa780368399e03dc6b91e89"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/2194f58d0f024ce923e685cdf92af3daf9951908", "url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/f3c92f68b3bec42a9aa780368399e03dc6b91e89",
"reference": "2194f58d0f024ce923e685cdf92af3daf9951908", "reference": "f3c92f68b3bec42a9aa780368399e03dc6b91e89",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.2" "php": ">=7.2"
}, },
"conflict": { "conflict": {
"ext-maxminddb": "<1.11.1 || >=2.0.0" "ext-maxminddb": "<1.14.0 || >=2.0.0"
}, },
"require-dev": { "require-dev": {
"friendsofphp/php-cs-fixer": "3.*", "friendsofphp/php-cs-fixer": "3.*",
"phpstan/phpstan": "*", "phpstan/phpstan": "*",
"phpunit/phpunit": ">=8.0.0,<10.0.0", "phpunit/phpunit": ">=8.0.0,<10.0.0",
"squizlabs/php_codesniffer": "4.*" "squizlabs/php_codesniffer": "4.*",
"symfony/polyfill-php80": "^1.33"
}, },
"suggest": { "suggest": {
"ext-bcmath": "bcmath or gmp is required for decoding larger integers with the pure PHP decoder", "ext-bcmath": "bcmath or gmp is required for decoding larger integers with the pure PHP decoder",
@ -144,7 +145,7 @@
"ext-maxminddb": "A C-based database decoder that provides significantly faster lookups", "ext-maxminddb": "A C-based database decoder that provides significantly faster lookups",
"maxmind-db/reader-ext": "C extension for significantly faster IP lookups (install via PIE: pie install maxmind-db/reader-ext)" "maxmind-db/reader-ext": "C extension for significantly faster IP lookups (install via PIE: pie install maxmind-db/reader-ext)"
}, },
"time": "2025-11-21T22:24:26+00:00", "time": "2026-09-10T22:02:38+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@ -160,7 +161,7 @@
{ {
"name": "Gregory J. Oschwald", "name": "Gregory J. Oschwald",
"email": "goschwald@maxmind.com", "email": "goschwald@maxmind.com",
"homepage": "https://www.maxmind.com/" "homepage": "https://www.maxmind.com/en/home"
} }
], ],
"description": "MaxMind DB Reader API", "description": "MaxMind DB Reader API",
@ -174,7 +175,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/maxmind/MaxMind-DB-Reader-php/issues", "issues": "https://github.com/maxmind/MaxMind-DB-Reader-php/issues",
"source": "https://github.com/maxmind/MaxMind-DB-Reader-php/tree/v1.13.1" "source": "https://github.com/maxmind/MaxMind-DB-Reader-php/tree/v1.14.0"
}, },
"install-path": "../maxmind-db/reader" "install-path": "../maxmind-db/reader"
} }

View file

@ -3,7 +3,7 @@
'name' => 'robotstxt/robotstxt-2fa', 'name' => 'robotstxt/robotstxt-2fa',
'pretty_version' => 'dev-main', 'pretty_version' => 'dev-main',
'version' => 'dev-main', 'version' => 'dev-main',
'reference' => '70737383aa72a4fb75363c9d084ec3a7112f8d3b', 'reference' => '540212fa49599418676da0d91e03bac2acb6c60a',
'type' => 'wordpress-plugin', 'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
@ -29,9 +29,9 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'maxmind-db/reader' => array( 'maxmind-db/reader' => array(
'pretty_version' => 'v1.13.1', 'pretty_version' => 'v1.14.0',
'version' => '1.13.1.0', 'version' => '1.14.0.0',
'reference' => '2194f58d0f024ce923e685cdf92af3daf9951908', 'reference' => 'f3c92f68b3bec42a9aa780368399e03dc6b91e89',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../maxmind-db/reader', 'install_path' => __DIR__ . '/../maxmind-db/reader',
'aliases' => array(), 'aliases' => array(),
@ -40,7 +40,7 @@
'robotstxt/robotstxt-2fa' => array( 'robotstxt/robotstxt-2fa' => array(
'pretty_version' => 'dev-main', 'pretty_version' => 'dev-main',
'version' => 'dev-main', 'version' => 'dev-main',
'reference' => '70737383aa72a4fb75363c9d084ec3a7112f8d3b', 'reference' => '540212fa49599418676da0d91e03bac2acb6c60a',
'type' => 'wordpress-plugin', 'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),

View file

@ -1,6 +1,51 @@
CHANGELOG CHANGELOG
========= =========
1.14.0 (2026-09-10)
-------------------
* Bounded the resources that the pure PHP decoder spends on a single lookup. A
crafted database could nest data-section pointers to shared targets so that
decoding one record cost exponential time and memory, or point many times at
one large value so that the decoder copied far more data than the file holds.
The decoder now follows the Reader Resource Limits section of the MaxMind DB
specification. Each lookup is limited to 65,536 values, 512 levels of
nesting, and 2 MiB of string and bytes payload.
* Exceeding a limit throws an `InvalidDatabaseException`.
* Opening a database whose metadata exceeds a limit throws the same
exception.
* A scalar that declares more than 16 bytes, the width of the widest
fixed-width type, is rejected as invalid data.
* The bundled libmaxminddb used by `--with-maxminddb-bundled` builds of the
extension now applies the same decoder limits. The extension throws an
`InvalidDatabaseException` when a lookup exceeds them.
* The pure PHP reader is about 40% faster on City lookups. It no longer seeks
before a read that continues where the last one ended, and it checks read
lengths with `strlen()` instead of `ftell()`.
* The Windows build configuration now accepts either `libmaxminddb.lib` or
`maxminddb.lib` when building the extension. The `lib` prefix was removed
in libmaxminddb 1.6.0, but the libmaxminddb that PHP publishes for Windows
builds is still 1.5.0, which uses the prefixed name. Pull request by
Jean-Baptiste Nahan. GitHub #231.
* Replaced `XtOffsetOf()` with `offsetof()`. The `XtOffsetOf()` alias has
been removed in PHP 8.6. Pull request by Remi Collet. GitHub #252.
* The extension can now be built from a bundled copy of libmaxminddb, on
both Unix-like systems and Windows, by passing `--with-maxminddb-bundled`
to `configure` (or to `configure.bat` on Windows). This produces an
extension that does not depend on a system libmaxminddb, which is a
prerequisite for distributing precompiled builds; on Windows it also
replaces the 1.5.0 import library that PHP publishes for Windows builds.
The default is unchanged: without the flag, the extension links against a
system libmaxminddb as before. GitHub #265.
* The `conflict` constraint on `ext-maxminddb` in `composer.json` is again
updated when a release is cut. The substitution that maintains it stopped
matching in April 2024, when the constraint's separator changed from a comma
to `||`, so the constraint has read `<1.11.1` through four releases. Users of
the C extension should note the effect of reviving it: `ext-maxminddb` is a
Composer platform package, so this release conflicts with an older compiled
extension and `composer update` will require upgrading the two together.
GitHub #266.
1.13.1 (2025-11-21) 1.13.1 (2025-11-21)
------------------- -------------------

View file

@ -40,7 +40,7 @@ You should now have the file `composer.phar` in your project directory.
Run in your project root: Run in your project root:
``` ```
php composer.phar require maxmind-db/reader:^1.13.1 php composer.phar require maxmind-db/reader:^1.14.0
``` ```
You should now have the files `composer.json` and `composer.lock` as well as You should now have the files `composer.json` and `composer.lock` as well as
@ -75,7 +75,7 @@ $reader = new Reader('example.mmdb');
## Installation (RPM) ## Installation (RPM)
RPMs are available in the [official Fedora repository](https://apps.fedoraproject.org/packages/php-maxminddb). RPMs are available in the [official Fedora repository](https://packages.fedoraproject.org/pkgs/php-maxminddb/php-maxminddb/).
To install on Fedora, run: To install on Fedora, run:
@ -83,7 +83,7 @@ To install on Fedora, run:
dnf install php-maxminddb dnf install php-maxminddb
``` ```
To install on CentOS or RHEL 7, first [enable the EPEL repository](https://fedoraproject.org/wiki/EPEL) To install on CentOS or RHEL 7, first [enable the EPEL repository](https://docs.fedoraproject.org/en-US/epel/)
and then run: and then run:
```bash ```bash
@ -139,7 +139,7 @@ for prerequisites including libmaxminddb installation instructions.
First install [libmaxminddb](https://github.com/maxmind/libmaxminddb) as First install [libmaxminddb](https://github.com/maxmind/libmaxminddb) as
described in its [README.md described in its [README.md
file](https://github.com/maxmind/libmaxminddb/blob/main/README.md#installing-from-a-tarball). file](https://github.com/maxmind/libmaxminddb/blob/main/README.md#from-a-named-release-tarball).
After successfully installing libmaxmindb, you may install the extension After successfully installing libmaxmindb, you may install the extension
from [PECL](https://pecl.php.net/package/maxminddb): from [PECL](https://pecl.php.net/package/maxminddb):
@ -149,18 +149,39 @@ pecl install maxminddb
### Installing Extension from Source ### ### Installing Extension from Source ###
Alternatively, you may install it from the source. To do so, run the following Alternatively, you may install it from the source. This links against the
commands from the top-level directory of this distribution: libmaxminddb installed on your system, so install that first as described
above. Run the following commands from the top-level directory of this
distribution:
``` ```
cd ext cd ext
phpize phpize
./configure ./configure --with-maxminddb
make make
make test make test
sudo make install sudo make install
``` ```
#### Building without a system libmaxminddb ####
Passing `--with-maxminddb-bundled` compiles a bundled copy of libmaxminddb
into the extension instead, so the result depends on nothing but the C
runtime. This is what the precompiled builds use. The bundled sources are a
git submodule, so they have to be checked out first:
```
git submodule update --init
cd ext
phpize
./configure --with-maxminddb --with-maxminddb-bundled
make
make test
sudo make install
```
The same flag works on Windows, passed to `configure.bat`.
You then must load your extension. The recommended method is to add the You then must load your extension. The recommended method is to add the
following to your `php.ini` file: following to your `php.ini` file:
@ -189,7 +210,7 @@ breaking change.
Please report all issues with this code using the [GitHub issue tracker](https://github.com/maxmind/MaxMind-DB-Reader-php/issues). Please report all issues with this code using the [GitHub issue tracker](https://github.com/maxmind/MaxMind-DB-Reader-php/issues).
If you are having an issue with a MaxMind service that is not specific to the If you are having an issue with a MaxMind service that is not specific to the
client API, please see [our support page](https://www.maxmind.com/en/support). client API, please see [our support page](https://support.maxmind.com/knowledge-base).
## Requirements ## ## Requirements ##
@ -209,6 +230,6 @@ The MaxMind DB Reader PHP API uses [Semantic Versioning](https://semver.org/).
## Copyright and License ## ## Copyright and License ##
This software is Copyright (c) 2014-2025 by MaxMind, Inc. This software is Copyright (c) 2014-2026 by MaxMind, Inc.
This is free software, licensed under the Apache License, Version 2.0. This is free software, licensed under the Apache License, Version 2.0.

View file

@ -9,7 +9,7 @@
{ {
"name": "Gregory J. Oschwald", "name": "Gregory J. Oschwald",
"email": "goschwald@maxmind.com", "email": "goschwald@maxmind.com",
"homepage": "https://www.maxmind.com/" "homepage": "https://www.maxmind.com/en/home"
} }
], ],
"require": { "require": {
@ -22,13 +22,14 @@
"maxmind-db/reader-ext": "C extension for significantly faster IP lookups (install via PIE: pie install maxmind-db/reader-ext)" "maxmind-db/reader-ext": "C extension for significantly faster IP lookups (install via PIE: pie install maxmind-db/reader-ext)"
}, },
"conflict": { "conflict": {
"ext-maxminddb": "<1.11.1 || >=2.0.0" "ext-maxminddb": "<1.14.0 || >=2.0.0"
}, },
"require-dev": { "require-dev": {
"friendsofphp/php-cs-fixer": "3.*", "friendsofphp/php-cs-fixer": "3.*",
"phpunit/phpunit": ">=8.0.0,<10.0.0", "phpunit/phpunit": ">=8.0.0,<10.0.0",
"squizlabs/php_codesniffer": "4.*", "squizlabs/php_codesniffer": "4.*",
"phpstan/phpstan": "*" "phpstan/phpstan": "*",
"symfony/polyfill-php80": "^1.33"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {

View file

@ -0,0 +1,37 @@
#ifndef MAXMINDDB_CONFIG_H
#define MAXMINDDB_CONFIG_H
/* Supplies the header libmaxminddb's maxminddb.h includes unconditionally and
* that libmaxminddb's own build system would generate. We never run that
* build.
*
* This is the canonical account of the arrangement; ext/config.m4 and
* ext/config.w32 point here rather than repeating it.
*
* It is a tracked file rather than something the build systems write at
* configure time: generating it meant writing inside the submodule on Windows,
* which left it dirty after every build. Nothing includes anything from the
* submodule root, so that directory is deliberately off the include path.
*
* PACKAGE_VERSION lives here rather than on the command line. It has to reach
* libmaxminddb's sources, which is what MMDB_lib_version() returns, but our own
* ext/maxminddb.c also includes php.h -- and PHP only began stripping PACKAGE_*
* from its generated headers in 7.4, so a -D on the global CFLAGS redefines
* PHP's macro on 7.2 and 7.3. That is a warning today and a build failure under
* --enable-maxminddb-debug, which adds -Werror.
*
* The #ifndef makes this a no-op wherever PACKAGE_VERSION is already defined:
* ext/maxminddb.c includes php.h before maxminddb.h, so it keeps PHP's value
* and never sees a redefinition -- harmless, because it reads MMDB_lib_version()
* rather than the macro. config.w32 passes its own /D, read out of the
* submodule's configure.ac, which likewise wins over this default.
*
* Keep the version in step with the submodule. test-bundled.yml's "Load the
* extension on its own" step compares MMDB_LIB_VERSION against configure.ac on
* every build, so a stale value here fails CI rather than shipping.
*/
#ifndef PACKAGE_VERSION
#define PACKAGE_VERSION "1.14.0"
#endif
#endif /* MAXMINDDB_CONFIG_H */

Some files were not shown because too many files have changed in this diff Show more