Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-10589

user_birthday does not use table alias in $leap_year_birthdays variable definition

    Details

    • Type: Bug
    • Status: Unverified Fix
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.10
    • Fix Version/s: 3.0.11-RC1
    • Component/s: Other
    • Labels:
      None

      Description

      See index.php around line 92:

      	if ($now['mday'] == 28 && $now['mon'] == 2 && !$user->format_date(time(), 'L'))
      	{
      		$leap_year_birthdays = " OR user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', 29, 2)) . "%'";
      	}

      Since following SQL query uses 'u' as USERS_TABLE alias, that expression should be adjusted accordingly, otherwise it will bring error on index page when 'if' condition is true. Should be:

      $leap_year_birthdays = " OR u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', 29, 2)) . "%'";

        Activity

        Hide
        naderman Nils Adermann added a comment -

        I imagine that means we will have to release this before february 28th to avoid all boards having a SQL error on the index page that day?

        Show
        naderman Nils Adermann added a comment - I imagine that means we will have to release this before february 28th to avoid all boards having a SQL error on the index page that day?
        Hide
        bantu Andreas Fischer added a comment - - edited

        No, we are lucky, because 2012 is a leap year. This expression won't become true before 28th Feb. of 2013.

        Show
        bantu Andreas Fischer added a comment - - edited No, we are lucky, because 2012 is a leap year. This expression won't become true before 28th Feb. of 2013.
        Hide
        Oleg Oleg [X] (Inactive) added a comment -

        It should not be a problem since user table is only appearing once in that query.

        Show
        Oleg Oleg [X] (Inactive) added a comment - It should not be a problem since user table is only appearing once in that query.
        Hide
        imkingdavid David King added a comment - - edited

        EDIT: Disregard the following (I'm not sure what I was thinking).
        Would it be possible to alter the DBAL to single out the table name and automatically replace phpbb_ with the prefix in use (if not the same)? Kind of like what UMIL does. I'm not suggesting that we start using phpbb_ in the core, but at least that would prevent issues popping up if something like this happens again, until it can be replaced using the table prefix alias.

        Show
        imkingdavid David King added a comment - - edited EDIT: Disregard the following (I'm not sure what I was thinking). Would it be possible to alter the DBAL to single out the table name and automatically replace phpbb_ with the prefix in use (if not the same)? Kind of like what UMIL does. I'm not suggesting that we start using phpbb_ in the core, but at least that would prevent issues popping up if something like this happens again, until it can be replaced using the table prefix alias.
        Hide
        bantu Andreas Fischer added a comment -

        Huh? This has nothing to do with table prefixes, it is about table aliases in queries.

        Show
        bantu Andreas Fischer added a comment - Huh? This has nothing to do with table prefixes, it is about table aliases in queries.
        Hide
        imkingdavid David King added a comment -

        /me inserts foot in mouth

        Sorry, I'm not sure what I was thinking. Please disregard my above comment.

        Show
        imkingdavid David King added a comment - /me inserts foot in mouth Sorry, I'm not sure what I was thinking. Please disregard my above comment.

          People

          • Assignee:
            rxu Ruslan Uzdenov
            Reporter:
            rxu Ruslan Uzdenov
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development