fix: handle nested _tomas_config format in guardar_toma.php
PHP 8.1+ throws TypeError when using an array as array key.
Old flat-format loop iterated nested { examName: { group: [fids] } }
and tried $allowed[$arrayValue] = true, causing a fatal error and
returning ok:false ("Error al guardar") on every toma signing attempt.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
70077d7fd4
commit
ab8b0702a7
@@ -108,8 +108,16 @@ foreach ($esquema as $campo) {
|
||||
$__tcFirmas = $datosMerge['_tomas_config'] ?? null;
|
||||
if (is_array($__tcFirmas)) {
|
||||
$__allowed = [];
|
||||
foreach ($__tcFirmas as $__g => $__ids) {
|
||||
if (is_array($__ids)) foreach ($__ids as $__id) $__allowed[$__id] = true;
|
||||
foreach ($__tcFirmas as $__v) {
|
||||
if (!is_array($__v)) continue;
|
||||
$__inner = reset($__v);
|
||||
if (is_array($__inner)) {
|
||||
// nested: { examName: { groupKey: [fids] } }
|
||||
foreach ($__v as $__fids) foreach ($__fids as $__f) $__allowed[$__f] = true;
|
||||
} else {
|
||||
// flat: { groupKey: [fids] }
|
||||
foreach ($__v as $__f) $__allowed[$__f] = true;
|
||||
}
|
||||
}
|
||||
$firmasCampos = array_values(array_filter($firmasCampos, fn($f) => isset($__allowed[$f['id']])));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user