bookie Posted Monday at 06:44 PM Posted Monday at 06:44 PM A couple days ago I tried migrating my site. Things went relatively smoothly, I installed the processwire site, migrated the database, but now cannot seem to get the ImportPagesCSV module to work. Here is the error I'm receiveing: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in site/modules/ryancramerdesign-ImportPagesCSV-18cd5a6/ImportPagesCSV.module:515 #0 site/modules/ryancramerdesign-ImportPagesCSV-18cd5a6/ImportPagesCSV.module (515): count(NULL) #1 site/modules/ryancramerdesign-ImportPagesCSV-18cd5a6/ImportPagesCSV.module (432): ImportPagesCSV->importPage(Array, Object(InputfieldForm)) #2 site/modules/ryancramerdesign-ImportPagesCSV-18cd5a6/ImportPagesCSV.module (154): ImportPagesCSV->processForm2(Object(InputfieldForm)) #3 wire/core/Wire.php (413): ImportPagesCSV->___executeFields() #4 wire/core/WireHooks.php (968): Wire->_callMethod('___executeField...', Array) #5 wire/core/Wire.php (484): WireHooks->runHooks(Object(ImportPagesCSV), 'executeFields', Array) #6 wire/core/ProcessController.php (361): Wire->__call('executeFields', Array) #7 wire/core/Wire.php (413): ProcessController->___execute() #8 wire/core/WireHooks.php (968): Wire->_callMethod('___execute', Array) #9 wire/core/Wire.php (484): WireHooks->runHooks(Object(ProcessController), 'execute', Array) #10 wire/core/admin.php (174): Wire->__call('execute', Array) #11 wire/modules/AdminTheme/AdminThemeUikit/controller.php (15): require('/home/enusanne/...') #12 site/templates/admin.php (15): require('/home/enusanne/...') #13 wire/core/TemplateFile.php (328): require('/home/enusanne/...') #14 wire/core/Wire.php (413): TemplateFile->___render() #15 wire/core/WireHooks.php (968): Wire->_callMethod('___render', Array) #16 wire/core/Wire.php (484): WireHooks->runHooks(Object(TemplateFile), 'render', Array) #17 wire/modules/PageRender.module (581): Wire->__call('render', Array) #18 wire/core/Wire.php (416): PageRender->___renderPage(Object(HookEvent)) #19 wire/core/WireHooks.php (968): Wire->_callMethod('___renderPage', Array) #20 wire/core/Wire.php (484): WireHooks->runHooks(Object(PageRender), 'renderPage', Array) #21 wire/core/WireHooks.php (1094): Wire->__call('renderPage', Array) #22 wire/core/Wire.php (484): WireHooks->runHooks(Object(Page), 'render', Array) #23 wire/modules/Process/ProcessPageView.module (193): Wire->__call('render', Array) #24 wire/modules/Process/ProcessPageView.module (114): ProcessPageView->renderPage(Object(Page), Object(PagesRequest)) #25 wire/core/Wire.php (416): ProcessPageView->___execute(true) #26 wire/core/WireHooks.php (968): Wire->_callMethod('___execute', Array) #27 wire/core/Wire.php (484): WireHooks->runHooks(Object(ProcessPageView), 'execute', Array) #28 index.php (55): Wire->__call('execute', Array) #29 {main} thrown (line 515 of site/modules/ryancramerdesign-ImportPagesCSV-18cd5a6/ImportPagesCSV.module) I've tested the csv file on the old site and it imports fine. When imported on the new site this error occours, and it appears the first page in the csv is imported only. As far as I can tell the template/field settings are the same between sites. Uninstalling and reinstalling the module didn't help either. This is the context of line 515 // import post-save data, like files if($page->id && count($page->get('ImportPagesCSVData'))) { foreach($page->get('ImportPagesCSVData') as $name => $value) { $page->set($name, $value); } $page->save(); } I don't really know what this is doing so I'm not sure where I need to go to solve the problem.
matjazp Posted Monday at 09:19 PM Posted Monday at 09:19 PM Not tested, but try replacing count() with wireCount() 2 1
bookie Posted Thursday at 08:18 PM Author Posted Thursday at 08:18 PM Of course I should have checked the end of the Module discussion before I asked the question. The error seems to be associated with the move to PHP8. This change worked for me. Replace line 515 with: if($page->id && $page->if('ImportPagesCSVData')) {
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