Automattic / Automattic/go-search-replace
Replace corrupts serialized data if the search and replace are of different length
- Dominant language
- Go
- Stars
- 108
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
To reproduce:
```
php -r 'echo serialize("aaaaabbbbbbbbbbaaaaa"), PHP_EOL;' > test.txt
cat test.txt | ./go-search-replace bbbbbbbbbb ccccc
cat test.txt | ./go-search-replace bbbbbbbbbb ccccccccccccccc
```
Expected result:
```
s:15:"aaaaacccccaaaaa";
s:25:"aaaaacccccccccccccccaaaaa";
```
Actual result:
```
s:20:"aaaaacccccaaaaa";
s:20:"aaaaacccccccccccccccaaaaa";
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by running the two reproductions with test.txt and ./go-search-replace, then trace the command entry point handling PHP serialized strings. Verify the fix against both replacements: each output should preserve the serialized length and match the expected strings shown in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, php
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100