Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#43344 closed defect (bug) (fixed)

$wp_locale->start_of_week is always NULL

Reported by: tonybogdanov's profile tonybogdanov Owned by: ocean90's profile ocean90
Milestone: 5.1 Priority: normal
Severity: minor Version: 4.4
Component: I18N Keywords: has-patch
Focuses: Cc:

Description

It seems that the start_of_week property of class WP_Locale (introduced in version 4.4) always resolves to NULL, because it is never initialized (determined by a quick global search for ->start_of_week).

It also seems like the rest of the codebase only relies on get_option('start_of_week'), including tests, thus nothing is really affected (seemingly) by the bug.

Perhaps someone just forgot to add $this->start_of_week = get_option('start_of_week'); in init()?

Attachments (1)

43344.diff (470 bytes) - added by birgire 7 years ago.

Download all attachments as: .zip

Change History (7)

#1 @tonybogdanov
7 years ago

  • Focuses coding-standards added
  • Keywords dev-feedback added
  • Severity changed from normal to minor

@birgire
7 years ago

#2 @birgire
7 years ago

  • Focuses coding-standards removed
  • Keywords has-patch added
  • Resolution set to invalid
  • Status changed from new to closed

Nice findings @tonybogdanov

I did some digging:

This was introduced in changeset [35336] for the ticket Remove "Week Starts On" setting UI #28344.

That ticket was then closed with a wontfix with new code additions reverted in changeset [35685], but the newly added property definition:

/**
 * Stores the default start of the week.
 *
 * @since 4.4.0
 * @var string
 */
 public $start_of_week;

was not reverted as expected.

So I would suggest to remove it, from the WP_Locale class, as it's not used anywhere and should have been removed in [35685].

This part is removed in 43344.diff.

#3 @birgire
7 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

hmm, I didn't meant to close this as invalid, so I reopen the ticket ;-)

#4 @ocean90
7 years ago

  • Keywords dev-feedback removed
  • Milestone changed from Awaiting Review to 5.0

#5 @ocean90
7 years ago

  • Owner set to ocean90
  • Resolution set to fixed
  • Status changed from reopened to closed

In 42718:

I18N: Remove unused $start_of_week property from WP_Locale.

Missed in [35685], see #28344.

Props birgire, tonybogdanov.
Fixes #43344.

#6 @johnbillion
6 years ago

  • Milestone changed from 5.0 to 5.1
Note: See TracTickets for help on using tickets.