From 5cc0bd0a3fc72727993d2a76d65c73c7429b1aa6 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 2 Apr 2025 11:31:10 +0200 Subject: [PATCH] Fix #33689 - missing rename (#33693) # Fix #33689 - missing rename Assignment to $result in code before fixing phan notice seem be an error, but in fact the assignment is useless and the code only expects a potential exception. --- htdocs/compta/facture/class/api_invoices.class.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index bc10b732054..20e680afcf8 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -321,7 +321,7 @@ class Invoices extends DolibarrApi /** * Create invoice object * - * @param array $request_data Request datas + * @param array $request_data Request data * @phan-param ?array $request_data * @phpstan-param ?array $request_data * @return int ID of invoice @@ -331,8 +331,13 @@ class Invoices extends DolibarrApi if (!DolibarrApiAccess::$user->hasRight('facture', 'creer')) { throw new RestException(403, "Insuffisant rights"); } - // Check mandatory fields - $request_data = $this->_validate($request_data); + + if (!is_array($request_data)) { + $request_data = array(); + } + + // Check mandatory fields (not using output, only possible exception is important) + $this->_validate($request_data); foreach ($request_data as $field => $value) { if ($field === 'caller') {