ezsystems/ezpublish — comment on commit f15af5b82beb5d09e20010bdda2eab097e732467
File: kernel/classes/ezorder.php line 405
By andrerom:

Regression! If you don't have any orders you will get:

Query error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY id ASC' at line 2. Query: SELECT id, section_id, owner_id, contentclass_id, name, published, modified, current_version, status, remote_id, language_mask, initial_language_id
FROM ezcontentobject WHERE id IN ( ) ORDER BY id ASC

Possible fix:

diff --git a/kernel/classes/ezorder.php b/kernel/classes/ezorder.php
index de0f4c6..2c9eaf9 100644
--- a/kernel/classes/ezorder.php
+++ b/kernel/classes/ezorder.php
@@ -394,12 +394,23 @@ class eZOrder extends eZPersistentObject

// add last product info
if ( !empty( $productArray ) )
+ {
$productItemArray[] = array(
'name' => $name,
// Reference to the entry that will contain the ContentObject at the end
'product' => &$contentObjectIDHash[$currentContentObjectID],
'product_info' => $productInfo
);
+ }
+ else
+ {
+ return array(
+ array(
+ 'product_list' => $productItemArray,
+ 'total_sum_info' => $totalSumInfo
+ )
+ );
+ }

// Fetching all ContentObject ids in one query, filling the hash with the corresponding ContentObject
foreach ( eZContentObject::fetchList( true, array( "id" => array( array_keys( $contentObjectIDHash ) ) ) ) as $contentObject )