mautic / mautic/api-library

Error 500 on listing ContactFields with a filter

Open
#197 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
205
Forks
129
PR merge metrics
No merged PRs in 30d

Description

Where

On the API, when accessing as a system admin user. End point is contactFields List.

Mautic version is 2.15.1

Installation using Docker

Expected

Currently, despite the docs having no information on how to use filters (this needs to be remedied) I've seen in tests that filters follow the format $search = "id:45"; or $search = "alias:myalias";.

Using them would make the code look like this:

$fieldsApi = $this->api->newApi("contactFields", $this->auth, $this->api_url);
$search = "id:45";
$response = $fieldsApi->getList($search);

Using this on a Contact Field List function should return Fields filtered to ID 45.

Actual

API returns a 500 error. Error log in Mautic is as follows:

[2019-07-20 15:15:19] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function trans() on null" at /var/www/html/app/bundles/CoreBundle/Entity/CommonRepository.php line 1727 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function trans() on null at /var/www/html/app/bundles/CoreBundle/Entity/CommonRepository.php:1727)"} []

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with app/bundles/CoreBundle/Entity/CommonRepository.php around line 1727 and trace the contactFields List request using the documented filter forms such as id:45. Reproduce the request against Mautic 2.15.1 with the API example in the issue. Done means the request no longer returns a 500 and filtering by ID returns the matching contact field; the missing filter documentation is also noted in the issue scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.