Skip to content

Commit 948a996

Browse files
committed
Replace preg_replace with str_replace
1 parent 19b062c commit 948a996

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/Serializer.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,7 @@ private static function serializeString(string $value): string
208208
if (!empty($value) && !ctype_print($value)) {
209209
throw new SerializeException("Invalid characters in string");
210210
}
211-
212-
return '"' . preg_replace('/(["\\\])/', '\\\$1', $value) . '"';
211+
return '"' . str_replace(['\\', '"'], ['\\\\', '\"'], $value) . '"';
213212
}
214213

215214
private static function serializeDisplayString(DisplayString $value): string

0 commit comments

Comments
 (0)