Make WordPress Core

Opened 8 years ago

Closed 7 years ago

#46627 closed defect (bug) (fixed)

is_new_day uses a weak comparison

Reported by: pbearne Owned by: SergeyBiryukov
Priority: low Milestone: 5.3
Component: Date/Time Version:
Severity: normal Keywords: has-unit-tests dev-feedback has-patch
Cc: Focuses:

Description (last modified by swissspidy)

The is_new_day() function uses != to test I see no reason why we can't change this too !==

So I have added a patch to do this and Unit test to check it

Attachments (4)

46627.patch​ (1.4 KB ) - added by pbearne 8 years ago.
patch with unit test
46627-just-unit-unit-no-fix.patch​ (1.0 KB ) - added by pbearne 8 years ago.
patch for the unfixed function just unitn test
46627-just-unit-unit-no-fix.2.patch​ (1021 bytes ) - added by pbearne 8 years ago.
fixed version of patch
46627.2.patch​ (1.4 KB ) - added by pbearne 8 years ago.
fixed version of patch

Download all attachments as: .zip

Change History (8)

@pbearne
8 years ago

patch with unit test

@pbearne
8 years ago

patch for the unfixed function just unitn test

#1 @pbearne
8 years ago

If it, not felt that we should "fix" the function I have attached a unit test for the current code

part of my ongoing project to add unit tests for all function in functions.php :-)

#2 @swissspidy
8 years ago

  • Description modified (diff)
  • Priority normal → low
  • Summary is_new_day uses a week compare → is_new_day uses a weak comparison

@pbearne
8 years ago

fixed version of patch

#3 @SergeyBiryukov
7 years ago

  • Milestone Awaiting Review → 5.3
  • Owner set to SergeyBiryukov
  • Status new → reviewing

#4 @SergeyBiryukov
7 years ago

  • Resolution → fixed
  • Status reviewing → closed

In 45375:

Date/Time: Use strict comparison in is_new_day(), add a unit test.

Props pbearne.
Fixes #46627.

Note: See TracTickets for help on using tickets.