stemalo Posted December 17, 2022 Share Posted December 17, 2022 I installed skyscraper profile and everything went fine. But if I select a skyscraper I get this error below. Anyone knows how to get rid of this or what causes this problem? Many thanks in advance for any help. Fatal Error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in site/templates/includes/skyscraper-page-table.php:35#0 site/templates/includes/skyscraper-page-table.php (35): count(NULL)#1 site/templates/includes/skyscraper-page.php (9): include('/home/webpages/...')#2 wire/core/TemplateFile.php (327): require('/home/webpages/...')#3 wire/core/Wire.php (414): TemplateFile->___render()#4 wire/core/WireHooks.php (951): Wire->_callMethod('___render', Array)#5 wire/core/Wire.php (485): WireHooks->runHooks(Object(TemplateFile), 'render', Array)#6 wire/core/WireFileTools.php (1484): Wire->__call('render', Array)#7 site/templates/skyscraper.php (18): WireFileTools->render('/home/webpages/...', Array)#8 wire/core/TemplateFile.php (327): require('/home/webpages/...')#9 wire/core/Wire.php (414): TemplateFile->___render()#10 wire/core/WireHooks.php (951): Wire->_callMethod('___render', Array)#11 wire/core/Wire.php (485): WireHooks->runHooks(Object(TemplateFile), 'render', Array)#12 wire/modules/PageRender.module (575): Wire->__call('render', Array)#13 wire/core/Wire.php (417): PageRender->___renderPage(Object(HookEvent))#14 wire/core/WireHooks.php (951): Wire->_callMethod('___renderPage', Array)#15 wire/core/Wire.php (485): WireHooks->runHooks(Object(PageRender), 'renderPage', Array)#16 wire/core/WireHooks.php (1059): Wire->__call('renderPage', Array)#17 wire/core/Wire.php (485): WireHooks->runHooks(Object(Page), 'render', Array)#18 wire/modules/Process/ProcessPageView.module (184): Wire->__call('render', Array)#19 wire/modules/Process/ProcessPageView.module (114): ProcessPageView->renderPage(Object(Page), Object(PagesRequest))#20 wire/core/Wire.php (417): ProcessPageView->___execute(true)#21 wire/core/WireHooks.php (951): Wire->_callMethod('___execute', Array)#22 wire/core/Wire.php (485): WireHooks->runHooks(Object(ProcessPageView), 'execute', Array)#23 index.php (55): Wire->__call('execute', Array)#24 {main} thrown (line 35 of site/templates/includes/skyscraper-page-table.php)This error message was shown because: you are logged in as a Superuser. Error has been logged. Link to comment Share on other sites More sharing options...
wbmnfktr Posted December 17, 2022 Share Posted December 17, 2022 Just a guess right now but you might be using an old version that's only working with ProcessWire 2.x. Here is another one Skyscraper profile for ProcessWire 3.x. Link to comment Share on other sites More sharing options...
stemalo Posted December 17, 2022 Author Share Posted December 17, 2022 Thanks for your answer. Just took a look at the readme: "This one is made compatible with ProcessWire 3.x version." Also while installation process, everything went fine. Nothing struggled. Link to comment Share on other sites More sharing options...
stemalo Posted December 17, 2022 Author Share Posted December 17, 2022 I did a fresh reinstall, the third one, but the problem remains. Link to comment Share on other sites More sharing options...
Jan Romero Posted December 17, 2022 Share Posted December 17, 2022 7 hours ago, stemalo said: #0 site/templates/includes/skyscraper-page-table.php (35): count(NULL) If you look at that file, you see that in line 35 it calls the count() function and passes it the variable $architects. From the error message we know that $architects is NULL. Before PHP 8.0 I believe this would have been fine, but now it’s a fatal error. Further up in the same file, the $architects variable is assigned: $architects = $page->get('architect'); $page is the skyscraper you’re trying to view, so it’s trying to get the value of that skyscraper’s field called “architect”. It’s a page reference field for multiple pages. That fieldtype always gives you a PageArray, so even if the skyscraper has no architects you should still get an empty PageArray and not NULL. The fatal error would not occur. So how could $page->get('architect') end up being NULL? The most likely possibility is that the template doesn’t have a field called “architect”. Now if you check out install.sql, it looks like there is only a field called “architects”, which makes sense because it’s a multiple page reference field. So I’d say you’ve found a bug in the site profile. The line I quoted above should say architects instead of architect. 4 Link to comment Share on other sites More sharing options...
stemalo Posted December 18, 2022 Author Share Posted December 18, 2022 Fascinating how you figured that out. That was exactly the problem. Only one letter was missing. Everything now works as it should. Many, many thanks for your help and have a nice day. I am very grateful to you. Kind regards Peter 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now