Skip to content

quality-debt: inc/helpers/class-site-duplicator.php — PR #1082 review feedback (high) #1105

@superdav42

Description

@superdav42

Unactioned Review Feedback

Source PR: #1082
File: inc/helpers/class-site-duplicator.php
Reviewers: coderabbit
Findings: 1
Max severity: high


HIGH: coderabbit (coderabbitai[bot])

File: inc/helpers/class-site-duplicator.php:176
⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Restore intentionally blank identity fields too.

Using empty() here skips valid values like an intentionally blank blogdescription, so those fields stay overwritten by the template after the switch. Guard against a missing option value instead of a blank string.

Proposed fix
-		foreach ($identity_snapshot as $opt_key => $opt_val) {
-			if ( ! empty($opt_val) ) {
-				update_blog_option($to_site_id, $opt_key, $opt_val);
-			}
-		}
+		foreach ($identity_snapshot as $opt_key => $opt_val) {
+			if ( false !== $opt_val ) {
+				update_blog_option($to_site_id, $opt_key, $opt_val);
+			}
+		}
📝 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.

		foreach ($identity_snapshot as $opt_key => $opt_val) {
			if ( false !== $opt_val ) {
				update_blog_option($to_site_id, $opt_key, $opt_val);
			}
		}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@inc/helpers/class-site-duplicator.php` around lines 173 - 176, In the foreach
over $identity_snapshot in class-site-duplicator.php, stop using empty($opt_val)
(which treats intentionally blank strings as "empty") and instead guard only
against a missing/null value; change the condition to check $opt_val !== null
(or !== false if your source can return false for missing) before calling
update_blog_option($to_site_id, $opt_key, $opt_val) so intentionally blank
values like '' are preserved when updating options.

View comment



Auto-generated by quality-feedback-helper.sh scan-merged. Review each finding and either fix the code or dismiss with a reason.


To approve or decline, use one of:

  • sudo aidevops approve issue <number> Ultimate-Multisite/ultimate-multisite -- cryptographically signs approval for automated dispatch
  • Comment declined: <reason> -- closes this issue (include your reason after the colon)

aidevops.sh v3.14.59 automated scan.

Metadata

Metadata

Assignees

Labels

auto-dispatchorigin:workerAuto-created by pulse labelless backfill (t2112)priority:highHigh severity — significant quality issuequality-debtUnactioned review feedback from merged PRssource:review-feedbackAuto-created by quality-feedback-helper.shstatus:in-reviewPR open, awaiting review/merge

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions