Changeset 51916
- Timestamp:
- 10/18/2021 12:51:00 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/cron.php
r51695 r51916 119 119 * are considered duplicates. 120 120 */ 121 $crons = (array) _get_cron_array(); 121 $crons = _get_cron_array(); 122 if ( ! is_array( $crons ) ) { 123 $crons = array(); 124 } 125 122 126 $key = md5( serialize( $event->args ) ); 123 127 $duplicate = false; -
trunk/tests/phpunit/tests/cron.php
r51657 r51916 101 101 } 102 102 103 104 103 /** 105 104 * Tests that a call to wp_schedule_event() on a site without any scheduled events … … 124 123 // Add an event. 125 124 $this->assertTrue( wp_schedule_event( $timestamp, 'daily', $hook ) ); 125 } 126 127 /** 128 * Tests that a call to wp_schedule_single_event() on a site without any scheduled events 129 * does not result in the value "false" being added into the cron array. 130 * 131 * @ticket 53950 132 * 133 * @covers ::wp_schedule_single_event 134 */ 135 function test_wp_schedule_single_event_without_cron_option() { 136 delete_option( 'cron' ); 137 138 // Verify that the cause of the error is in place. 139 $this->assertFalse( _get_cron_array(), '_get_cron_array() does not return false' ); 140 141 $hook = __FUNCTION__; 142 $timestamp = strtotime( '+10 minutes' ); 143 144 // Add an event. 145 $this->assertTrue( wp_schedule_single_event( $timestamp, $hook ), 'Scheduling single event failed' ); 146 147 // Verify that "false" is not a value in the final cron array. 148 $this->assertNotContains( false, get_option( 'cron' ), 'Resulting cron array contains the value "false"' ); 126 149 } 127 150
Note: See TracChangeset
for help on using the changeset viewer.