Skip to content

Search on Server/Data Center, JSM fixes and runnable tests

Choose a tag to compare

@lesstif lesstif released this 25 Oct 13:59
· 11 commits to main since this release

⚠️ Upgrade notes

This release contains two small behavior changes. Please check your code before upgrading.

  • IssueField::$fixVersions defaults to null instead of [] (#558)
    When fixVersions isn't returned (e.g. it's excluded from the requested fields), the property is now null.
    If you iterate over it directly, use the new getter or ?? []:
    foreach ($issue->fields->getFixVersions() as $version) { ... }
    // or
    foreach ($issue->fields->fixVersions ?? [] as $version) { ... }
  • Reporter::$active (and User::$active) is now bool (#532)
    It was declared as string, so it held "1" / "". It now holds true / false, as returned by Jira.
    if ($user->active) keeps working, but strict comparisons like $user->active === '1' need to change.

Fixes

Search on Jira Server/Data Center (#552)

IssueService::search() now works on both Jira Cloud and Jira Server/Data Center.
It calls the enhanced search API (/search/jql) first. On a 404 it falls back to the legacy /search API (Server/Data Center).
On Server/Data Center, nextPageToken holds the next startAt offset, so the same paging loop works on both:

$nextPageToken = '';
do {
    $ret = $issueService->search($jql, $nextPageToken, 50, ['summary']);
    // ...
    $nextPageToken = $ret->getNextPageToken();
} while (!empty($nextPageToken));

The second parameter of search() is nextPageToken, not startAt. The README pagination example has been updated.

Undefined constant CURL_LOCK_DATA_CONNECT (#567)

CURL_LOCK_DATA_CONNECT requires libcurl 7.57.0 or later, but PHP 8.0 - 8.3 can be built with libcurl 7.29.0 (e.g. CentOS/RHEL 7).
The connection cache is now shared only when the constant is defined. Otherwise only the DNS cache is shared.

fixVersions mapping (#558)

Mapping a response with "fixVersions": null no longer throws JsonMapper_Exception. New IssueField::getFixVersions() always returns an array.

Jira Service Management (#532)

Several ServiceDesk classes failed to map real API responses:

  • CustomerService: building a customer from a user failed (wrong timeZone property, accountId/key missing on Server/Cloud, avatarUrls type mismatch).
  • OrganisationService:
    • createFromOrganisation() sent a JSON string as the organisation name.
    • Responses couldn't be mapped by JsonMapper.
    • getCustomersForOrganisation() didn't read the paged values and failed to build its URL.
    • addCustomersToOrganisation() posted form data to the wrong endpoint.
  • Comment, RequestStatus, Organisation, Request: mapping JSON objects failed with TypeError.
  • Customer::setLinks() dropped the given links.

Others

  • Creating a project no longer sends an empty versions field, which Jira rejected with 400.
  • Removed curl_close() calls, deprecated in PHP 8.5.

Tests and CI

  • Running vendor/bin/phpunit without a Jira server now passes. Tests that need a live Jira server extend JiraIntegrationTestCase and are skipped unless .env is configured. See "Running tests" in the README. (#532)
  • CI runs the whole test suite on PHP 8.3, 8.4 and 8.5.

Closed issues

#532, #542, #547, #552, #558, #567

Full Changelog: 5.12.1...5.13.0