1

Testing an upgrade from 5.13.4 to 5.17.4 on wordpress, I get a fatal error. This is on PHP 7.1.32.

PHP Fatal error:  Uncaught Error: [] operator not supported for strings in /home/dhwpuser/testdomain/wp-content/plugins/civicrm/civicrm/CRM/Upgrade/Incremental/SmartGroups.php:105
Stack trace:
#0 /home/dhwpuser/testdomain/wp-content/plugins/civicrm/civicrm/CRM/Upgrade/Incremental/SmartGroups.php(48): CRM_Upgrade_Incremental_SmartGroups->datePickerConversion(Array)
#1 /home/dhwpuser/testdomain/wp-content/plugins/civicrm/civicrm/CRM/Upgrade/Incremental/Base.php(233): CRM_Upgrade_Incremental_SmartGroups->updateGroups(Array)
#2 /home/dhwpuser/testdomain/wp-content/plugins/civicrm/civicrm/CRM/Queue/Task.php(88): CRM_Upgrade_Incremental_Base::updateSmartGroups(Object(CRM_Queue_TaskContext), Array)
#3 /home/dhwpuser/testdomain/wp-content/plugins/civicrm/civicrm/CRM/Queue/Runner.php(217): CRM_Queue_Task->run(Object(CRM_Queue_TaskContext))
#4 /home/dhwpuser/testdomain/wp-content/plugins/civicrm/civicrm/CRM/Queue/Page/AJAX.php(52): CRM_Queue_Runner->runNext(true)
#5 /home/dhwpuser/testdomain/wp-content/plugins/civicrm/civicrm/CRM/Queue/ in /home/dhwpuser/testdomain/wp-content/plugins/civicrm/civicrm/CRM/Upgrade/Incremental/SmartGroups.php on line 105

This appears to be a well known issue with PHP 7.1. See for example this issue.

  • can you check if cli and apache/nginx are using same php version? – Pradeep Nayak Sep 19 at 22:16
  • Yes same version. – twowheeler Sep 19 at 22:34
  • did this happen on upgrade? I just ran an upgrade from 5.13.5 to 5.17.4 WP 5.3.2 Apache 2.4 and php 7.1.32 and did not hit any issues. – Kevin Cristiano Sep 19 at 23:20
  • 1
    It might not be php version-related, it might be something about some smart groups you have that are different than what the upgrade is expecting. It's hard to say if the upgrade should be expecting them and doesn't handle them, or whether there's something off about the smart group. It's expecting to see the smart group definition stored as an array, but it's getting fed something else. Check any smart groups that use date fields, which is what the failing upgrade is about. – Demerit Sep 20 at 0:45
  • 1
    A quickie to try is something like looking in the database directly SELECT id, form_values FROM civicrm_saved_search WHERE LEFT(form_values,1) <> 'a';. If any results come up then that might be the culprit - compare the id field to the group ids you have listed on the manage groups page in Civi. EDIT: I see recent versions of civi don't show the id anymore on that page. Hover over the Settings link on the right and look at the id= part in the url and that's the id. – Demerit Sep 20 at 2:30
0

Proper define of the array will sort you out, Please check out this Post, this issue is seen with many places after upgrade php.

  • So you are proposing I should edit the code? Not sure that is a good idea, since it seems likely to fail again on the next upgrade. – twowheeler Sep 21 at 12:45
  • yes, just for the check if it will fix and it is common I have seen other places also, so it will fixed in next CiviCRM updates. Form this check atleast you will able to know the exact cause. – Ranjan Sep 22 at 4:37
  • I decided to poke enough error_log() statements into the conversion functions to see what it was choking on. There was in fact a saved search that seemed to be corrupted. It creates a smart group we no longer use. Rather than try to fix it, I deleted that row from the table, and the corresponding row from the civicrm_group table. After that the upgrade completed successfully. This is still all in a test site - I am hoping that there are no unintended consequences of deleting those rows, but will do some more testing before going further. As of now, nothing seems to be broken. – twowheeler Sep 26 at 1:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.