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

Important check is lacking in eZContentObject::createNewVersion()

    XMLWordPrintable

Details

    Description

      In this function, just after the block if ( $versionCheck), we can see the code:

              if ( $copyFromVersion == false )
              {
                  $version = $this->currentVersion();
              }
              else
              {
                  $version = $this->version( $copyFromVersion );
              }
      

      => Definitely, after this block, $version has to be checked, because it may be false.
      The function should then return null or false, or whaterver in this specific case.

      Because if $version is false and the script continues, the next command is just crashing:

      $copiedVersion = $this->copyVersion( $this, $version, $nextVersionNumber, false, $status, $languageCode, $copyFromLanguageCode );
      
      Steps to reproduce

      How can $version be null at this step you may wonder ?

      Well I have the case on specific conditions:

      Due to a webservice crashs, many workflows were filling a fifo, and were launched on some old versionID.
      I've been using in this workflow the createNewVersion() with checkVersion set to true

      => as a result, imagine an object with the version 2 and after some other versions ( 3, 4, 5, 6, 7 for example), the workflow was creating several versions all from version 2, but as checkVersion was set to true, at a moment, the version 2 was just deleted

      And then, the code $version = $this->version( $copyFromVersion ); sends false

      causing afterwards the eZContentObject::createNewVersion() to crash...

      Attachments

        Activity

          People

            unknown unknown
            enzo enzo
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: