Skip to content

Commit 09b524d

Browse files
committed
wip
1 parent bdad148 commit 09b524d

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

src/app/Library/CrudPanel/Traits/FieldsProtectedMethods.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,8 @@ protected function makeSureSubfieldsHaveNecessaryAttributes($field)
258258
return $field;
259259
}
260260

261-
if (! is_multidimensional_array($field['subfields'])) {
262-
$field['subfields'] = [$field['subfields']];
261+
if(! is_multidimensional_array($field['subfields'], true)) {
262+
abort(500, 'Subfields of «'.$field['name'].'» are malformed. Make sure you provide an array of subfields');
263263
}
264264

265265
foreach ($field['subfields'] as $key => $subfield) {

src/helpers.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -370,15 +370,20 @@ function old_empty_or_null($key, $empty_value = '')
370370
* @param array $array
371371
* @return bool
372372
*/
373-
function is_multidimensional_array(array $array)
373+
function is_multidimensional_array(array $array, bool $strict = false)
374374
{
375375
foreach ($array as $item) {
376-
if (is_array($item)) {
377-
return true;
376+
if($strict) {
377+
if (! is_array($item)) {
378+
return false;
379+
}
380+
}else{
381+
if (is_array($item)) {
382+
return true;
383+
}
378384
}
379385
}
380-
381-
return false;
386+
return $strict;
382387
}
383388
}
384389

0 commit comments

Comments
 (0)