Changeset 53791
- Timestamp:
- 07/29/2022 03:32:58 AM (2 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/cron.php
r52236 r53791 120 120 */ 121 121 $crons = _get_cron_array(); 122 if ( ! is_array( $crons ) ) {123 $crons = array();124 }125 122 126 123 $key = md5( serialize( $event->args ) ); … … 307 304 308 305 $crons = _get_cron_array(); 309 if ( ! is_array( $crons ) ) {310 $crons = array();311 }312 306 313 307 $crons[ $event->timestamp ][ $event->hook ][ $key ] = array( … … 1134 1128 1135 1129 $crons = _get_cron_array(); 1136 if ( ! is_array( $crons ) ) {1137 return array();1138 }1139 1130 1140 1131 $gmt_time = microtime( true ); … … 1163 1154 * 1164 1155 * @since 2.1.0 1156 * @since 6.1.0 Return type modified to consistenty return an array. 1165 1157 * @access private 1166 1158 * 1167 * @return array[] |false Array of cron info arrays on success, false on failure.1159 * @return array[] Array of cron events. 1168 1160 */ 1169 1161 function _get_cron_array() { 1170 1162 $cron = get_option( 'cron' ); 1171 1163 if ( ! is_array( $cron ) ) { 1172 return false;1164 return array(); 1173 1165 } 1174 1166 -
trunk/tests/phpunit/tests/admin/wpMediaListTable.php
r51639 r53791 25 25 * @ticket 53949 26 26 * @covers WP_Media_List_Table::prepare_items 27 * @group cron 27 28 */ 28 29 public function test_prepare_items_without_cron_option_does_not_throw_warning() { … … 43 44 44 45 // Verify that the cause of the error is in place. 45 $this->assertFalse( _get_cron_array(), '_get_cron_array() does not return false' ); 46 $this->assertIsArray( _get_cron_array(), '_get_cron_array() does not return an array.' ); 47 $this->assertEmpty( _get_cron_array(), '_get_cron_array() does not return an empty array.' ); 46 48 47 49 // If this test does not error out due to the PHP warning, we're good. -
trunk/tests/phpunit/tests/cron.php
r53573 r53791 131 131 132 132 // Verify that the cause of the error is in place. 133 $this->assertFalse( _get_cron_array(), '_get_cron_array() does not return false' ); 133 $this->assertIsArray( _get_cron_array(), '_get_cron_array() does not return an array.' ); 134 $this->assertEmpty( _get_cron_array(), '_get_cron_array() does not return an empty array.' ); 134 135 135 136 $hook = __FUNCTION__; … … 152 153 153 154 // Verify that the cause of the error is in place. 154 $this->assertFalse( _get_cron_array(), '_get_cron_array() does not return false' ); 155 $this->assertIsArray( _get_cron_array(), '_get_cron_array() does not return an array.' ); 156 $this->assertEmpty( _get_cron_array(), '_get_cron_array() does not return an empty array.' ); 155 157 156 158 $hook = __FUNCTION__;
Note: See TracChangeset
for help on using the changeset viewer.