DekodeInteraktiv / hogan-grid

Card grid module for Hogan
GNU General Public License v3.0
0 stars 0 forks source link

Empty card module error message #35

Closed stian-overasen closed 6 years ago

stian-overasen commented 6 years ago

Adding a empty card module without any card gives this error: Fatal error: Uncaught TypeError: Argument 1 passed to Dekode\Hogan\Grid::structure_card_data() must be of the type array, boolean given, called in /app/public/content/plugins/hogan-grid/class-grid.php on line 295 and defined in /app/public/content/plugins/hogan-grid/class-grid.php:308

Theres a need to validate data at the start of load_args_from_layout_content()

https://github.com/DekodeInteraktiv/hogan-grid/blob/master/class-grid.php#L293

walbo commented 6 years ago

Fixed in #36

stian-overasen commented 6 years ago

I disagree with this change. This contradicts the concept of strict data types. Validating the variable as an array before using the structure_card_data() method would be a ~better~ safer way to go. The method will still fail for any non-array variable that evaluates to not empty.

walbo commented 6 years ago

👍 Can you make a PR on it?

walbo commented 6 years ago

Fixed in #37