Index: kernel/classes/ezcontentobject.php
===================================================================
--- kernel/classes/ezcontentobject.php	(revision 23777)
+++ kernel/classes/ezcontentobject.php	(working copy)
@@ -2055,11 +2055,15 @@
 
         if ( count( $objList ) > 0 )
         {
-            $objectArray = array();
-            $tmpLanguageObjectList = array();
-            $whereSQL = '';
-            $count = count( $objList );
-            $i = 0;
+            $selectSQL = 'SELECT ezcontentobject_attribute.*, ezcontentclass_attribute.identifier as identifier
+                           FROM  ezcontentobject_attribute, ezcontentclass_attribute
+                           WHERE
+                           ';
+
+            $orderSQL   = '
+                           ORDER BY
+                                ezcontentobject_attribute.contentobject_id, ezcontentclass_attribute.placement ASC';
+
             foreach ( $objList as $obj )
             {
                 if ( $obj instanceOf eZContentObject )
@@ -2068,55 +2072,41 @@
                     $object = $obj->attribute( 'object' );
 
                 $language = $object->currentLanguage();
-                $tmpLanguageObjectList[$object->attribute( 'id' )] = $language;
-                $objectArray = array( 'id' => $object->attribute( 'id' ),
-                                      'language' => $language,
-                                      'version' => $object->attribute( 'current_version' ) );
 
-                $whereSQL .= "( ezcontentobject_attribute.version = '" . $object->attribute( 'current_version' ) . "' AND
-                    ezcontentobject_attribute.contentobject_id = '" . $object->attribute( 'id' ) . "' AND
-                    ezcontentobject_attribute.language_code = '" . $language . "' ) ";
+                $whereSQL = ' ezcontentobject_attribute.contentobject_id = ' . $object->attribute( 'id' )      . '
+                             AND ezcontentobject_attribute.version = ' . $object->attribute( 'current_version' ) . "
+                             AND ezcontentobject_attribute.language_code = '$language'
+                             AND ezcontentclass_attribute.id = ezcontentobject_attribute.contentclassattribute_id
+                             AND ezcontentclass_attribute.version = 0 ";
 
-                $i++;
-                if ( $i < $count )
-                    $whereSQL .= ' OR ';
-            }
+                $query = $selectSQL . $whereSQL . $orderSQL;
+                
+                var_dump( $query );
 
-            $query = "SELECT ezcontentobject_attribute.*, ezcontentclass_attribute.identifier as identifier FROM
-                    ezcontentobject_attribute, ezcontentclass_attribute
-                  WHERE
-                    ezcontentclass_attribute.version = '0' AND
-                    ezcontentclass_attribute.id = ezcontentobject_attribute.contentclassattribute_id AND
-                    ( $whereSQL )
-                  ORDER BY
-                    ezcontentobject_attribute.contentobject_id, ezcontentclass_attribute.placement ASC";
+                $attributeArray = $db->arrayQuery( $query );
 
-            $attributeArray = $db->arrayQuery( $query );
+                $tmpAttributeObjectList = array();
 
-            $tmpAttributeObjectList = array();
-            $returnAttributeArray = array();
-            foreach ( $attributeArray as $attribute )
-            {
-                $attr = new eZContentObjectAttribute( $attribute );
-                $attr->setContentClassAttributeIdentifier( $attribute['identifier'] );
+                foreach ( $attributeArray as $attribute )
+                {
+                    $attr = new eZContentObjectAttribute( $attribute );
+                    $attr->setContentClassAttributeIdentifier( $attribute['identifier'] );
 
-                $tmpAttributeObjectList[$attr->attribute( 'contentobject_id' )][] = $attr;
-            }
+                    $tmpAttributeObjectList[ $attr->attribute( 'contentobject_id' ) ][] = $attr;
+                }
 
-            foreach ( $objList as $obj )
-            {
                 if ( $obj instanceOf eZContentObject )
                 {
                     $obj->setContentObjectAttributes( $tmpAttributeObjectList[$obj->attribute( 'id' )],
                                          $obj->attribute( 'current_version' ),
-                                         $tmpLanguageObjectList[$obj->attribute( 'id' )] );
+                                         $language );
                 }
                 else
                 {
                     $object = $obj->attribute( 'object' );
                     $object->setContentObjectAttributes( $tmpAttributeObjectList[$object->attribute( 'id' )],
                                                          $object->attribute( 'current_version' ),
-                                                         $tmpLanguageObjectList[$object->attribute( 'id' )] );
+                                                         $language );
                     $obj->setContentObject( $object );
                 }
             }
