Skip to content

#1154 [API] fix: list hooks accept any object, the shipments REST API sends a stdClass - #1155

Merged
nicolas-eoxia merged 1 commit into
Eoxia:developfrom
nicolas-eoxia:fix/1154-list-hooks-any-object
Oct 22, 2026
Merged

nicolas-eoxia merged 1 commit into
Eoxia:developfrom
nicolas-eoxia:fix/1154-list-hooks-any-object

Conversation

@nicolas-eoxia

Copy link
Copy Markdown
Member

Closes #1154

Problème

expedition/class/api_shipments.class.php (cœur 23.0.4, l. 146) passe new stdClass() au hook printFieldListWhere dès qu'un sqlfilters est fourni. Les hooks de liste de reedcrm étaient typés ?CommonObject : chaque GET /api/index.php/shipments?sqlfilters=… répondait 500 (TypeError … must be an instance of CommonObject or null, instance of stdClass given). Vu deux fois sur une prod client (19/10 et 22/10) : une intégration externe qui suit les expéditions d'un client.

Correctif

  • printFieldListWhere, printFieldListSelect, printFieldListSearch et isLifecycleColumn prennent ?object.
  • isLifecycleColumn vérifie isset($object->element) avant de le lire (sinon « Undefined property » sur un stdClass).

Vérifié sur une copie de la base du client

Shipments->index('t.date_creation', 'DESC', 5, 0, '', '(t.fk_soc:=:…)') rejoué en CLI, chaque version dans son processus :

Résultat
Avant TypeError: Argument 2 passed to ActionsReedcrm::printFieldListWhere() …
Après 2 expéditions renvoyées, aucun warning PHP

🤖 Generated with Claude Code

…T API sends a stdClass

api_shipments.class.php passes new stdClass() to printFieldListWhere as soon
as sqlfilters is given: the ?CommonObject type hint of the reedcrm list hooks
ended every GET /api/index.php/shipments?sqlfilters=... in a 500 (TypeError),
seen twice on a client production, an external integration following the
shipments of a customer.

- printFieldListWhere, printFieldListSelect, printFieldListSearch and
  isLifecycleColumn take ?object
- isLifecycleColumn checks isset($object->element) before reading it

Replayed Shipments->index('t.date_creation', 'DESC', 5, 0, '',
'(t.fk_soc:=:...)') on a copy of the client database: TypeError before,
2 shipments returned after, no PHP warning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nicolas-eoxia
nicolas-eoxia merged commit 4cf162c into Eoxia:develop Oct 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[API] Fatale TypeError dans printFieldListWhere : l'API REST des expéditions répond 500 dès qu'un filtre est passé

1 participant