Skip to content

Commit b294cb0

Browse files
authored
Merge branch 'master' into ux/notice-mixed-audience
2 parents 907c16e + e69b682 commit b294cb0

2 files changed

Lines changed: 29 additions & 17 deletions

File tree

package-lock.json

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/class-two-factor-core.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,21 @@ private function reset_profile_errors() {
178178
private function render_user_two_factor_options( WP_User $user ) {
179179
$this->reset_profile_errors();
180180

181+
$ob_level = ob_get_level();
181182
ob_start();
182-
Two_Factor_Core::user_two_factor_options( $user );
183-
return ob_get_clean();
183+
184+
try {
185+
Two_Factor_Core::user_two_factor_options( $user );
186+
return ob_get_clean();
187+
} finally {
188+
// If user_two_factor_options() aborted early, close only the buffer
189+
// this helper opened and clear the static profile errors, so a leaked
190+
// buffer or stale error state can't bleed into later tests.
191+
while ( ob_get_level() > $ob_level ) {
192+
ob_end_clean();
193+
}
194+
$this->reset_profile_errors();
195+
}
184196
}
185197

186198
/**

0 commit comments

Comments
 (0)