mirror of
https://github.com/symfony/serializer.git
synced 2026-03-24 01:12:14 +01:00
[Serializer] Fix excessive backtracking in name converters
This commit is contained in:
committed by
Nicolas Grekas
parent
317b217c21
commit
7d2a5e69c8
@@ -63,7 +63,7 @@ class CamelCaseToSnakeCaseNameConverter implements NameConverterInterface
|
||||
throw new UnexpectedPropertyException($propertyName);
|
||||
}
|
||||
|
||||
$camelCasedName = preg_replace_callback('/(^|_|\.)+(.)/', static fn ($match) => ('.' === $match[1] ? '_' : '').strtoupper($match[2]), $propertyName);
|
||||
$camelCasedName = preg_replace_callback('/(^|_|\.)++(.)/', static fn ($match) => ('.' === $match[1] ? '_' : '').strtoupper($match[2]), $propertyName);
|
||||
|
||||
if ($this->lowerCamelCase) {
|
||||
$camelCasedName = lcfirst($camelCasedName);
|
||||
|
||||
@@ -45,11 +45,7 @@ final class SnakeCaseToCamelCaseNameConverter implements NameConverterInterface
|
||||
return $propertyName;
|
||||
}
|
||||
|
||||
$camelCasedName = preg_replace_callback(
|
||||
'/(^|_|\.)+(.)/',
|
||||
static fn ($match) => ('.' === $match[1] ? '_' : '').strtoupper($match[2]),
|
||||
$propertyName
|
||||
);
|
||||
$camelCasedName = preg_replace_callback('/(^|_|\.)++(.)/', static fn ($match) => ('.' === $match[1] ? '_' : '').strtoupper($match[2]), $propertyName);
|
||||
|
||||
if ($this->lowerCamelCase) {
|
||||
$camelCasedName = lcfirst($camelCasedName);
|
||||
|
||||
Reference in New Issue
Block a user