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

Calling eZOperationHandler::execute with missing parameter does not give any error or notification

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Medium
    • Resolution: Obsolete
    • Affects Version/s: 4.4.0
    • Fix Version/s: None
    • Component/s: Notifications
    • Labels:
      None

      Description

      I was in a situation where I was calling eZOperationHandler::execute with a missing parameter, in the $operationParameters array. This caused the method to fail silently, and do nothing.

      This is happening because

      $result = $this->executeClassMethod( $includeFile, $className, $method,
                                                                       $tmpOperationParameterDefinitions, $operationParameters );
      

      will return

      array
        'internal_error' => int 8
        'internal_error_parameter_name' => string 'option_list' (length=11)
      

      when there is a missing parameter, so it will skip the following if test, and fail silently.

      if ( $result && array_key_exists( 'status', $result ) )

      It would be nice if this was logged with a notice of some sort, so you could see it in the error logs.

      Steps to reproduce
      eZOperationHandler::execute( 'shop', 'addtobasket', array(
      	'basket_id' => (int) $basket->attribute( 'id' ),
      	'object_id' => (int) 2, // A product
      	'quantity' => (int) 1,
      	'option_list' => null
      ));
      

      I've set the option_list to null for as an example, obviously this would be gotten form some other place.

        Attachments

          Activity

            People

            Assignee:
            unknown unknown
            Reporter:
            torjus Torjus Bjåen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated: