From ef53156deb8b250cfad754ce22c0013faa196764 Mon Sep 17 00:00:00 2001 From: leho Date: Wed, 9 Mar 2022 14:54:21 +0200 Subject: [PATCH] Fixup fc606db This reverts commit fc606dbd175b1ce533ea88198f8bf91a78fb1439. We found a more correct location to improve a previously existing sanity check. --- classes/class-db-driver-wpdb.php | 4 +--- classes/class-log.php | 10 ++++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/classes/class-db-driver-wpdb.php b/classes/class-db-driver-wpdb.php index ebe23fb61..49b95a3a1 100755 --- a/classes/class-db-driver-wpdb.php +++ b/classes/class-db-driver-wpdb.php @@ -81,9 +81,7 @@ public function insert_record( $data ) { // Insert record meta. foreach ( (array) $meta as $key => $vals ) { foreach ( (array) $vals as $val ) { - if ( is_scalar( $val ) && '' !== $val ) { - $this->insert_meta( $record_id, $key, $val ); - } + $this->insert_meta( $record_id, $key, $val ); } } diff --git a/classes/class-log.php b/classes/class-log.php index b13b2beb8..34e565c0a 100644 --- a/classes/class-log.php +++ b/classes/class-log.php @@ -110,12 +110,10 @@ public function log( $connector, $message, $args, $object_id, $context, $action, } // Prevent any meta with null values from being logged. - $stream_meta = array_filter( - $args, - function ( $var ) { - return ! is_null( $var ); - } - ); + // + // @see https://www.php.net/manual/en/function.array-filter.php#111091 + $stream_meta = array_filter( $args, 'strlen' ); + $user_meta = array_filter( $user_meta, 'strlen' ); // Add user meta to Stream meta. $stream_meta['user_meta'] = $user_meta;