From 46ecbb3f0923597b05199515b088aec43f76a8e6 Mon Sep 17 00:00:00 2001 From: Jordan Diaz Date: Wed, 29 Jul 2026 11:32:33 +0000 Subject: [PATCH] fix: tolerar null en $functions/$options de AcaiAPI (compat firma legacy CocoDB) Los hooks legacy llaman CocoDB::updateRecords(..., null) y el nuevo buildSetClause tipa $functions como array estricto: TypeError fatal en PHP 8 (p.ej. pago por transferencia via IPNGenerica). Se normaliza en la frontera publica (insert/update/get/delete). --- cms/lib/classes/AcaiAPI.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cms/lib/classes/AcaiAPI.php b/cms/lib/classes/AcaiAPI.php index 134bce1..722bbeb 100644 --- a/cms/lib/classes/AcaiAPI.php +++ b/cms/lib/classes/AcaiAPI.php @@ -67,6 +67,10 @@ class AcaiAPI self::$requestGetCache = []; global $TABLE_PREFIX; + // Llamadas legacy (CocoDB) pasan null explicito como $functions + if (!is_array($functions)) $functions = []; + if (!is_array($options)) $options = []; + if (!isset($records[0])) $records = [$records]; $prefix = isset($options['prefix']) ? $options['prefix'] : $TABLE_PREFIX; @@ -168,6 +172,10 @@ class AcaiAPI self::$requestGetCache = []; global $TABLE_PREFIX; + // Llamadas legacy (CocoDB) pasan null explicito como $functions + if (!is_array($functions)) $functions = []; + if (!is_array($options)) $options = []; + if (!isset($records[0])) $records = [$records]; $prefix = isset($options['prefix']) ? $options['prefix'] : $TABLE_PREFIX; @@ -270,6 +278,8 @@ class AcaiAPI self::$requestGetCache = []; global $TABLE_PREFIX; + if (!is_array($options)) $options = []; + $prefix = isset($options['prefix']) ? $options['prefix'] : $TABLE_PREFIX; $params = []; $whereSql = self::buildWhere($where, $params); @@ -323,6 +333,8 @@ class AcaiAPI { global $TABLE_PREFIX; + if (!is_array($options)) $options = []; + // ── Option defaults ────────────────────────────────────────────── $defaults = [ 'debug' => false,