Skip to content

Commit 7743775

Browse files
authored
Merge pull request #172 from wp-cli/fix/suppress-errors-during-unserialize
Add further suppression of warnings and notices
2 parents 9e8ed60 + 2f48d9f commit 7743775

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/WP_CLI/SearchReplacer.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,13 @@ private function run_recursively( $data, $serialised, $recursion_level = 0, $vis
8383
}
8484
}
8585

86+
// The error suppression operator is not enough in some cases, so we disable
87+
// reporting of notices and warnings as well.
88+
$error_reporting = error_reporting();
89+
error_reporting( $error_reporting & ~E_NOTICE & ~E_WARNING );
8690
$unserialized = is_string( $data ) ? @unserialize( $data ) : false;
91+
error_reporting( $error_reporting );
92+
8793
if ( false !== $unserialized ) {
8894
$data = $this->run_recursively( $unserialized, true, $recursion_level + 1 );
8995
} elseif ( is_array( $data ) ) {

0 commit comments

Comments
 (0)