Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-18594

Moving content object within datatype ezimage to trash causing DB Transaction error.



    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: 2011.7
    • Fix Version/s: 4.6.0alpha1
    • Labels:
    • Environment:

      Operating System: Ubuntu 11.04
      PHP Version: 5.3.5
      Database and version: 5.1.54-1ubuntu4 (Ubuntu)
      Browser (and version): FireFox 4


      When try to move an content object to trash box, I receive a DB Transaction error.

      here is the log I have:
      [ Aug 25 2011 05:24:26 ] [] eZMySQLiDB:
      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 ')' at line 2. Query: SELECT id, contentobject_attribute_id, filepath
      FROM ezimagefile WHERE contentobject_attribute_id='1300' AND filepath IN ( )
      [ Aug 25 2011 05:24:26 ] [] eZDBInterface::commit TRANSID-9b7b03454bb2238ec1c8aa67a377bd6a:
      Transaction in progress failed due to DB error, transaction was rollbacked. Transaction ID is TRANSID-9b7b03454bb2238ec1c8aa67a377bd6a.

      I check the log, it occurred when try to fetch data from table 'ezimagefile' with an empty filepath value. so I guess the problem might be related to the datatype "ezimage".


      I trace the code and actually I found where the piece of code causing this problem.
      in the file "kernel/classes/datatypes/ezimage/ezimagetype.php", line 70
      $conds = array(
      "contentobject_attribute_id" => $contentObjectAttribute->attribute( "id" ),
      "filepath" => array( $aliasesPath )
      the array $aliasesPath is empty because not all the version of object attribute have content, need to determine if the array is empty or not before doing the fetch.
      my solution is below:
      add the following line before the $conds
      if( empty( $aliasesPath ))

      { return false; }

      also in the line 119 of the same file, the same problem is as above, but occurred when trying to restore the same content object.

      please fix it, thanks!

      Steps to reproduce

      Create a content object using a content class with ezimage datatype in it, do not upload image for the attribute, after save and publish, move the content to trash, the DB Transaction error will occur.


          Issue Links



              chen Chen Xiongjie
              alvawu Alva Wu
              0 Vote for this issue
              0 Start watching this issue