@@ -396,6 +396,19 @@ Feature: Do global search/replace
396
396
https://example.com
397
397
"""
398
398
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
+
399
412
When I try `wp search-replace 'regex error)' '' --regex`
400
413
Then STDERR should contain:
401
414
"""
@@ -456,17 +469,6 @@ Feature: Do global search/replace
456
469
"""
457
470
And the return code should be 1
458
471
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
470
472
Scenario : Formatting as count-only
471
473
Given a WP install
472
474
And I run `wp option set foo 'ALPHA.example.com' `
0 commit comments