Changeset 51619
- Timestamp:
- 08/16/2021 03:22:38 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/cron.php
r50394 r51619 303 303 304 304 $crons = _get_cron_array(); 305 if ( ! is_array( $crons ) ) { 306 $crons = array(); 307 } 308 305 309 $crons[ $event->timestamp ][ $event->hook ][ $key ] = array( 306 310 'schedule' => $event->schedule, … … 1126 1130 1127 1131 $crons = _get_cron_array(); 1128 1129 if ( false === $crons ) { 1132 if ( ! is_array( $crons ) ) { 1130 1133 return array(); 1131 1134 } -
trunk/tests/phpunit/tests/cron.php
r51568 r51619 99 99 100 100 $this->assertSame( $recur, wp_get_schedule( $hook, $args ) ); 101 101 } 102 103 104 /** 105 * Tests that a call to wp_schedule_event() on a site without any scheduled events 106 * does not result in a PHP deprecation warning on PHP 8.1 or higher. 107 * 108 * The warning that we should not see: 109 * `Deprecated: Automatic conversion of false to array is deprecated`. 110 * 111 * @ticket 53635 112 * 113 * @covers ::wp_schedule_event 114 */ 115 function test_wp_schedule_event_without_cron_option_does_not_throw_warning() { 116 delete_option( 'cron' ); 117 118 // Verify that the cause of the error is in place. 119 $this->assertFalse( _get_cron_array(), '_get_cron_array() does not return false' ); 120 121 $hook = __FUNCTION__; 122 $timestamp = strtotime( '+10 minutes' ); 123 124 // Add an event. 125 $this->assertTrue( wp_schedule_event( $timestamp, 'daily', $hook ) ); 102 126 } 103 127
Note: See TracChangeset
for help on using the changeset viewer.