Skip to content

Fix middle login#363

Open
superdav42 wants to merge 3 commits intomainfrom
fix-middle-login
Open

Fix middle login#363
superdav42 wants to merge 3 commits intomainfrom
fix-middle-login

Conversation

@superdav42
Copy link
Collaborator

@superdav42 superdav42 commented Mar 9, 2026

Summary by CodeRabbit

  • New Features

    • Added captcha token support to checkout login flow for enhanced security
    • Page now automatically reloads after successful inline login during checkout
  • Bug Fixes

    • Improved form filtering logic to handle empty values correctly
  • Documentation

    • Added Cloudflare troubleshooting guide for resolving screenshot generation issues
  • Style

    • Improved checkout form and dashboard layout responsiveness
  • Chores

    • Updated dependencies

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 9, 2026

📝 Walkthrough

Walkthrough

The PR adds Cloudflare troubleshooting documentation for thum.io screenshot issues, integrates captcha token collection into checkout login flows, removes the symfony/cache dependency in favor of WordPress-native transient caching in SSO, improves filter handling to preserve false values, adds pre-authentication plugin hooks for inline login, and applies responsive layout styling improvements.

Changes

Cohort / File(s) Summary
Documentation & Configuration
README.md, readme.txt, composer.json
Added Cloudflare WAF troubleshooting guides for thum.io screenshot bot access; removed symfony/cache dependency.
CSS Styling
assets/css/legacy-signup.css, assets/css/legacy-signup.min.css
Added max-width: 100% and overflow: hidden rules to #wu-sites > div for improved layout constraints and responsive behavior.
Checkout Login Enhancement
assets/js/checkout.js
Integrated captcha token collection (g-recaptcha-response, h-captcha-response, cap-token) into inline login handlers; updated success flow to reload page upon authentication.
SSO Cache Implementation
inc/sso/class-sso.php
Replaced Symfony filesystem-based PSR-16 cache with WordPress-native transient-backed simple cache (WordPress_Simple_Cache).
Authentication & Data Filtering
inc/checkout/class-checkout.php, inc/apis/trait-mcp-abilities.php
Added pre-authentication plugin hook (wu_before_inline_login) to allow blocking login before wp_authenticate(); improved filter cleanup to preserve false values while removing empty strings.
Templates & Utilities
inc/helpers/class-hash.php, views/checkout/partials/inline-login-prompt.php, views/dashboard-widgets/thank-you.php
Refactored hash decode loop; added wu_inline_login_prompt_before_submit action hook for captcha widget injection; enhanced responsive layout with utility classes (wu-w-full, wu-min-w-0).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐰 From Symfony's cache we've tunneled away,
To WordPress transients here to stay!
Captcha tokens gathered in checkout's light,
Cloudflare's gate guides shown just right—
False values kept, filters refined so clear,
Our warren grows stronger this year! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The PR title 'Fix middle login' is vague and does not clearly convey what 'middle login' refers to or what the actual changes accomplish. The changeset includes fixes across multiple areas (Cloudflare troubleshooting, checkout flow, SSO caching, form layout), but the title provides no meaningful insight into the primary change. Provide a more descriptive title that clearly identifies the main objective, such as 'Add captcha support to inline checkout login' or a title that better reflects the primary focus of this multi-file change.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-middle-login

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

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Mar 9, 2026

🔨 Build Complete - Ready for Testing!

📦 Download Build Artifact (Recommended)

Download the zip build, upload to WordPress and test:

🌐 Test in WordPress Playground (Very Experimental)

Click the link below to instantly test this PR in your browser - no installation needed!
Playground support for multisite is very limitied, hopefully it will get better in the future.

🚀 Launch in Playground

Login credentials: admin / password

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
inc/helpers/class-hash.php (1)

91-100: ⚠️ Potential issue | 🟡 Minor

Avoid strlen() inside loop condition and use Yoda conditions.

Static analysis correctly identifies two issues:

  1. Line 93: Calling strlen($hash) in the loop condition recalculates the length on each iteration. While PHP may optimize this for strings, it violates the coding standard and reduces clarity.
  2. Line 96: Should use Yoda condition: false === $pos.
🔧 Proposed fix
 		$number = 0;
