After upgrading, if you try to create an issue using existing code, you get the following error:
Fatal error: Unsupported operand types in .../sites/all/modules/jira_rest/jira_rest.module on line 74

The problem is that the API changed. The compatibility wrapper file is clearly intended to adapt calls made using the old API to the new, but it doesn't work.

Here's lines 70 - 72 of jira_rest_compatibility_wrapper.inc :

function jira_rest_createissue($issue_data, $options = array()) {
  return jira_rest_issue_create($issue_data, $options);
}

I changed those lines to the following and it worked:

function jira_rest_createissue($username, $password, $issue_data) {
  $options = array(
    'username' => $username,
    'password' => $password,
  );
  return jira_rest_issue_create($issue_data, $options);
}

In order to make the compatibility wrapper work, a similar change would need to be made for every function in the file. ...Or you could just trash the file and document that the old API is deprecated.

Comments

klabowterman’s picture

hi, could you please paste in the code where/how you call the (deprecated) function to jira_rest?

i tested it myself calling the old jira_rest_createissue() function and the new jira_rest_issue_create() and had no problems, this is the code:

$issuedata =
    array(
      'fields' => array(
        'project' => array('id' => '10300',),
        'parent' => array('id' => 'INDIVKUNDE-10503'),
        'summary' => 'test ',
        'description' => "example desc",
        'priority' => array('id' => '4',),
        'issuetype' => array('id' => '10101'),
      ),
    );
  //deprecated way
  $response_obj = jira_rest_createissue($issuedata);
  $response_obj = jira_rest_createissue($issuedata,$options = array());
// new way
  jira_rest_issue_create($issuedata);
  jira_rest_issue_create($issuedata,$options = array());
jlnd’s picture

Hi @klabowterman,

In 7.x-5.1 line 218 of the jira_rest.module file looked like this:

function jira_rest_createissue($username, $password, $issuedata) {

So my code looked like this...

$response = jira_rest_createissue($username, $password, $issuedata);

...and...

$att_response = jira_rest_attachfiletoissue_absolutepath($filepath, $username, $password, $response->key, false, false);
klabowterman’s picture

Assigned: Unassigned » tseifert

Hi @jlnd,

i see, i'll hand this over to @tseifert as he is in charge for the jira_rest_compatibility_wrapper.inc.

thanx for sharing this bug!

tseifert’s picture

Hi @jlnd,
you're right, the compatibility wrapper is still missing a lot of functions from the 7.x-5.1 branch.
In general we advise to use the new API of this module - however I will add the missing functions from that branch.
This should be available next week.

  • tseifert committed 673ba22 on 7.x-6.x
    Issue #2511126: Upgrading from jira_rest-7.x-5.1 to jira_rest-7.x-6.0...
tseifert’s picture

Status: Active » Fixed

This issue should be fixed with the new 7.x-6.2 release.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.