Skip to content

Commit

Permalink
Update src/Telemetry/Events/Event_Subscriber.php
Browse files Browse the repository at this point in the history
alter the logic in send_events()

Co-authored-by: Matthew Batchelder <[email protected]>
  • Loading branch information
Camwyn and borkweb authored Nov 9, 2023
1 parent 45d76f1 commit 75ff515
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Telemetry/Events/Event_Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ public function send_events() {
// Get the passed event array.
$events = filter_input( INPUT_POST, 'events', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); // phpcs:ignore WordPressVIPMinimum.Security.PHPFilterFunctions.RestrictedFilter

$this->container->get( Event::class )->send_batch( $events ?: [] );
if ( empty( $events ) ) {
return;
}

if ( ! is_array( $events ) ) {

Check failure on line 113 in src/Telemetry/Events/Event_Subscriber.php

View workflow job for this annotation

GitHub Actions / phpstan

Call to function is_array() with non-empty-array<string> will always evaluate to true.
$events = (array) $events;
}

$this->container->get( Event::class )->send_batch( $events );
}
}

0 comments on commit 75ff515

Please sign in to comment.