Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#43344 closed defect (bug) (fixed)

$wp_locale->start_of_week is always NULL

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

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 9 years ago.

Download all attachments as: .zip

Change History (7)

#1 @tonybogdanov
9 years ago

  • Focuses coding-standards added
  • Keywords dev-feedback added
  • Severity normal → minor

@birgire
9 years ago

#2 @birgire
9 years ago

  • Focuses coding-standards removed
  • Keywords has-patch added
  • Resolution → invalid
  • Status new → 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
9 years ago

  • Resolution invalid
  • Status closed → reopened

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

#4 @ocean90
9 years ago

  • Keywords dev-feedback removed
  • Milestone Awaiting Review → 5.0

#5 @ocean90
9 years ago

  • Owner set to ocean90
  • Resolution → fixed
  • Status reopened → 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
8 years ago

  • Milestone 5.0 → 5.1
Note: See TracTickets for help on using tickets.