Closed squareclouds closed 3 years ago
✅
@afbora hey there, I don't know if I'm wrong, but I experienced this again on 3.6.0-alpha.1 ..
@S1SYPHOS 3.5.7.1 with this bug fix got released after the 3.6.0-alpha.1 - so you'll find that fix reflected only in the next alpha.
:+1: That makes it clear, thanks - and sorry for disturbing :confused:
No disturbance, very valid to wonder! :)
Describe the bug
when a layout field (for instance the About Us page in the starter kit) is empty, meaning has no layouts, kirby throws an error. this is obviously pretty bad since when you create a new page all layouts are empty. if you fill other fields first and leave the layouts empty, theres gonna be trouble
To Reproduce
just leave a layouts field empty, could be tested in the about us page in the starterkit
Expected behavior
before 3.5.6 ->toLayouts() delivered an empty array i suppose, so the foreach method just skiped. now toLayouts seems to have some problem when the field is empty.
Screenshots
Kirby Version
3.5.7
Console output
Kirby\Exception\InvalidArgumentException thrown with message "JSON string is invalid"
Stacktrace:
12 Kirby\Exception\InvalidArgumentException in /Users/santiagoduque/Documents/WEBPROJECTS/mamp/junctionlaw/www/kirby/src/Data/Json.php:54
11 Kirby\Data\Json:decode in /Users/santiagoduque/Documents/WEBPROJECTS/mamp/junctionlaw/www/kirby/src/Data/Data.php:84
10 Kirby\Data\Data:decode in /Users/santiagoduque/Documents/WEBPROJECTS/mamp/junctionlaw/www/kirby/config/methods.php:195
9 Kirby\Cms\App:{closure} in /Users/santiagoduque/Documents/WEBPROJECTS/mamp/junctionlaw/www/kirby/src/Cms/Field.php:78
8 Kirby\Cms\Field:__call in /Users/santiagoduque/Documents/WEBPROJECTS/mamp/junctionlaw/www/site/templates/expertisesliders.php:13
7 include in /Users/santiagoduque/Documents/WEBPROJECTS/mamp/junctionlaw/www/kirby/src/Toolkit/F.php:402
6 Kirby\Toolkit\F:loadIsolated in /Users/santiagoduque/Documents/WEBPROJECTS/mamp/junctionlaw/www/kirby/src/Toolkit/F.php:379
5 Kirby\Toolkit\F:load in /Users/santiagoduque/Documents/WEBPROJECTS/mamp/junctionlaw/www/kirby/src/Toolkit/Tpl.php:35
4 Kirby\Toolkit\Tpl:load in /Users/santiagoduque/Documents/WEBPROJECTS/mamp/junctionlaw/www/kirby/src/Cms/Template.php:167
3 Kirby\Cms\Template:render in /Users/santiagoduque/Documents/WEBPROJECTS/mamp/junctionlaw/www/kirby/src/Cms/Page.php:1181
2 Kirby\Cms\Page:render in /Users/santiagoduque/Documents/WEBPROJECTS/mamp/junctionlaw/www/kirby/src/Cms/App.php:687
1 Kirby\Cms\App:io in /Users/santiagoduque/Documents/WEBPROJECTS/mamp/junctionlaw/www/kirby/src/Cms/App.php:1040
0 Kirby\Cms\App:render in /Users/santiagoduque/Documents/WEBPROJECTS/mamp/junctionlaw/www/index.php:5