Create a directory with two files in it: test-2.txt and test.txt:
test-dir
├── test-2.txt
└── test.txt
Enter the text "Foo" into test.txt.
Enter the text "foo" into test-2.txt.
Visit the directory or any of the files (the result is the same either
way).
Type 'M-x project-query-replace-regexp', choosing to replace "Foo"
with "Bar".
Confirm test-dir as the project directory in the next prompt.
The replacement process stops with point before "foo" in test-2.txt
with a message "Replaced 0 occurrences", without replacing "Foo" in
test.txt as it should have.
The bug appears both in emacs-27 as of
16fed05ba85c3d92d3c913657dd50a648ad3884a, and on master as of
771a6b68165b986b6bf9249c57ca11d310b0f0e4.