PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 6.3.0
Defender Security – Malware Scanner, Login Security & Firewall v6.3.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
← All changes | src/model/class-notification.php +25 -2 6.1.0 → 6.3.0 View file →
@@ -267,9 +267,9 @@
267 267 $est->setTime( $hour, $min, 0 );
268 268 }
269 269 break;
270 270 case 'weekly':
271 - if ( empty( $this->day ) ) {
271 + if ( '' === $this->day || null === $this->day ) {
272 272 break;
273 273 }
274 274 $est->modify( 'this ' . $this->day );
275 275 $est->add( $interval );
@@ -446,8 +446,31 @@
446 446 return $data;
447 447 }
448 448
449 449 /**
450 + * Prepare data for persistence.
451 + *
452 + * Recipients are indexed by email in memory (see after_load()), so re-index them back to
453 + * sequential arrays before storing. Otherwise they are JSON-encoded as objects, which on
454 + * downgrade breaks Defender 5 with "all_subscribers.slice is not a function".
455 + *
456 + * @param array $data The data array to import values from.
457 + *
458 + * @return array
459 + */
460 + protected function prepare_data( $data = array() ): array {
461 + $data = parent::prepare_data( $data );
462 +
463 + foreach ( array( 'in_house_recipients', 'out_house_recipients', 'all_subscribers' ) as $key ) {
464 + if ( isset( $data[ $key ] ) && is_array( $data[ $key ] ) ) {
465 + $data[ $key ] = array_values( $data[ $key ] );
466 + }
467 + }
468 +
469 + return $data;
470 + }
471 +
472 + /**
450 473 * Overrided method to manipulate user details dynamically.
451 474 */
452 475 protected function after_load(): void {
453 476 $in_house_recipients = array();
@@ -482,9 +505,9 @@
482 505 private function get_email_indexed_recipients( array $recipients ): array {
483 506 $email_indexed_recipients = array();
484 507
485 508 foreach ( $recipients as $recipient ) {
486 - if ( empty( $recipient['email'] ) ) {
509 + if ( ! isset( $recipient['email'] ) ) {
487 510 continue;
488 511 }
489 512
490 513 $email = trim( $recipient['email'] );