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).
This commit is contained in:
Jordan Diaz
2026-07-29 11:32:33 +00:00
parent 7d38e069cd
commit 46ecbb3f09

View File

@@ -67,6 +67,10 @@ class AcaiAPI
self::$requestGetCache = []; self::$requestGetCache = [];
global $TABLE_PREFIX; 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]; if (!isset($records[0])) $records = [$records];
$prefix = isset($options['prefix']) ? $options['prefix'] : $TABLE_PREFIX; $prefix = isset($options['prefix']) ? $options['prefix'] : $TABLE_PREFIX;
@@ -168,6 +172,10 @@ class AcaiAPI
self::$requestGetCache = []; self::$requestGetCache = [];
global $TABLE_PREFIX; 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]; if (!isset($records[0])) $records = [$records];
$prefix = isset($options['prefix']) ? $options['prefix'] : $TABLE_PREFIX; $prefix = isset($options['prefix']) ? $options['prefix'] : $TABLE_PREFIX;
@@ -270,6 +278,8 @@ class AcaiAPI
self::$requestGetCache = []; self::$requestGetCache = [];
global $TABLE_PREFIX; global $TABLE_PREFIX;
if (!is_array($options)) $options = [];
$prefix = isset($options['prefix']) ? $options['prefix'] : $TABLE_PREFIX; $prefix = isset($options['prefix']) ? $options['prefix'] : $TABLE_PREFIX;
$params = []; $params = [];
$whereSql = self::buildWhere($where, $params); $whereSql = self::buildWhere($where, $params);
@@ -323,6 +333,8 @@ class AcaiAPI
{ {
global $TABLE_PREFIX; global $TABLE_PREFIX;
if (!is_array($options)) $options = [];
// ── Option defaults ────────────────────────────────────────────── // ── Option defaults ──────────────────────────────────────────────
$defaults = [ $defaults = [
'debug' => false, 'debug' => false,