WordPress.org

Make WordPress Core

Opened 5 months ago

Closed 3 months ago

#46627 closed defect (bug) (fixed)

is_new_day uses a weak comparison

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

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 5 months ago.
patch with unit test
46627-just-unit-unit-no-fix.patch (1.0 KB) - added by pbearne 5 months ago.
patch for the unfixed function just unitn test
46627-just-unit-unit-no-fix.2.patch (1021 bytes) - added by pbearne 5 months ago.
fixed version of patch
46627.2.patch (1.4 KB) - added by pbearne 5 months ago.
fixed version of patch

Download all attachments as: .zip

Change History (8)

@pbearne
5 months ago

patch with unit test

@pbearne
5 months ago

patch for the unfixed function just unitn test

#1 @pbearne
5 months 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
5 months ago

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

@pbearne
5 months ago

fixed version of patch

@pbearne
5 months ago

fixed version of patch

#3 @SergeyBiryukov
3 months ago

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

#4 @SergeyBiryukov
3 months ago

  • Resolution set to fixed
  • Status changed from reviewing to 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.