Needs review
Project:
Four Seasons
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
24 Dec 2011 at 21:36 UTC
Updated:
13 Feb 2012 at 00:33 UTC
I get an error about 1 out of every 6 times I load my site using four seasons that crashes the header image and says:
Undefined offset: -1 in fourseasons_show_banner() (line 143 of sites/all/themes/fourseasons/template.php).
Is there anything I can do to fix this? I have built a great site with this theme, but obviously can't have people greeted with no banner image and an error message. Any advice would be greatly appreciated!
Comments
Comment #1
aiw_2000 commentedI had the same problem. The issue only occurs if you have more than one header image. The code calculating the random image number is incorrect on line 141:
If rand() chooses "0", then $i becomes -1, hence the error reported. The fix is to simply move the "-1" as follows:
The code now works as intended with no errors.
Comment #2
ccentenrun commentedThanks!!! :)