2

I keep getting a error daily for one of my cron jobs:

Cron <site@prefix> /usr/local/bin/php /home/site/public_html/administrator/components/com_civicrm/civicrm/bin/cli.php -s www.site.org -u adminusername -p adminpassword -e job -a execute

The error comes in an email and looks like this:

Warning: array_flip() expects parameter 1 to be array, string given in /home/site/public_html/administrator/components/com_civicrm/civicrm/CRM/Utils/Token.php on line 1470

Warning: array_keys() expects parameter 1 to be array, null given in /home/site/public_html/administrator/components/com_civicrm/civicrm/CRM/Utils/Token.php on line 1471

Warning: array_fill_keys() expects parameter 1 to be array, null given in /home/site/public_html/administrator/components/com_civicrm/civicrm/CRM/Utils/Token.php on line 1471

Fatal error: Unsupported operand types in /home/site/public_html/administrator/components/com_civicrm/civicrm/CRM/Utils/Token.php on line 1472

It appears to be triggering off greetings. I have run the job to update greetings but it appears that this is based on what it expects in the code. Is there something that I need to change in order for the array to get what it expects?

Section of token.php this the error is referring to

1

I'm surprised you were able to get the "Update Greetings" scheduled job to run in cron; the UI specifically disallows enabling that job. Did you turn it directly using SQL? You may want to consider whether you really want that job enabled.

That aside - I'd put this line just above line 1470:

print_r(CRM_Utils_Array::value($key, $greetingToken), TRUE)

And see what you get when you run the cli command manually.

  • I now get the error: Parse error: syntax error, unexpected '$props' (T_VARIABLE) in /home/site/public_html/administrator/components/com_civicrm/civicrm/CRM/Utils/Token.php on line 1471 – Hudson Essex Terraplane Club May 6 '15 at 1:27
  • Did you add a semi-colon to the end of the statement? – Jon G - Megaphone Tech May 6 '15 at 4:13
  • Thanks, after I added the semi-colon I got the same error: Warning: array_flip() expects parameter 1 to be array, string given in /home/site/public_html/administrator/components/com_civicrm/civicrm/CRM/Utils/Token.php on line 1471 Warning: array_keys() expects parameter 1 to be array, null given in /home/site/public_html/administrator/components/com_civicrm/civicrm/CRM/Utils/Token.php on line 1472 – Hudson Essex Terraplane Club May 6 '15 at 21:14
  • Warning: array_fill_keys() expects parameter 1 to be array, null given in /home/site/public_html/administrator/components/com_civicrm/civicrm/CRM/Utils/Token.php on line 1472 Fatal error: Unsupported operand types in /home/site/public_html/administrator/components/com_civicrm/civicrm/CRM/Utils/Token.php on line 1473 – Hudson Essex Terraplane Club May 6 '15 at 21:14
  • Are you running the command outside of cron? If so, I would expect that you would also receive some additional info that you weren't getting before you added that code. – Jon G - Megaphone Tech May 6 '15 at 22:00
0

this bug seems to be related to a bug regarding tokens array structure some lines above. The array is being reduced to only one of it's values. Maybe this will work:

See: https://issues.civicrm.org/jira/browse/CRM-17038

0

I'm also receiving the error: - Fatal error: Unsupported operand types in /home/accountname/public_html/sites/all/modules/civicrm/CRM/Utils/Token.php on line 1472

However, the site is running 4.6.10 so shouldn't it be resolved?

  • If you look at Nielo's comment above, the Jira ticket is closed but the fix is scheduled for 4.7 and we are still on 4.6.10. We just have to wait until January I guess. Until then the patch works. – Hudson Essex Terraplane Club Dec 13 '15 at 21:36
  • Thanks Hudson, I've applied the patch and it does fix the error. – Jon-man Dec 14 '15 at 15:54

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.