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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions inc/admin-pages/class-checkout-form-edit-admin-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -1530,7 +1530,7 @@ public function handle_save() {
*/
ob_start();

parent::handle_save();
$result = parent::handle_save();

$object = $this->get_object();

Expand All @@ -1547,7 +1547,7 @@ public function handle_save() {
}

wp_ob_end_flush_all();
return true;
return $result;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions inc/admin-pages/class-discount-code-edit-admin-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -844,9 +844,9 @@ public function has_title(): bool {
* Should implement the processes necessary to save the changes made to the object.
*
* @since 2.0.0
* @return void
* @return bool
*/
public function handle_save(): void {
public function handle_save(): bool {
Comment on lines +847 to +849
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

find . -name "class-customer-edit-admin-page.php" -type f

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 133


🏁 Script executed:

# Look for the handle_save method in the customer edit admin page
rg -n "function handle_save" --type=php -A 20 | grep -A 20 "customer-edit"

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 3856


🏁 Script executed:

# Search more broadly for customer edit admin page
fd "customer" --type f | grep -i admin

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 302


🏁 Script executed:

# Get the full handle_save method from Customer_Edit_Admin_Page
sed -n '1165,1250p' ./inc/admin-pages/class-customer-edit-admin-page.php

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 2233


🏁 Script executed:

# Also check what the parent class handle_save returns
rg -n "class Customer_Edit_Admin_Page" --type=php -A 5

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 555


🏁 Script executed:

# Find the parent Edit_Admin_Page class and its handle_save method
rg -n "class Edit_Admin_Page" --type=php -A 5

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 500


🏁 Script executed:

# Find Edit_Admin_Page::handle_save() definition
rg -n "function handle_save" --type=php inc/admin-pages/class-edit-admin-page.php -A 30

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 811


🏁 Script executed:

# Get the exact lines mentioned in the review comment - lines 847-849 in discount code edit
sed -n '840,860p' ./inc/admin-pages/class-discount-code-edit-admin-page.php

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 522


🏁 Script executed:

# Check return types for other similar admin page classes
rg -n "public function handle_save\(\)" --type=php inc/admin-pages/ -B 0 -A 1 | head -40

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 2231


🏁 Script executed:

# Check if there are other classes extending Edit_Admin_Page and their handle_save implementations
rg -n "extends Edit_Admin_Page" --type=php inc/admin-pages/

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 1625


🏁 Script executed:

# Get more context around the Discount_Code_Edit_Admin_Page handle_save
sed -n '835,880p' ./inc/admin-pages/class-discount-code-edit-admin-page.php

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 1098


🏁 Script executed:

# Check who calls handle_save() to understand the impact of void vs bool return type
rg -n "->handle_save\(\)" --type=php inc/admin-pages/ -B 2 -A 2

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 485


🏁 Script executed:

# Double-check the exact return type signature in Customer_Edit_Admin_Page one more time
sed -n '1165,1170p' ./inc/admin-pages/class-customer-edit-admin-page.php

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 347


🏁 Script executed:

# Search for how handle_save() is called - look for the caller pattern
rg -n "handle_save\(\)" --type=php inc/admin-pages/class-base-admin-page.php -B 3 -A 3

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 63


🏁 Script executed:

# Check the base admin page to understand the calling pattern
fd "class-base-admin-page" --type f

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 122


🏁 Script executed:

# Look for the caller - usually in a controller or dispatcher
rg -n "handle_save" --type=php inc/admin-pages/class-base-admin-page.php -B 5 -A 5 | head -60

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 63


🏁 Script executed:

# Look at the base admin page definition to find the caller context
cat -n ./inc/admin-pages/class-base-admin-page.php | grep -A 10 -B 10 "handle_save"

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 63


🏁 Script executed:

# Search for where handle_save gets invoked - look in all PHP files
rg -n 'handle_save' --type=php -B 3 -A 3 | grep -A 3 -B 3 'if.*handle_save\|return.*handle_save\|exit' | head -80

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 5899


🏁 Script executed:

# Check if Customer_Edit_Admin_Page might have been modified - look at git or other evidence of what the fix should be
# Let me look at the parent class signature more carefully
sed -n '820,880p' ./inc/admin-pages/class-edit-admin-page.php

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 1187


🏁 Script executed:

# Verify the calling pattern - line 225 in Edit_Admin_Page
sed -n '220,235p' ./inc/admin-pages/class-edit-admin-page.php

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 359


🏁 Script executed:

# Check other void return classes to see if they have the same issue
rg -n "public function handle_save\(\): void" --type=php inc/admin-pages/ -A 80 | grep -A 80 "webhook\|view-logs\|template-previewer\|invoice-template\|email-template"

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 32566


🏁 Script executed:

# Check if Checkout_Form_Edit_Admin_Page and Broadcast_Edit_Admin_Page have return statements
# to understand the full pattern
rg -n "public function handle_save" --type=php -A 100 inc/admin-pages/class-checkout-form-edit-admin-page.php | grep -A 100 "1514:" | tail -50

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 1748


🏁 Script executed:

# Check Broadcast_Edit_Admin_Page
fd "broadcast" --type f inc/admin-pages/

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 184


🏁 Script executed:

# Check Broadcast_Edit_Admin_Page handle_save method
rg -n "public function handle_save" --type=php -A 50 inc/admin-pages/class-broadcast-edit-admin-page.php

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 63


🏁 Script executed:

# Also verify Membership and Site_Edit_Admin_Page patterns - check if Site correctly returns
sed -n '760,775p' ./inc/admin-pages/class-site-edit-admin-page.php

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 614


🏁 Script executed:

# Check Membership_Edit_Admin_Page
rg -n "public function handle_save" --type=php -A 50 inc/admin-pages/class-membership-edit-admin-page.php | head -60

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 1531


🏁 Script executed:

# Final verification: Check the end of Customer_Edit_Admin_Page handle_save (around line 1245-1250)
sed -n '1245,1250p' ./inc/admin-pages/class-customer-edit-admin-page.php

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 164


Customer_Edit_Admin_Page::handle_save() must return the parent result to prevent white-page bug after customer edits.

Customer_Edit_Admin_Page::handle_save() is declared with void return type but calls parent::handle_save(); without returning its result (line 1249). The parent Edit_Admin_Page::handle_save() returns bool, which the caller at line 225 checks to decide whether to exit. Without returning the parent's result, the exit never executes after a successful save, causing the page to continue rendering instead of redirecting.

Fix: Change the return type to bool and use return parent::handle_save();, matching the pattern already applied to Discount_Code_Edit_Admin_Page and other similar classes.

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

In `@inc/admin-pages/class-discount-code-edit-admin-page.php` around lines 847 -
849, Customer_Edit_Admin_Page::handle_save currently doesn't return the parent
result which causes the caller to miss the boolean and leads to the white-page
bug; change the method signature to return bool (matching
Edit_Admin_Page::handle_save) and replace the bare parent::handle_save(); call
with return parent::handle_save(); so the parent boolean result is propagated
(same pattern used in Discount_Code_Edit_Admin_Page).

/*
* Set the recurring value to zero if the toggle is disabled.
*/
Expand Down Expand Up @@ -897,6 +897,6 @@ public function handle_save(): void {

$_POST['code'] = trim((string) wu_request('code'));

parent::handle_save();
return parent::handle_save();
}
}
6 changes: 3 additions & 3 deletions inc/admin-pages/class-domain-edit-admin-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,9 @@ public function has_title(): bool {
* Should implement the processes necessary to save the changes made to the object.
*
* @since 2.0.0
* @return void
* @return bool
*/
public function handle_save(): void {
public function handle_save(): bool {

// phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce verification happens in parent::handle_save()
if ( ! wu_request('primary_domain')) {
Expand All @@ -593,6 +593,6 @@ public function handle_save(): void {

wu_enqueue_async_action('wu_async_process_domain_stage', ['domain_id' => $this->get_object()->get_id()], 'domain');

parent::handle_save();
return parent::handle_save();
}
}
6 changes: 3 additions & 3 deletions inc/admin-pages/class-email-edit-admin-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -475,17 +475,17 @@ public function query_filter($args) {
* Handles the toggles.
*
* @since 2.0.0
* @return void
* @return bool
*/
public function handle_save(): void {
public function handle_save(): bool {

$_POST['schedule'] = wu_request('schedule');

$_POST['send_copy_to_admin'] = wu_request('send_copy_to_admin');

$_POST['custom_sender'] = wu_request('custom_sender');

parent::handle_save();
return parent::handle_save();
}

/**
Expand Down
6 changes: 3 additions & 3 deletions inc/admin-pages/class-payment-edit-admin-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -1310,9 +1310,9 @@ public function has_title(): bool {
*
* @todo: This can not be handled here.
* @since 2.0.0
* @return void
* @return bool
*/
public function handle_save(): void {
public function handle_save(): bool {

$this->get_object()->recalculate_totals()->save();

Expand All @@ -1328,6 +1328,6 @@ public function handle_save(): void {
}
}

parent::handle_save();
return parent::handle_save();
}
}
6 changes: 3 additions & 3 deletions inc/admin-pages/class-product-edit-admin-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -1159,9 +1159,9 @@ public function has_title(): bool {
* Should implement the processes necessary to save the changes made to the object.
*
* @since 2.0.0
* @return void
* @return bool
*/
public function handle_save(): void {
public function handle_save(): bool {
/*
* Set the recurring value to zero if the toggle is disabled.
*/
Expand Down Expand Up @@ -1212,6 +1212,6 @@ public function handle_save(): void {
$_POST['taxable'] = 0;
}

parent::handle_save();
return parent::handle_save();
}
}
Loading