I am using acf-builder for a theme and I found some issue I cannot explain myself, so hopefully someone here can.
I noticed this warning in my logs:
PHP Warning: array_walk() expects parameter 1 to be array, int given in D:\Bitnami\apache2\htdocs\wp-content\themes\fetcher\vendor\stoutlogic\acf-builder\src\Transform\RecursiveTransform.php on line 43
Hi there,
I am using acf-builder for a theme and I found some issue I cannot explain myself, so hopefully someone here can.
I noticed this warning in my logs:
PHP Warning: array_walk() expects parameter 1 to be array, int given in D:\Bitnami\apache2\htdocs\wp-content\themes\fetcher\vendor\stoutlogic\acf-builder\src\Transform\RecursiveTransform.php on line 43
code to build my fields:
entering that function dumping the input value $config:
I get this in return:
array(2) { [0]=> array(4) { ["type"]=> string(3) "tab" ["name"]=> string(10) "layout_tab" ["label"]=> string(6) "Layout" ["key"]=> string(16) "field_layout_tab" } [1]=> array(13) { ["type"]=> string(10) "true_false" ["name"]=> string(11) "hide_header" ["label"]=> string(11) "Hide header" ["key"]=> string(17) "field_hide_header" ["instructions"]=> string(0) "" ["required"]=> int(0) ["conditional_logic"]=> int(0) ["wrapper"]=> array(3) { ["width"]=> string(0) "" ["class"]=> string(0) "" ["id"]=> string(0) "" } ["message"]=> string(0) "" ["default_value"]=> int(0) ["ui"]=> int(1) ["ui_on_text"]=> string(6) "hidden" ["ui_off_text"]=> string(7) "visible" } }
array(4) { ["type"]=> string(3) "tab" ["name"]=> string(10) "layout_tab" ["label"]=> string(6) "Layout" ["key"]=> string(16) "field_layout_tab" }
array(13) { ["type"]=> string(10) "true_false" ["name"]=> string(11) "hide_header" ["label"]=> string(11) "Hide header" ["key"]=> string(17) "field_hide_header" ["instructions"]=> string(0) "" ["required"]=> int(0) ["conditional_logic"]=> int(0) ["wrapper"]=> array(3) { ["width"]=> string(0) "" ["class"]=> string(0) "" ["id"]=> string(0) "" } ["message"]=> string(0) "" ["default_value"]=> int(0) ["ui"]=> int(1) ["ui_on_text"]=> string(6) "hidden" ["ui_off_text"]=> string(7) "visible" }
int(0)
array(3) { ["width"]=> string(0) "" ["class"]=> string(0) "" ["id"]=> string(0) "" }
array(2) { [0]=> array(4) { ["type"]=> string(3) "tab" ["name"]=> string(10) "layout_tab" ["label"]=> string(6) "Layout" ["key"]=> string(16) "field_layout_tab" } [1]=> array(13) { ["type"]=> string(10) "true_false" ["name"]=> string(11) "hide_header" ["label"]=> string(11) "Hide header" ["key"]=> string(17) "field_hide_header" ["instructions"]=> string(0) "" ["required"]=> int(0) ["conditional_logic"]=> int(0) ["wrapper"]=> array(3) { ["width"]=> string(0) "" ["class"]=> string(0) "" ["id"]=> string(0) "" } ["message"]=> string(0) "" ["default_value"]=> int(0) ["ui"]=> int(1) ["ui_on_text"]=> string(6) "hidden" ["ui_off_text"]=> string(7) "visible" } }
array(4) { ["type"]=> string(3) "tab" ["name"]=> string(10) "layout_tab" ["label"]=> string(6) "Layout" ["key"]=> string(16) "field_layout_tab" }
array(13) { ["type"]=> string(10) "true_false" ["name"]=> string(11) "hide_header" ["label"]=> string(11) "Hide header" ["key"]=> string(17) "field_hide_header" ["instructions"]=> string(0) "" ["required"]=> int(0) ["conditional_logic"]=> int(0) ["wrapper"]=> array(3) { ["width"]=> string(0) "" ["class"]=> string(0) "" ["id"]=> string(0) "" } ["message"]=> string(0) "" ["default_value"]=> int(0) ["ui"]=> int(1) ["ui_on_text"]=> string(6) "hidden" ["ui_off_text"]=> string(7) "visible" }
array(3) { ["width"]=> string(0) "" ["class"]=> string(0) "" ["id"]=> string(0) "" }
Now I am sure a simple is_array would prevent that warning but I am still highly curious where that integer 0 is coming from.
Cheers, Sebo