BUGFIX Don't use singleton() to create DataFormatter instances, as it will cause weird side-effects with multiple formatter instances with different parameters (broke subsequent test runs of RestfulServerTest and SoapModelAccessTest) - all aboard the failboat!

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@64313 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-10-15 17:27:38 +00:00
parent 7f386f52c8
commit 96ec288cd7

View File

@ -96,7 +96,7 @@ abstract class DataFormatter extends Object {
} }
arsort($sortedClasses); arsort($sortedClasses);
foreach($sortedClasses as $className => $priority) { foreach($sortedClasses as $className => $priority) {
$formatter = singleton($className); $formatter = new $className();
if(in_array($extension, $formatter->supportedExtensions())) { if(in_array($extension, $formatter->supportedExtensions())) {
return $formatter; return $formatter;
} }
@ -132,7 +132,7 @@ abstract class DataFormatter extends Object {
} }
arsort($sortedClasses); arsort($sortedClasses);
foreach($sortedClasses as $className => $priority) { foreach($sortedClasses as $className => $priority) {
$formatter = singleton($className); $formatter = new $className();
if(in_array($mimeType, $formatter->supportedMimeTypes())) { if(in_array($mimeType, $formatter->supportedMimeTypes())) {
return $formatter; return $formatter;
} }