Skip to content

Commit 536a527

Browse files
committed
Restore previous test position and clarify comment
1 parent b1671b5 commit 536a527

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

features/search-replace.feature

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,19 @@ Feature: Do global search/replace
396396
https://example.com
397397
"""
398398

399+
# NOTE: The preg_match() error message is a substring of the actual message that matches across supported PHP versions.
400+
# In PHP 8.2, the error message changed from
401+
# "preg_match(): Delimiter must not be alphanumeric or backslash."
402+
# to
403+
# "preg_match(): Delimiter must not be alphanumeric, backslash, or NUL"
404+
When I try `wp search-replace 'HTTPS://EXAMPLE.COM' 'https://example.jp/' wp_options --regex --regex-flags=i --regex-delimiter='1'`
405+
Then STDERR should contain:
406+
"""
407+
Error: The regex '1HTTPS://EXAMPLE.COM1i' fails.
408+
preg_match(): Delimiter must not be alphanumeric
409+
"""
410+
And the return code should be 1
411+
399412
When I try `wp search-replace 'regex error)' '' --regex`
400413
Then STDERR should contain:
401414
"""
@@ -456,17 +469,6 @@ Feature: Do global search/replace
456469
"""
457470
And the return code should be 1
458471

459-
Scenario: Search replace with an invalid regex delimiter
460-
Given a WP install
461-
462-
# Exact preg_match() error changed with PHP 8.2+ (added NUL).
463-
When I try `wp search-replace 'HTTPS://EXAMPLE.COM' 'https://example.jp/' wp_options --regex --regex-flags=i --regex-delimiter='1'`
464-
Then STDERR should contain:
465-
"""
466-
Error: The regex '1HTTPS://EXAMPLE.COM1i' fails.
467-
preg_match(): Delimiter must not be alphanumeric
468-
"""
469-
And the return code should be 1
470472
Scenario: Formatting as count-only
471473
Given a WP install
472474
And I run `wp option set foo 'ALPHA.example.com'`

0 commit comments

Comments
 (0)