Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b5d03b7f81 | |||
| b81db2d302 | |||
| 7379505d20 |
32 changed files with 1110 additions and 151 deletions
|
|
@ -1,5 +1,76 @@
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
|
||||||
|
= 1.6.11 =
|
||||||
|
|
||||||
|
_Release date: 2026-11-04_
|
||||||
|
|
||||||
|
**Fixed**
|
||||||
|
|
||||||
|
* The 2FA verification screen is no longer hijacked on membership sites that redirect the WordPress login away from wp-login.php (confirmed live on Restrict Content Pro 4.0.9 with "Hijack Login URL" enabled and the login at a custom account page such as /mi-cuenta/). RCP implements the hijack twice: through the login_url filter (already handled since 1.6.4) and — new finding — through a `login_form_login` redirect that bounces every default-action wp-login.php request to the membership page, dropping the 2FA query arguments. Stage requests now carry a dedicated `action=robotstxt-2fa-verify` (declared to WordPress via a registered `login_form_` hook, preserved on submission through a hidden field), so they run core's login branch without firing `login_form_login`, out of reach of that redirect pattern in any plugin. Verified end to end on the reported replica: password at the membership page → verification screen renders → valid code → user lands back on the membership page, logged in.
|
||||||
|
* Users logging in from front-end forms (membership/account pages) now return to the page they logged in from after completing 2FA instead of landing in wp-admin: when the request carries no core `redirect_to`, the challenge falls back to the raw HTTP referer, validated to be same-host and not an admin or login URL (foreign and admin referers are ignored).
|
||||||
|
|
||||||
|
**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 — 125 tests, 236 assertions (PHP 8.6.0RC3 and 8.3.36)
|
||||||
|
* Live end-to-end on the reported site replica (WordPress 7.1.4 + Restrict Content Pro 4.0.9): full login → 2FA → return-to-page cycle, MariaDB 11.8.9
|
||||||
|
|
||||||
|
= 1.6.10 =
|
||||||
|
|
||||||
|
_Release date: 2026-11-03_
|
||||||
|
|
||||||
|
**Fixed**
|
||||||
|
|
||||||
|
* The 2FA verification stage now stays on the login URL the visitor actually used. When wp-login.php executes through an alias or renamed slug (a `/login` rewrite, a "hidden login" setup that does not filter `site_url`), the post-password redirect previously always targeted the literal `/wp-login.php` — on sites where that URL is blocked or renamed away at server level, users were stranded on a 403/404 page right after a correct password. The stage base URL now preserves the executing login surface (path only; host and scheme still come from the site's canonical URL; traversal sequences rejected), while logins submitted from custom pages calling `wp_signon()` keep landing on the real wp-login.php as before (the 1.6.4 Restrict Content Pro guarantee). Full root-cause analysis in `docs/report-login-surface-urls.md`.
|
||||||
|
|
||||||
|
**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 — 119 tests, 229 assertions (PHP 8.6.0RC3 and 8.3.36)
|
||||||
|
* Live surface probes: WordPress 7.2-beta4 (single site) and WordPress 7.0 (multisite) on PHP 8.6.0RC3, MariaDB 11.8.9
|
||||||
|
|
||||||
|
= 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_
|
||||||
|
|
|
||||||
|
|
@ -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(
|
||||||
|
|
|
||||||
|
|
@ -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 '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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".
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
|
|
|
||||||
|
|
@ -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 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,26 @@ class Login_Form_Manager {
|
||||||
*/
|
*/
|
||||||
private const FIELD_STAGE_TOKEN = 'robotstxt_2fa_stage_token';
|
private const FIELD_STAGE_TOKEN = 'robotstxt_2fa_stage_token';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Core login action used for verification-stage requests.
|
||||||
|
*
|
||||||
|
* The wp-login.php script validates the `action` parameter against its
|
||||||
|
* known actions plus any with a registered `login_form_{action}` hook,
|
||||||
|
* and resets unknown ones to `login`. Membership plugins (Restrict
|
||||||
|
* Content Pro's "Hijack Login URL", and others with the same pattern) hook
|
||||||
|
* `login_form_login` to bounce the default login action to their own
|
||||||
|
* page — which would prevent the verification screen from ever rendering.
|
||||||
|
* A dedicated action keeps stage requests out of that hook while still
|
||||||
|
* running core's default login branch (form rendering + credential
|
||||||
|
* processing).
|
||||||
|
*/
|
||||||
|
private const STAGE_ACTION = 'robotstxt-2fa-verify';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query parameter carrying the core login action.
|
||||||
|
*/
|
||||||
|
private const QUERY_ACTION = 'action';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifier for the verification stage.
|
* Identifier for the verification stage.
|
||||||
*/
|
*/
|
||||||
|
|
@ -246,6 +266,25 @@ class Login_Form_Manager {
|
||||||
add_filter( 'authenticate', array( $this, 'maybe_complete_verification' ), 5, 3 );
|
add_filter( 'authenticate', array( $this, 'maybe_complete_verification' ), 5, 3 );
|
||||||
add_filter( 'authenticate', array( $this, 'enforce_verification_challenge' ), 30, 3 );
|
add_filter( 'authenticate', array( $this, 'enforce_verification_challenge' ), 30, 3 );
|
||||||
add_action( 'init', array( $this, 'maybe_remove_altcha_interceptor' ), 0 );
|
add_action( 'init', array( $this, 'maybe_remove_altcha_interceptor' ), 0 );
|
||||||
|
add_action( 'login_form_' . self::STAGE_ACTION, array( $this, 'stage_action_noop' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* No-op callback for the dedicated verification-stage login action.
|
||||||
|
*
|
||||||
|
* Core only accepts non-default `action` values that have a
|
||||||
|
* `login_form_{action}` hook registered; registering this callback
|
||||||
|
* declares the stage action so stage requests are not reset to the
|
||||||
|
* default `login` action — and therefore are not hijacked by
|
||||||
|
* third-party `login_form_login` redirects (membership plugins that
|
||||||
|
* move the login form to their own page).
|
||||||
|
*
|
||||||
|
* @since 1.6.11
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function stage_action_noop(): void {
|
||||||
|
// Intentionally empty; registration alone declares the action.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -259,14 +298,20 @@ class Login_Form_Manager {
|
||||||
* login_init hook when wp-login.php itself loads. This mirrors the URL
|
* login_init hook when wp-login.php itself loads. This mirrors the URL
|
||||||
* construction wp_login_url() performs before its filter runs.
|
* construction wp_login_url() performs before its filter runs.
|
||||||
*
|
*
|
||||||
|
* When wp-login.php executes through a different URL (a /login rewrite,
|
||||||
|
* a renamed "hidden login" slug), the stage keeps using that same URL so
|
||||||
|
* the verification screen stays reachable on sites that block the literal
|
||||||
|
* wp-login.php address. See get_stage_base_url().
|
||||||
|
*
|
||||||
* @since 1.6.4
|
* @since 1.6.4
|
||||||
|
* @since 1.6.10 Preserves the login surface currently in use when wp-login.php executes through an alias.
|
||||||
*
|
*
|
||||||
* @param string $redirect_to Optional redirect_to value to carry over.
|
* @param string $redirect_to Optional redirect_to value to carry over.
|
||||||
*
|
*
|
||||||
* @return string Absolute wp-login.php URL with optional redirect_to parameter.
|
* @return string Absolute login URL with optional redirect_to parameter.
|
||||||
*/
|
*/
|
||||||
public static function get_canonical_login_url( string $redirect_to = '' ): string {
|
public static function get_canonical_login_url( string $redirect_to = '' ): string {
|
||||||
$url = site_url( 'wp-login.php', 'login' );
|
$url = self::get_stage_base_url();
|
||||||
|
|
||||||
if ( '' !== $redirect_to ) {
|
if ( '' !== $redirect_to ) {
|
||||||
$url = add_query_arg( 'redirect_to', urlencode( $redirect_to ), $url );
|
$url = add_query_arg( 'redirect_to', urlencode( $redirect_to ), $url );
|
||||||
|
|
@ -275,6 +320,64 @@ class Login_Form_Manager {
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the base login URL the 2FA stage should navigate on.
|
||||||
|
*
|
||||||
|
* Priority order:
|
||||||
|
*
|
||||||
|
* 1. The URL the visitor actually used, when wp-login.php is the executing
|
||||||
|
* script but was reached through an alias or renamed slug (server
|
||||||
|
* rewrites such as /login, "hide login" plugins). Keeping the stage on
|
||||||
|
* the reachable surface avoids redirecting users to a blocked or
|
||||||
|
* rewritten-away wp-login.php URL after a correct password.
|
||||||
|
* 2. The canonical wp-login.php URL (site_url), which remains filterable
|
||||||
|
* by plugins that rewrite it, and which is always used when credentials
|
||||||
|
* were submitted from a custom page calling wp_signon() — the
|
||||||
|
* login_init hook does not fire there, and the verification form only
|
||||||
|
* renders on wp-login.php.
|
||||||
|
*
|
||||||
|
* The path from the current request is only trusted when wp-login.php is
|
||||||
|
* actually executing (login_init fired), traversal sequences are
|
||||||
|
* rejected, and only the path is reused — host and scheme always come
|
||||||
|
* from the site's own canonical URL.
|
||||||
|
*
|
||||||
|
* @since 1.6.10
|
||||||
|
*
|
||||||
|
* @return string Absolute login URL without any 2FA query arguments.
|
||||||
|
*/
|
||||||
|
private static function get_stage_base_url(): string {
|
||||||
|
$canonical = site_url( 'wp-login.php', 'login' );
|
||||||
|
|
||||||
|
if ( ! did_action( 'login_init' ) ) {
|
||||||
|
return $canonical;
|
||||||
|
}
|
||||||
|
|
||||||
|
$request_uri = isset( $_SERVER['REQUEST_URI'] ) && is_string( $_SERVER['REQUEST_URI'] )
|
||||||
|
? $_SERVER['REQUEST_URI']
|
||||||
|
: '';
|
||||||
|
|
||||||
|
$request_path = wp_parse_url( $request_uri, PHP_URL_PATH );
|
||||||
|
|
||||||
|
if ( ! is_string( $request_path ) ) {
|
||||||
|
return $canonical;
|
||||||
|
}
|
||||||
|
|
||||||
|
$request_path = rawurldecode( $request_path );
|
||||||
|
|
||||||
|
// Reject traversal attempts in both raw and percent-encoded form.
|
||||||
|
if ( str_contains( $request_path, '..' ) ) {
|
||||||
|
return $canonical;
|
||||||
|
}
|
||||||
|
|
||||||
|
$canonical_path = wp_parse_url( $canonical, PHP_URL_PATH );
|
||||||
|
|
||||||
|
if ( ! is_string( $canonical_path ) || '' === $canonical_path || $request_path === $canonical_path ) {
|
||||||
|
return $canonical;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_replace( $canonical_path, $request_path, $canonical );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable the ALTCHA Spam Protection login interceptor during the 2FA stage.
|
* Disable the ALTCHA Spam Protection login interceptor during the 2FA stage.
|
||||||
*
|
*
|
||||||
|
|
@ -299,14 +402,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;
|
||||||
|
|
@ -349,6 +460,10 @@ class Login_Form_Manager {
|
||||||
printf( '<input type="hidden" name="%1$s" value="%2$s" />', esc_attr( self::FIELD_STAGE_TOKEN ), esc_attr( $stage_token ) );
|
printf( '<input type="hidden" name="%1$s" value="%2$s" />', esc_attr( self::FIELD_STAGE_TOKEN ), esc_attr( $stage_token ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Keep the dedicated stage action on submission so third-party
|
||||||
|
// login_form_login redirects cannot bounce the verification POST.
|
||||||
|
printf( '<input type="hidden" name="%1$s" value="%2$s" />', esc_attr( self::QUERY_ACTION ), esc_attr( self::STAGE_ACTION ) );
|
||||||
|
|
||||||
wp_nonce_field( self::LOGIN_NONCE_ACTION, self::LOGIN_NONCE_FIELD );
|
wp_nonce_field( self::LOGIN_NONCE_ACTION, self::LOGIN_NONCE_FIELD );
|
||||||
?>
|
?>
|
||||||
<p class="robotstxt-2fa-login-field robotstxt-2fa-stage-field">
|
<p class="robotstxt-2fa-login-field robotstxt-2fa-stage-field">
|
||||||
|
|
@ -901,9 +1016,10 @@ class Login_Form_Manager {
|
||||||
$stage_token = wp_create_nonce( self::STAGE_TOKEN_ACTION . '|' . $user->ID );
|
$stage_token = wp_create_nonce( self::STAGE_TOKEN_ACTION . '|' . $user->ID );
|
||||||
|
|
||||||
$query_args = array(
|
$query_args = array(
|
||||||
self::QUERY_STAGE => self::STAGE_VERIFY,
|
self::QUERY_ACTION => self::STAGE_ACTION,
|
||||||
self::QUERY_METHOD => $method,
|
self::QUERY_STAGE => self::STAGE_VERIFY,
|
||||||
self::QUERY_PENDING => $this->issue_pending_token( $user->ID ),
|
self::QUERY_METHOD => $method,
|
||||||
|
self::QUERY_PENDING => $this->issue_pending_token( $user->ID ),
|
||||||
self::QUERY_STAGE_TOKEN => $stage_token,
|
self::QUERY_STAGE_TOKEN => $stage_token,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1535,16 +1651,53 @@ class Login_Form_Manager {
|
||||||
/**
|
/**
|
||||||
* Retrieve the sanitized redirect_to parameter from the current request.
|
* Retrieve the sanitized redirect_to parameter from the current request.
|
||||||
*
|
*
|
||||||
|
* Falls back to the referring front-end page when the request carries no
|
||||||
|
* core redirect_to value: membership and custom login pages rarely post
|
||||||
|
* one, and their own post-login redirects are bypassed by the challenge,
|
||||||
|
* so without this the user would land in wp-admin after verifying instead
|
||||||
|
* of returning to the page they logged in from. Only same-site, non-admin
|
||||||
|
* referers are honored.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @since 1.6.11 Added the same-site front-end referer fallback.
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function get_requested_redirect(): string {
|
private function get_requested_redirect(): string {
|
||||||
// phpcs:disable WordPress.Security.NonceVerification.Recommended -- redirect_to is a standard WP login parameter; value is passed through esc_url_raw.
|
// phpcs:disable WordPress.Security.NonceVerification.Recommended -- redirect_to is a standard WP login parameter; value is passed through esc_url_raw.
|
||||||
if ( ! isset( $_REQUEST['redirect_to'] ) || ! is_string( $_REQUEST['redirect_to'] ) ) {
|
if ( isset( $_REQUEST['redirect_to'] ) && is_string( $_REQUEST['redirect_to'] ) ) {
|
||||||
|
return esc_url_raw( wp_unslash( $_REQUEST['redirect_to'] ) );
|
||||||
|
}
|
||||||
|
// phpcs:enable WordPress.Security.NonceVerification.Recommended
|
||||||
|
|
||||||
|
// The raw referer is used (not wp_get_referer()): login forms posted
|
||||||
|
// from their own page are self-referrals, which wp_get_referer()
|
||||||
|
// discards, and the form page is precisely the return target needed.
|
||||||
|
$raw_referer = wp_get_raw_referer();
|
||||||
|
|
||||||
|
if ( ! is_string( $raw_referer ) || '' === $raw_referer ) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return esc_url_raw( wp_unslash( $_REQUEST['redirect_to'] ) );
|
// Same-host URLs only (wp_validate_redirect applies the allowed hosts list).
|
||||||
// phpcs:enable WordPress.Security.NonceVerification.Recommended
|
$validated = wp_validate_redirect( wp_unslash( $raw_referer ), '' );
|
||||||
|
|
||||||
|
if ( '' === $validated ) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$path = wp_parse_url( $validated, PHP_URL_PATH );
|
||||||
|
|
||||||
|
if ( ! is_string( $path ) || '' === $path ) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Never bounce back into admin or the login screen itself.
|
||||||
|
if ( '/wp-admin' === $path || str_starts_with( $path, '/wp-admin/' ) || '/wp-login.php' === $path || str_ends_with( $path, '/wp-login.php' ) ) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return esc_url_raw( $validated );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1559,6 +1712,7 @@ class Login_Form_Manager {
|
||||||
$login_url = self::get_canonical_login_url( $redirect_to );
|
$login_url = self::get_canonical_login_url( $redirect_to );
|
||||||
|
|
||||||
$args = array(
|
$args = array(
|
||||||
|
self::QUERY_ACTION => self::STAGE_ACTION,
|
||||||
self::QUERY_STAGE => self::STAGE_VERIFY,
|
self::QUERY_STAGE => self::STAGE_VERIFY,
|
||||||
self::QUERY_METHOD => $this->get_requested_method(),
|
self::QUERY_METHOD => $this->get_requested_method(),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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.',
|
||||||
|
|
|
||||||
|
|
@ -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 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
54
readme.txt
54
readme.txt
|
|
@ -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.11
|
||||||
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,39 +53,53 @@ 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.8 =
|
= 1.6.11 =
|
||||||
|
|
||||||
_Release date: 2026-09-21_
|
_Release date: 2026-11-04_
|
||||||
|
|
||||||
**Added**
|
|
||||||
|
|
||||||
* Administrator visibility when email delivery fails: failed verification-code deliveries record a marker and administrators see a persistent, self-clearing notice ("2FA: email delivery is failing…") in wp-admin and the network admin, since forced-email users cannot sign in while delivery is broken.
|
|
||||||
|
|
||||||
**Fixed**
|
**Fixed**
|
||||||
|
|
||||||
* "We could not determine which account you are trying to access" during verification: the pending-stage token was stored in a transient, which external object caches (Redis/Memcached) can evict at any time, killing live verification sessions. Tokens now live in a persistent option map and the error message asks the user to sign in again.
|
* The 2FA verification screen is no longer hijacked on membership sites that redirect the WordPress login away from wp-login.php (Restrict Content Pro's "Hijack Login URL" and any plugin using the same `login_form_login` redirect pattern). Stage requests now carry a dedicated login action that such redirects cannot intercept, verified end to end on the reported replica: password at the membership page → verification screen → valid code → back on the membership page, logged in.
|
||||||
|
* Users logging in from front-end forms now return to the page they logged in from after completing 2FA instead of landing in wp-admin.
|
||||||
|
|
||||||
= 1.6.7 =
|
= 1.6.10 =
|
||||||
|
|
||||||
_Release date: 2026-09-17_
|
_Release date: 2026-11-03_
|
||||||
|
|
||||||
**Fixed**
|
**Fixed**
|
||||||
|
|
||||||
* 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 2FA verification stage now stays on the login URL the visitor actually used. When wp-login.php executes through an alias or renamed slug (a `/login` rewrite, a "hidden login" setup that does not filter `site_url`), the post-password redirect previously always targeted the literal `/wp-login.php` — on sites where that URL is blocked or renamed away at server level, users were stranded on a 403/404 page right after a correct password. Logins submitted from custom pages keep landing on the real wp-login.php as before.
|
||||||
|
|
||||||
= 1.6.6 =
|
= 1.6.9 =
|
||||||
|
|
||||||
_Release date: 2026-09-17_
|
_Release date: 2026-11-03_
|
||||||
|
|
||||||
**Added**
|
**Changed**
|
||||||
|
|
||||||
* 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.
|
* 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
|
||||||
|
|
||||||
= Previous versions =
|
= Previous versions =
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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.11
|
||||||
* 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.11' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! defined( 'ROBOTSTXT_2FA_FILE' ) ) {
|
if ( ! defined( 'ROBOTSTXT_2FA_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
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
21
vendor/composer/installed.json
vendored
21
vendor/composer/installed.json
vendored
|
|
@ -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"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
vendor/composer/installed.php
vendored
10
vendor/composer/installed.php
vendored
|
|
@ -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' => '6a33c6b7caaa03be52487856f8c82810992ac0f1',
|
||||||
'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' => '6a33c6b7caaa03be52487856f8c82810992ac0f1',
|
||||||
'type' => 'wordpress-plugin',
|
'type' => 'wordpress-plugin',
|
||||||
'install_path' => __DIR__ . '/../../',
|
'install_path' => __DIR__ . '/../../',
|
||||||
'aliases' => array(),
|
'aliases' => array(),
|
||||||
|
|
|
||||||
45
vendor/maxmind-db/reader/CHANGELOG.md
vendored
45
vendor/maxmind-db/reader/CHANGELOG.md
vendored
|
|
@ -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)
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
|
|
||||||
39
vendor/maxmind-db/reader/README.md
vendored
39
vendor/maxmind-db/reader/README.md
vendored
|
|
@ -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.
|
||||||
|
|
|
||||||
7
vendor/maxmind-db/reader/composer.json
vendored
7
vendor/maxmind-db/reader/composer.json
vendored
|
|
@ -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": {
|
||||||
|
|
|
||||||
37
vendor/maxmind-db/reader/ext/bundled-include/maxminddb_config.h
vendored
Normal file
37
vendor/maxmind-db/reader/ext/bundled-include/maxminddb_config.h
vendored
Normal 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
Loading…
Reference in a new issue