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

Fatal error when deleting main node having ezfind enabled

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: High High
    • 4.5.0beta1
    • 4.4.0, 4.5.0alpha
    • Misc
    • None

    Description

      Hi. Not sure if it's an ezfind issue or a eZ Publish core one, but i would say the second.

      The thing is, if you have ez find enabled an try to delete main node for an object you get a php fatal error in ezsolr.php file. Error is like

      Fatal error: Call to a member function attribute() on a non-object in /home/carlos/workspace/ez/extension/ezfind/search/plugins/ezsolr/ezsolr.php on line 357 
      

      I would say it's an eZ Publish issue if we think in the following.
      ezcontentoperationcollection.php file has following piece of code

      // Give other search engines that the default one a chance to reindex
              // when removing locations.
              // include_once( 'kernel/classes/ezsearch.php' );
              if ( !eZSearch::getEngine() instanceof eZSearchEngine )
              {
                  // include_once( 'kernel/content/ezcontentoperationcollection.php' );
                  eZContentOperationCollection::registerSearchObject( $objectID, $object->attribute( 'current_version' ) );
              }
      
              eZNodeAssignment::purgeByID( array_unique( $nodeAssignmentIDList ) );
      
              if ( $mainNodeChanged )
              {
                  $allNodes   = $object->assignedNodes();
                  $mainNode   = $allNodes[0];
                  $mainNodeID = $mainNode->attribute( 'node_id' );
                  eZContentObjectTreeNode::updateMainNodeID( $mainNodeID, $objectID, false, $mainNode->attribute( 'parent_node_id' ) );
              }
      
              $db->commit();
      

      ezsolr needs main node in order to index the object, but it seems is trying to get that main node before updateMainNodeID operation is performed. and in that exact moment, there is no main node for the object because it has been deleted and the update thing is not performed yet. i moved up the updatemainnode thing and the problem seem to be solved... but don't know if is the best option.

      anyone? thanks.

      Steps to reproduce

      Make a ez publish Fuji fresh install
      add ezfind
      Create an article somewhere
      Add a location for it in some other place
      Try to delete main node.

      Attachments

        1. addobject.png
          addobject.png
          124 kB
        2. errors.zip
          162 kB

        Activity

          People

            bd bd
            desorden desorden
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: