We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents b59290f + 90aa0c0 commit e69b682Copy full SHA for e69b682
1 file changed
tests/class-two-factor-core.php
@@ -178,9 +178,21 @@ private function reset_profile_errors() {
178
private function render_user_two_factor_options( WP_User $user ) {
179
$this->reset_profile_errors();
180
181
+ $ob_level = ob_get_level();
182
ob_start();
- Two_Factor_Core::user_two_factor_options( $user );
183
- return ob_get_clean();
+
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
196
}
197
198
/**
0 commit comments