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

Fatal error while installing the package with eZPackage::NON_INTERACTIVE as true

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: High High
    • None
    • 4.0.7, 4.1.4, 4.2.0, 4.3.0
    • Legacy > Packages
    • None

    Description

      I got Fatal error: Call to a member function initialLanguage() on a non-object in ezcontentobject.php line 1274.
      when I tried to install huge package.

      Steps to reproduce

      It is hard t reproduce for me. But lets to see in the code/
      Simplified backtrace:

      1. eZPackage::install()
      2. eZPackage::installItem() from eZPackage::install() line 1883
      3. eZContentObjectPackageHandler::install() from eZPackage::installItem() line 1858
      4. eZContentObjectPackageHandler::installContentObjects() from eZContentObjectPackageHandler::install() line 994
      5. eZContentObject::unserialize() from eZContentObjectPackageHandler::installContentObjects() line 1056

      In this function line 5061

      $contentObject = eZContentObject::fetchByRemoteID( $remoteID ); 
      

      And if contentObject (that we are trying to install) exists

      if ( !$contentObject )
      {
          // does not metter
      }
      else
      {
           $firstVersion = false; //Important!!!!!!!!!!!!
           $description = "Object '$name' already exists.";
      
            // include_once( 'kernel/classes/ezpackagehandler.php' );
            $choosenAction = eZPackageHandler::errorChoosenAction( self::PACKAGE_ERROR_EXISTS,
                                                                         $options, $description, $handlerType, false );
      
             switch( $choosenAction )
             {
                 case eZPackage::NON_INTERACTIVE:
                 case self::PACKAGE_UPDATE:
                 {
                     // Keep existing contentobject.
                 } break;
      ...
      

      If eZPackage::NON_INTERACTIVE is true
      Existing content object should be kept!

      After that versions should be unserialized as well:
      6. eZContentObjectVersion::unserialize() from eZContentObject::unserialize() line 5172
      To this function $firstVersion as FALSE is passed.
      7. eZContentObject::createNewVersionIn() from eZContentObjectVersion::unserialize() line 1254
      and after that eZContentObject::createNewVersion()

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

      $copyFromVersion is false. So current version of this content object should be fetched.
      BUT this object is recently created from package and NO versions exist yet.

      Current version cannot be fetched due to it does not exist in new DB.

      To prevent this fatal error in

          $initialLanguage = $version->initialLanguage();
      

      eZPackage::NON_INTERACTIVE should be FALSE

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated: