Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
After updating to the latest 7.x-2.x-dev release from 7.x-2.13, I get these PHP warnings:
Warning: in_array() expects parameter 2 to be array, string given in sharethis_node_view() (line 86 of /sandbox/d7/sites/all/modules/contrib/sharethis/sharethis.module).
Warning: in_array() expects parameter 2 to be array, string given in sharethis_node_view() (line 109 of /sandbox/d7/sites/all/modules/contrib/sharethis/sharethis.module).
The new settings logic from #2050875: ShareThis in a block AND on node(s) expects an array instead of a string. Deploying this update to ~800 sites with this module enabled in a base feature, we can't just go save the settings form, so here is a patch that fixes this with an update hook using the logic added from #2050875: ShareThis in a block AND on node(s). Thanks!
Comment | File | Size | Author |
---|---|---|---|
#5 | interdiff.txt | 957 bytes | navneet0693 |
#4 | fix_php_warnings_caused-2846151-4.patch | 1014 bytes | navneet0693 |
#2 | fix_php_warnings_caused-2846151-2.patch | 1005 bytes | vinmassaro |
Comments
Comment #2
vinmassaro CreditAttribution: vinmassaro commentedComment #3
navneet0693 CreditAttribution: navneet0693 as a volunteer and at QED42 commentedSo earlier, it was
variable_get('sharethis_location', 'content')
in this patch: https://www.drupal.org/node/2050875#comment-11846268.The changes in the patch made it like this:
'content' => 'content',
but code here will update it to:
'0' => 'content'
Comment #4
navneet0693 CreditAttribution: navneet0693 as a volunteer and at QED42 commentedComment #5
navneet0693 CreditAttribution: navneet0693 as a volunteer and at QED42 commentedOh, forgot to add interdiff. Here it is.
Comment #6
navneet0693 CreditAttribution: navneet0693 as a volunteer and at QED42 commentedComment #7
vinmassaro CreditAttribution: vinmassaro commentedPatch works well for me, thanks for updating.
Comment #8
Chris CharltonPatched tested. It helped.
Note: Sites with Domain Access module enabled need to make sure they run the script for all domains, or we update the patch here to detect that module and account for it in the DB update. The easy non-code fix for sites with Domain Access (once this patch is in) is to choose "All Domains" when re-saving the settings from the ShareThis admin screen.
Comment #10
purushotam.rai CreditAttribution: purushotam.rai at QED42 commented