@@ -166,6 +166,8 @@ public static function validateAndParseCraftFile(mixed $craft_file, Command $com
166166 // check libs
167167 if (isset ($ craft ['libs ' ]) && is_string ($ craft ['libs ' ])) {
168168 $ craft ['libs ' ] = array_filter (array_map (fn ($ x ) => trim ($ x ), explode (', ' , $ craft ['libs ' ])));
169+ } elseif (!isset ($ craft ['libs ' ])) {
170+ $ craft ['libs ' ] = [];
169171 }
170172 // check sapi
171173 if (!isset ($ craft ['sapi ' ])) {
@@ -177,6 +179,8 @@ public static function validateAndParseCraftFile(mixed $craft_file, Command $com
177179 // debug as boolean
178180 if (isset ($ craft ['debug ' ])) {
179181 $ craft ['debug ' ] = filter_var ($ craft ['debug ' ], FILTER_VALIDATE_BOOLEAN );
182+ } else {
183+ $ craft ['debug ' ] = false ;
180184 }
181185 // check clean-build
182186 $ craft ['clean-build ' ] ??= false ;
@@ -194,6 +198,8 @@ public static function validateAndParseCraftFile(mixed $craft_file, Command $com
194198 throw new ValidationException ("Craft file build-options {$ key } must be an array " );
195199 }
196200 }
201+ } else {
202+ $ craft ['build-options ' ] = [];
197203 }
198204 // check download options
199205 if (isset ($ craft ['download-options ' ])) {
@@ -209,12 +215,16 @@ public static function validateAndParseCraftFile(mixed $craft_file, Command $com
209215 throw new ValidationException ("Craft file download-options {$ key } must be an array " );
210216 }
211217 }
218+ } else {
219+ $ craft ['download-options ' ] = [];
212220 }
213221 // check extra-env
214222 if (isset ($ craft ['extra-env ' ])) {
215223 if (!is_assoc_array ($ craft ['extra-env ' ])) {
216224 throw new ValidationException ('Craft file extra-env must be an object ' );
217225 }
226+ } else {
227+ $ craft ['extra-env ' ] = [];
218228 }
219229 // check craft-options
220230 $ craft ['craft-options ' ]['doctor ' ] ??= true ;
0 commit comments