go-search-replace
go-search-replace copied to clipboard
Replace does not work for serialized data if the string does not end with a new line
To reproduce:
php -r 'echo serialize("aaaaabbbbbbbbbbaaaaa");' > test.txt
cat test.txt | ./go-search-replace bbbbbbbbbb ccccc
Expected result:
s:15:"aaaaacccccaaaaa";
Actual result: empty output
I see the problem. It is because the regex that is used s:\d+:\\\".*?\\\"; expects a \ before the quotation marks, such as s:15:\"aaaaacccccaaaaa\";
Browsing a sample WP database, \" seems to be the standard delimiter - I cant find a single instance of s:##:". They all have s:##:\"
I suggest closing this issue (though there are other valid open issues and efforts related to serialize length.
Yes, see github.com/Automattic/go-search-replace/issues/36#issuecomment-3348959380