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.
Notes: "preg_replace() /e modifier is deprecated slideshow_preprocess_views_slideshow()"
Patch to views_slideshow/theme/views_slideshow.theme.inc file as per (starting @ line# 69):
// Loop through all the addons and call their methods if needed.
foreach ($addons as $addon_id => $addon_info) {
foreach ($addon_info['accepts'] as $imp_key => $imp_value) {
if (is_array($imp_value)) {
- $methods[$imp_key][] = preg_replace('/_(.?)/e',"strtoupper('$1')", $addon_id);
+ $methods[$imp_key][] = preg_replace_callback( // php5.x preg_replace_callback() method
+ '/_(.?)/',
+ function ($m) {
+ return strtoupper($m[1]);
+ },
+ $addon_id
+ );
}
else {
- $methods[$imp_value][] = preg_replace('/_(.?)/e',"strtoupper('$1')", $addon_id);
+ $methods[$imp_value][] = preg_replace_callback( // php5.x preg_replace_callback() method
+ '/_(.?)/',
+ function ($m) {
+ return strtoupper($m[1]);
+ },
+ $addon_id
+ );
}
}
}
Comments
Comment #1
VenDG CreditAttribution: VenDG commentedI found that there were four places in this file that needed changing. The two already mentioned and then two more times where preg_replace was used. For me they were around lines 186 + 277.
At 186 and 277 I replaced
with
Comment #2
alexandermeindl CreditAttribution: alexandermeindl commentedI added a patch with all changes.
Comment #3
Marc Angles CreditAttribution: Marc Angles commentedattached a patch that applies on 7.x-3.0 and resolve the issue.
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedPatch from #3 works like a charm for me. Please apply to git repo. Cheers!
Comment #5
@Kambiyaso CreditAttribution: @Kambiyaso commentedHi Marc
On which line does this patch start?
Comment #6
valthebaldPatch from #3 works just fine (tested with PHP5.4 and 5.5)
Comment #7
valthebaldSorry, that was too early. Under PHP 5.2, patched views_slideshow fails with 'Unexpected T_FUNCTION'
Comment #8
scotwith1tpatch worked great for me...thanks! Marc Angles++
Comment #9
xiukun.zhou CreditAttribution: xiukun.zhou commentedThanks Marc Angles, alexandermeindl, Peter Bowey
commit: 1a041a4
Comment #10
valthebaldPatch breaks PHP 5.2 (no anynimous functions support, syntax error).
Comment #11
xiukun.zhou CreditAttribution: xiukun.zhou commentedComment #12
xiukun.zhou CreditAttribution: xiukun.zhou commentedThanks very much valthebald.
i have create a patch to fix the bug. tested by http://sandbox.onlinephpfunctions.com/. work to me
Comment #13
xiukun.zhou CreditAttribution: xiukun.zhou commentedComment #14
valthebaldThere's extra space in the end of line 255, otherwise, patch looks really great
Thanks!
Comment #15
xiukun.zhou CreditAttribution: xiukun.zhou commentedThanks very much valthebald, i have adopted your advise and made some change.
commit:
d9fd60c
Comment #16
xiukun.zhou CreditAttribution: xiukun.zhou commentedOh. sorry,there is an extra space,i will fix it next push
Comment #17
xiukun.zhou CreditAttribution: xiukun.zhou commentedComment #19
ludar CreditAttribution: ludar commented#3测试成功,十分感谢分享
Comment #20
ckosloff CreditAttribution: ckosloff commentedThe latest recommended version solves all these issues.
Thank you.
Comment #21
stephanebourget CreditAttribution: stephanebourget commentedHello, I applie the pacth #3 pacth, it solves a lot of bugs but my slidshow movement dont work, I have one fix slide only. Before my 5 slides are moving...Some one can help me ? Thanks
Comment #22
MichelleTagging this with the master tag for PHP 5.4 upgrade issues. (And cleaning up the unneeded tags while I'm at it.)
Comment #23
MichelleIf you are looking for a D6 fix, see #2512896: PHP 5.4+ compatibility which has this fix plus another one as well.
Comment #24
shaktikPatch from #3 working fine.
Thank you!
Comment #25
enjayLema CreditAttribution: enjayLema commentedplease none of these is working for me what else can i do i need help asap!!!
Comment #26
Michelle@enjayLema - This has already been committed so there is nothing you need to do except make sure you are on the latest version (or possibly the dev if there hasn't been a release since it was committed.)