Announcement

Collapse
No announcement yet.

Warning: Invalid argument supplied for foreach() in [path]/index.php on line 147

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    I've tracked this down to a bug in VBulletin and I have a fix for it. However, I can't see how Agg could have seen it in Australia. My analysis of the bug says that it should only happen when your local time zone is more than 12 hours ahead of GMT, which for all practical purposes means in NZ during Daylight Savings Time (GMT+13) and only between midnight and 1am local time. So either I am slightly off on the analysis, or somebody tried to fix it and was partially successful between the 3.7.3pl1 that Agg was running and the 3.7.4pl1 that I just upgraded to from 3.6 at midnight and so saw the bug.

    Or maybe, Agg, did you happen to be in New Zealand when you tested it or for some reason have your user profile options set to NZ time?

    First, the simplest fix, which will eliminate the error message but will not display birthdays during the hour that the bug is being triggered. In the switch statement in index.php just before the line 145 that is mentioned in the error, add a default clause that initializes $birthdayarray to an empty array. The problem is that the code is assuming that today is either what is called day1 (the date at GMT-12) or day2 (the date at GMT+12). But for one hour after midnight in NZ in our summer it is neither of those, it is one day later.
    Code:
    switch ($today)
        {
            case $birthdaystore['day1']:
                $birthdaysarray = $birthdaystore['users1'];
                break;
    
            case $birthdaystore['day2']:
                $birthdaysarray = $birthdaystore['users2'];
                break;
    
            default:
                $birthdaysarray = array();
        }
    The fix of the root cause is in includes/functions_databuild.php in the function build_birthdays(). There you will find several places where the code says
    Code:
    TIMENOW + (-12 - $serveroffset) * 3600
    and
    Code:
    TIMENOW + (12 - $serveroffset) * 3600
    , which is used to find what date it is in the earliest time zone GMT-12 and the latest time zone GMT+12 to see which two days to check for birthdays. The problem is that there are actually 26 hours span of time zones in the world so two days are strictly speaking not enough. However there is no permanent habitation in either GMT-12 nor GMT+14, and only 600 people who are at GMT+13.75 in their summer, so we can get away with using a span of GMT-11 to GMT+13.

    So the fix is to change each -12 is the above code to instead say -11 and change each 12 to say 13.
    Code:
    TIMENOW + (-11 - $serveroffset) * 3600
    and
    Code:
    TIMENOW + (13 - $serveroffset) * 3600
    That should allow birthdays to work for users in New Zealand. The addition of the default line in the switch statement in index.php will prevent any error message even for a user in the Chatham Islands in their summer between 1am and 1:45am, when they will not see birthdays.

    Comment


    • #17
      I've entered this as a bug report and attached a patch at http://www.vbulletin.com/forum/proje...?issueid=27026

      Comment


      • #18
        Thanks heaps for that Sidney

        I'm going to try and do what you said to fix it - hope I don't muck it up

        Comment


        • #19
          Thanks so much for the patch Sidney

          I did it - and it wasn't hard - your instructions were excellent

          Comment

          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
          Working...
          X