Skip to content

Commit f6e1a3e

Browse files
committed
skip over replacements if TypeError is executed.
1 parent 8f338d9 commit f6e1a3e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

features/search-replace.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,7 @@ Feature: Do global search/replace
11091109
Scenario: Warn and ignore type-hinted objects that have some error in deserialization
11101110

11111111
Given a WP install
1112-
And I run `wp option add cereal_isation 'O:13:"mysqli_result":5:{s:13:"current_field";N;s:11:"field_count";N;s:7:"lengths";N;s:8:"num_rows";N;s:4:"type";N;}'`
1112+
And I run `wp db query "INSERT INTO wp_options (option_name,option_value) VALUES ('cereal_isation','O:13:\"mysqli_result\":5:{s:13:\"current_field\";N;s:11:\"field_count\";N;s:7:\"lengths\";N;s:8:\"num_rows\";N;s:4:\"type\";N;}')"`
11131113

11141114
When I try `wp search-replace current_field current_field1`
11151115
Then STDERR should contain:
@@ -1118,13 +1118,13 @@ Feature: Do global search/replace
11181118
"""
11191119
And STDOUT should contain:
11201120
"""
1121-
Success: Made 1 replacement.
1121+
Success: Made 0 replacements.
11221122
"""
11231123

1124-
When I run `wp option get cereal_isation`
1124+
When I run `wp db query "SELECT option_value from wp_options where option_name='cereal_isation'"`
11251125
Then STDOUT should contain:
11261126
"""
1127-
O:13:"mysqli_result":5:{s:13:"current_field1";N;s:11:"field_count";N;s:7:"lengths";N;s:8:"num_rows";N;s:4:"type";N;}
1127+
O:13:"mysqli_result":5:{s:13:"current_field";N;s:11:"field_count";N;s:7:"lengths";N;s:8:"num_rows";N;s:4:"type";N;}
11281128
"""
11291129

11301130
Scenario: Regex search/replace with `--regex-limit=1` option

src/WP_CLI/SearchReplacer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ private function run_recursively( $data, $serialised, $recursion_level = 0, $vis
9999
)
100100
);
101101

102-
$unserialized = false;
102+
throw new Exception();
103103
}
104104

105105
if ( false !== $unserialized ) {

0 commit comments

Comments
 (0)