Merge branch '4.12' into 4

This commit is contained in:
Steve Boyd 2023-03-02 15:37:03 +13:00
commit 8b148bf293
2 changed files with 5 additions and 12 deletions

View File

@ -301,14 +301,14 @@ class ClassInfo
*/
public static function classes_for_file($filePath)
{
$absFilePath = Director::getAbsFile($filePath);
$absFilePath = Convert::slashes(Director::getAbsFile($filePath));
$classManifest = ClassLoader::inst()->getManifest();
$classes = $classManifest->getClasses();
$classNames = $classManifest->getClassNames();
$matchedClasses = [];
foreach ($classes as $lowerClass => $compareFilePath) {
if (strcasecmp($absFilePath ?? '', $compareFilePath ?? '') === 0) {
if (strcasecmp($absFilePath, Convert::slashes($compareFilePath ?? '')) === 0) {
$matchedClasses[$lowerClass] = $classNames[$lowerClass];
}
}
@ -324,14 +324,14 @@ class ClassInfo
*/
public static function classes_for_folder($folderPath)
{
$absFolderPath = Director::getAbsFile($folderPath);
$absFolderPath = Convert::slashes(Director::getAbsFile($folderPath));
$classManifest = ClassLoader::inst()->getManifest();
$classes = $classManifest->getClasses();
$classNames = $classManifest->getClassNames();
$matchedClasses = [];
foreach ($classes as $lowerClass => $compareFilePath) {
if (stripos($compareFilePath ?? '', $absFolderPath ?? '') === 0) {
if (stripos(Convert::slashes($compareFilePath ?? ''), $absFolderPath) === 0) {
$matchedClasses[$lowerClass] = $classNames[$lowerClass];
}
}

View File

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