+		$hash_length = strlen($hash);

-		for ($i = 0; $i < strlen($hash); $i++) {
+		for ($i = 0; $i < $hash_length; $i++) {
 			$pos = strpos($alphabet, $hash[ $i ]);

-			if ($pos === false) {
+			if (false === $pos) {
 				return false;
 			}

 			$number = $number * $base + $pos;
 		}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@inc/helpers/class-hash.php` around lines 91 - 100, Precompute the string
length and use a Yoda-style strict comparison: before the for loop that iterates
over $hash (the loop using $i and $base/$number), assign $len = strlen($hash)
and change the loop header to iterate up to $len, and replace the conditional if
($pos === false) with the Yoda form if (false === $pos) so the length isn't
recalculated each iteration and the comparison follows the coding standard.
views/dashboard-widgets/thank-you.php (1)

249-266: ⚠️ Potential issue | 🟡 Minor

Fix indentation to match expected nesting levels.

Static analysis correctly identifies that lines within the foreach block are under-indented. The foreach statement at Line 249 should have 4 tabs (not 3), and the nested content should be indented accordingly.

The layout class additions (wu-w-full, wu-min-w-0) are good improvements for preventing flex item overflow.

🔧 Proposed indentation fix
-			<?php foreach ($membership->get_sites() as $site) : ?>
+				<?php foreach ($membership->get_sites() as $site) : ?>

-			<div class="wu-bg-gray-100 wu-p-4 wu-rounded wu-mb-2 sm:wu-flex wu-items-center wu-w-full">
+					<div class="wu-bg-gray-100 wu-p-4 wu-rounded wu-mb-2 sm:wu-flex wu-items-center wu-w-full">

(Apply similar indentation fixes to the rest of the foreach block content)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@views/dashboard-widgets/thank-you.php` around lines 249 - 266, Adjust
indentation inside the foreach loop that iterates over $membership->get_sites():
the "<?php foreach ($membership->get_sites() as $site) : ?>" line should be
indented one additional level, and all nested lines (the div wrapper, img tag
using $site->get_featured_image('thumbnail'), and the h5 with <?php echo
esc_html(ucfirst($site->get_title())); ?>) should be shifted to match the
expected nesting so each child is consistently indented under the foreach block;
apply the same indentation pattern for the rest of the foreach block content to
maintain consistent structure.
🧹 Nitpick comments (2)
assets/js/checkout.js (2)

1071-1098: Consider extracting captcha token collection to a reusable helper.

This captcha token collection logic is duplicated from lines 912-932. Extracting it into a helper function would improve maintainability:

♻️ Optional refactor to reduce duplication

Add a helper method to the Vue instance:

getCaptchaTokens() {
    const tokens = {};
    
    const recaptcha = jQuery('input[name="g-recaptcha-response"]').filter(function() {
        return this.value;
    }).first().val();
    
    const hcaptcha = jQuery('input[name="h-captcha-response"]').filter(function() {
        return this.value;
    }).first().val();
    
    const cap = jQuery('input[name="cap-token"]').filter(function() {
        return this.value;
    }).first().val();
    
    if (recaptcha) tokens['g-recaptcha-response'] = recaptcha;
    if (hcaptcha) tokens['h-captcha-response'] = hcaptcha;
    if (cap) tokens['cap-token'] = cap;
    
    return tokens;
},

Then use it in both locations:

const login_data = {
    username_or_email,
    password: this.inline_login_password,
    _wpnonce: jQuery('[name="_wpnonce"]').val(),
    ...this.getCaptchaTokens()
};
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@assets/js/checkout.js` around lines 1071 - 1098, The captcha token collection
is duplicated; extract it into a reusable helper (e.g., getCaptchaTokens) on the
Vue instance and replace the duplicated blocks (including the construction of
inline_login_data and the earlier block at the other occurrence) by spreading
the helper's return into the data object; implement getCaptchaTokens to read the
three inputs ('g-recaptcha-response', 'h-captcha-response', 'cap-token'), return
an object with only the present tokens, and update places that currently build
inline_login_data (and the block around lines 912-932) to include
...this.getCaptchaTokens().

905-934: Captcha tokens are collected but the server-side handler doesn't pass them to the pre-auth filter.

The captcha tokens (g-recaptcha-response, h-captcha-response, cap-token) are correctly collected and sent to the server. However, examining inc/checkout/class-checkout.php (lines 1777-1788), the wu_before_inline_login filter only receives $username as context — the captcha tokens from the request are not passed to filter callbacks.

Plugins hooking into wu_before_inline_login will need to retrieve captcha tokens directly via wu_request('g-recaptcha-response') or similar, which works but is less explicit than passing them as filter arguments.

Consider updating the filter signature to include the request data:

-$pre_auth = apply_filters('wu_before_inline_login', null, $username);
+$pre_auth = apply_filters('wu_before_inline_login', null, $username, [
+    'g-recaptcha-response' => sanitize_text_field(wu_request('g-recaptcha-response')),
+    'h-captcha-response'   => sanitize_text_field(wu_request('h-captcha-response')),
+    'cap-token'            => sanitize_text_field(wu_request('cap-token')),
+]);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@assets/js/checkout.js` around lines 905 - 934, The filter call for
wu_before_inline_login only passes $username and should be extended to include
the incoming request data (or at minimum the captcha tokens) so hooked plugins
can access them; update the apply_filters('wu_before_inline_login', $username)
invocation in the checkout handler (inc/checkout/class-checkout.php) to pass a
second argument such as $request_data or an array of tokens (e.g.,
['g-recaptcha-response'=>..., 'h-captcha-response'=>..., 'cap-token'=>...]),
update the filter docblock to document the new parameter, and ensure backward
compatibility by keeping $username as the first arg (so existing callbacks still
receive it) and by noting that add_filter callbacks must accept the extra arg
(or use func_get_args where necessary).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@inc/apis/trait-mcp-abilities.php`:
- Around line 751-764: The foreach block that cleans up default/empty filter
values should be updated to follow WP coding standards: use spaced array keys
and Yoda comparisons. In the loop that iterates $filter_columns from
$this->get_model_filter_columns(), change any $args[$column] usages to $args[
$column ] and replace the condition checking false with a Yoda condition (false
!== $args[ $column ]). Likewise update the search check to use spaced key $args[
'search' ] and a Yoda comparison ('' === $args[ 'search' ]) in the if that
unsets search. Ensure the logic still preserves false boolean values.

In `@inc/checkout/class-checkout.php`:
- Around line 1790-1798: The pre-auth error path sends the WP_Error message
directly; update the wp_send_json_error call in the pre-auth block (where
$pre_auth is checked, and set_transient is called) to sanitize the message
before returning it — replace the raw $pre_auth->get_error_message() with a
sanitized value using wp_strip_all_tags($pre_auth->get_error_message()) so it
matches the regular authentication failure handling.

In `@inc/sso/class-sso.php`:
- Around line 917-920: The instantiation of WordPress_Simple_Cache in
class-sso.php will fail because that class is missing; fix by adding a new class
named WordPress_Simple_Cache in the inc/sso/ namespace that implements
Psr\SimpleCache\CacheInterface (implement all required methods: get, set,
delete, clear, getMultiple, setMultiple, deleteMultiple, has) using WP
transients with the provided prefix, or alternatively replace the new
WordPress_Simple_Cache('wu_sso_') call to use an existing cache helper (e.g.,
Cache_Manager or your transient wrapper) or add and import a composer package
that provides WordPress_Simple_Cache—ensure $this->cache receives a PSR-16
compatible object.

---

Outside diff comments:
In `@inc/helpers/class-hash.php`:
- Around line 91-100: Precompute the string length and use a Yoda-style strict
comparison: before the for loop that iterates over $hash (the loop using $i and
$base/$number), assign $len = strlen($hash) and change the loop header to
iterate up to $len, and replace the conditional if ($pos === false) with the
Yoda form if (false === $pos) so the length isn't recalculated each iteration
and the comparison follows the coding standard.

In `@views/dashboard-widgets/thank-you.php`:
- Around line 249-266: Adjust indentation inside the foreach loop that iterates
over $membership->get_sites(): the "<?php foreach ($membership->get_sites() as
$site) : ?>" line should be indented one additional level, and all nested lines
(the div wrapper, img tag using $site->get_featured_image('thumbnail'), and the
h5 with <?php echo esc_html(ucfirst($site->get_title())); ?>) should be shifted
to match the expected nesting so each child is consistently indented under the
foreach block; apply the same indentation pattern for the rest of the foreach
block content to maintain consistent structure.

---

Nitpick comments:
In `@assets/js/checkout.js`:
- Around line 1071-1098: The captcha token collection is duplicated; extract it
into a reusable helper (e.g., getCaptchaTokens) on the Vue instance and replace
the duplicated blocks (including the construction of inline_login_data and the
earlier block at the other occurrence) by spreading the helper's return into the
data object; implement getCaptchaTokens to read the three inputs
('g-recaptcha-response', 'h-captcha-response', 'cap-token'), return an object
with only the present tokens, and update places that currently build
inline_login_data (and the block around lines 912-932) to include
...this.getCaptchaTokens().
- Around line 905-934: The filter call for wu_before_inline_login only passes
$username and should be extended to include the incoming request data (or at
minimum the captcha tokens) so hooked plugins can access them; update the
apply_filters('wu_before_inline_login', $username) invocation in the checkout
handler (inc/checkout/class-checkout.php) to pass a second argument such as
$request_data or an array of tokens (e.g., ['g-recaptcha-response'=>...,
'h-captcha-response'=>..., 'cap-token'=>...]), update the filter docblock to
document the new parameter, and ensure backward compatibility by keeping
$username as the first arg (so existing callbacks still receive it) and by
noting that add_filter callbacks must accept the extra arg (or use func_get_args
where necessary).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 62ed09a2-0e90-4197-8572-13ad803eb001

📥 Commits

Reviewing files that changed from the base of the PR and between 18c9c97 and 43d21ff.

⛔ Files ignored due to path filters (1)
  • composer.lock is excluded by !**/*.lock
📒 Files selected for processing (13)
  • README.md
  • assets/css/legacy-signup.css
  • assets/css/legacy-signup.min.css
  • assets/js/checkout.js
  • composer.json
  • inc/apis/trait-mcp-abilities.php
  • inc/checkout/class-checkout.php
  • inc/helpers/class-hash.php
  • inc/sso/class-sso.php
  • lang/ultimate-multisite.pot
  • readme.txt
  • views/checkout/partials/inline-login-prompt.php
  • views/dashboard-widgets/thank-you.php
💤 Files with no reviewable changes (1)
  • composer.json

Comment on lines +751 to +764
// Remove empty filter values that AI models send as defaults
// (e.g., blog_id: 0, domain: "") which would create invalid WHERE clauses.
$filter_columns = array_keys($this->get_model_filter_columns());

foreach ($filter_columns as $column) {
if (isset($args[$column]) && empty($args[$column]) && $args[$column] !== false) {
unset($args[$column]);
}
);
}

// Also strip empty search strings.
if (isset($args['search']) && $args['search'] === '') {
unset($args['search']);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix coding style violations flagged by static analysis.

The logic correctly preserves false values for boolean filters, but there are WordPress coding standard violations:

  1. Array keys with variables must be surrounded by spaces: $args[ $column ]
  2. Use Yoda conditions: false !== $args[ $column ] and '' === $args['search']
🔧 Proposed fix for coding style
-		foreach ($filter_columns as $column) {
-			if (isset($args[$column]) && empty($args[$column]) && $args[$column] !== false) {
-				unset($args[$column]);
+		foreach ($filter_columns as $column) {
+			if (isset($args[ $column ]) && empty($args[ $column ]) && false !== $args[ $column ]) {
+				unset($args[ $column ]);
 			}
 		}

 		// Also strip empty search strings.
-		if (isset($args['search']) && $args['search'] === '') {
+		if (isset($args['search']) && '' === $args['search']) {
 			unset($args['search']);
 		}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Remove empty filter values that AI models send as defaults
// (e.g., blog_id: 0, domain: "") which would create invalid WHERE clauses.
$filter_columns = array_keys($this->get_model_filter_columns());
foreach ($filter_columns as $column) {
if (isset($args[$column]) && empty($args[$column]) && $args[$column] !== false) {
unset($args[$column]);
}
);
}
// Also strip empty search strings.
if (isset($args['search']) && $args['search'] === '') {
unset($args['search']);
}
// Remove empty filter values that AI models send as defaults
// (e.g., blog_id: 0, domain: "") which would create invalid WHERE clauses.
$filter_columns = array_keys($this->get_model_filter_columns());
foreach ($filter_columns as $column) {
if (isset($args[ $column ]) && empty($args[ $column ]) && false !== $args[ $column ]) {
unset($args[ $column ]);
}
}
// Also strip empty search strings.
if (isset($args['search']) && '' === $args['search']) {
unset($args['search']);
}
🧰 Tools
🪛 GitHub Check: Code Quality Checks

[failure] 757-757:
Array keys must be surrounded by spaces unless they contain a string or an integer.


[failure] 756-756:
Use Yoda Condition checks, you must.


[failure] 756-756:
Array keys must be surrounded by spaces unless they contain a string or an integer.


[failure] 756-756:
Array keys must be surrounded by spaces unless they contain a string or an integer.


[failure] 756-756:
Array keys must be surrounded by spaces unless they contain a string or an integer.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@inc/apis/trait-mcp-abilities.php` around lines 751 - 764, The foreach block
that cleans up default/empty filter values should be updated to follow WP coding
standards: use spaced array keys and Yoda comparisons. In the loop that iterates
$filter_columns from $this->get_model_filter_columns(), change any
$args[$column] usages to $args[ $column ] and replace the condition checking
false with a Yoda condition (false !== $args[ $column ]). Likewise update the
search check to use spaced key $args[ 'search' ] and a Yoda comparison ('' ===
$args[ 'search' ]) in the if that unsets search. Ensure the logic still
preserves false boolean values.

Comment on lines +1790 to +1798
if (is_wp_error($pre_auth)) {
set_transient($transient_key, ($attempt_count ? $attempt_count + 1 : 1), 5 * MINUTE_IN_SECONDS);

wp_send_json_error(
[
'message' => $pre_auth->get_error_message(),
]
);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Pre-auth error messages are not sanitized, unlike regular auth failures.

The regular authentication failure path (lines 1808-1816) sanitizes the error message with wp_strip_all_tags() before sending it in the JSON response. However, the pre-auth error path sends the WP_Error message directly without sanitization.

For consistency and defense-in-depth against plugins that might include HTML in their error messages:

🛡️ Proposed fix for consistent error sanitization
 if (is_wp_error($pre_auth)) {
     set_transient($transient_key, ($attempt_count ? $attempt_count + 1 : 1), 5 * MINUTE_IN_SECONDS);

+    $error_message = wp_strip_all_tags($pre_auth->get_error_message());
+
+    if (empty($error_message)) {
+        $error_message = __('Login blocked. Please try again.', 'ultimate-multisite');
+    }
+
     wp_send_json_error(
         [
-            'message' => $pre_auth->get_error_message(),
+            'message' => $error_message,
         ]
     );
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (is_wp_error($pre_auth)) {
set_transient($transient_key, ($attempt_count ? $attempt_count + 1 : 1), 5 * MINUTE_IN_SECONDS);
wp_send_json_error(
[
'message' => $pre_auth->get_error_message(),
]
);
}
if (is_wp_error($pre_auth)) {
set_transient($transient_key, ($attempt_count ? $attempt_count + 1 : 1), 5 * MINUTE_IN_SECONDS);
$error_message = wp_strip_all_tags($pre_auth->get_error_message());
if (empty($error_message)) {
$error_message = __('Login blocked. Please try again.', 'ultimate-multisite');
}
wp_send_json_error(
[
'message' => $error_message,
]
);
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@inc/checkout/class-checkout.php` around lines 1790 - 1798, The pre-auth error
path sends the WP_Error message directly; update the wp_send_json_error call in
the pre-auth block (where $pre_auth is checked, and set_transient is called) to
sanitize the message before returning it — replace the raw
$pre_auth->get_error_message() with a sanitized value using
wp_strip_all_tags($pre_auth->get_error_message()) so it matches the regular
authentication failure handling.

Comment on lines 917 to 920
if (null === $this->cache) {
// the PSR-6 cache object that you want to use
$psr6_cache = new FilesystemAdapter();

$this->cache = new Psr16Cache($psr6_cache);
// Use WordPress transients-based PSR-16 cache implementation
$this->cache = new WordPress_Simple_Cache('wu_sso_');
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Verify WordPress_Simple_Cache class exists and implements PSR-16

# Find the WordPress_Simple_Cache class definition
echo "=== Searching for WordPress_Simple_Cache class ==="
ast-grep --pattern $'class WordPress_Simple_Cache $$$'

# Check if it implements CacheInterface
echo -e "\n=== Checking PSR-16 implementation ==="
rg -n "class WordPress_Simple_Cache" -A 5

# Check namespace/use statements in SSO class
echo -e "\n=== Checking imports in class-sso.php ==="
rg -n "use.*WordPress_Simple_Cache\|namespace.*SSO" inc/sso/class-sso.php | head -20

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 214


🏁 Script executed:

# Read the actual file at the specified lines
echo "=== Reading inc/sso/class-sso.php at lines 917-920 ==="
sed -n '915,925p' inc/sso/class-sso.php

# Search for any cache-related class definitions
echo -e "\n=== Searching for any cache-related classes ==="
rg -n "^class.*[Cc]ache" --type php

# Check if class might be in a different location
echo -e "\n=== Searching for WordPress_Simple_Cache anywhere ==="
rg "WordPress_Simple_Cache" --type php

# Check composer.json and lock file for dependencies
echo -e "\n=== Checking composer.json for cache dependencies ==="
cat composer.json | grep -A 5 -B 5 "cache\|psr"

# Look for use statements that might import this
echo -e "\n=== Checking use statements in class-sso.php ==="
head -50 inc/sso/class-sso.php | rg "^use|^namespace"

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 3578


🏁 Script executed:

# Check Cache_Manager class implementation
echo "=== Checking Cache_Manager class ==="
head -100 inc/managers/class-cache-manager.php

# Search for PSR-16 CacheInterface implementations
echo -e "\n=== Searching for CacheInterface or PSR-16 implementations ==="
rg -n "implements.*CacheInterface\|Psr.*Cache" --type php

# Check git history to see what was replaced
echo -e "\n=== Checking git diff for cache-related changes ==="
git diff HEAD~1 inc/sso/class-sso.php | head -50

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 2375


🏁 Script executed:

# Check if there are any stub/interface files for WordPress_Simple_Cache
echo "=== Searching for any cache interface files ==="
fd -t f "cache" --extension php inc/

# Look for any autoload configuration that might load this class
echo -e "\n=== Checking autoload in composer.json ==="
rg -A 20 '"autoload"' composer.json | head -40

# Check if there's a WordPress transient wrapper elsewhere
echo -e "\n=== Searching for transient-related classes ==="
rg -n "transient\|Transient" --type php -i | head -20

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 889


The WordPress_Simple_Cache class does not exist and must be implemented.

The code instantiates new WordPress_Simple_Cache('wu_sso_') at line 920, but no class definition exists anywhere in the codebase. This will cause a runtime error. You must either:

  1. Create the WordPress_Simple_Cache class in the inc/sso/ directory that implements the PSR-16 Psr\SimpleCache\CacheInterface, or
  2. Use an existing cache implementation (such as the Cache_Manager or a transient wrapper), or
  3. Add a package to composer.json that provides this class and ensure it's properly imported.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@inc/sso/class-sso.php` around lines 917 - 920, The instantiation of
WordPress_Simple_Cache in class-sso.php will fail because that class is missing;
fix by adding a new class named WordPress_Simple_Cache in the inc/sso/ namespace
that implements Psr\SimpleCache\CacheInterface (implement all required methods:
get, set, delete, clear, getMultiple, setMultiple, deleteMultiple, has) using WP
transients with the provided prefix, or alternatively replace the new
WordPress_Simple_Cache('wu_sso_') call to use an existing cache helper (e.g.,
Cache_Manager or your transient wrapper) or add and import a composer package
that provides WordPress_Simple_Cache—ensure $this->cache receives a PSR-16
compatible object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant