BUG Update RelatedDataService to properly escape ClassName in Polymorphic relations (#10713)

This commit is contained in:
Maxime Rainville 2023-03-02 09:56:40 +13:00 committed by GitHub
parent 94b24b2390
commit 403f924d22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -394,14 +394,7 @@ class StandardRelatedDataService implements RelatedDataService
*/ */
private function prepareClassNameLiteral(string $value): string private function prepareClassNameLiteral(string $value): string
{ {
$c = chr(92); return DB::get_conn()->quoteString($value);
$escaped = str_replace($c ?? '', "{$c}{$c}", $value ?? '');
// postgres
if (stripos(get_class(DB::get_conn()), 'postgres') !== false) {
return "E'{$escaped}'";
}
// mysql
return "'{$escaped}'";
} }
/** /**