From b78ab4bc9d7714d3282d490278a91c1f0ae44be2 Mon Sep 17 00:00:00 2001 From: Matthew Boynes Date: Mon, 25 Sep 2023 12:17:46 -0400 Subject: [PATCH] Add support for PHP 8.1, 8.2 --- .github/workflows/coding-standards.yml | 2 +- .github/workflows/unit-tests.yml | 4 ++-- lib/class-sp-indexable.php | 4 ++-- lib/class-sp-sync-manager.php | 7 +++++++ 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 413071b..a5309e4 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: true matrix: - php: ['8.0'] + php: ['8.2'] steps: - name: Cancel previous runs of this workflow (pull requests only) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 233766c..62b3db6 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false # do not fail fast, let all the failing tests fail. matrix: - php: [8.0] + php: [8.2] es_version: [7.17.5, 8.10.2] multisite: [0] wp_version: ["latest"] @@ -18,7 +18,7 @@ jobs: es_version: '8.10.2' multisite: 0 wp_version: '5.9.3' - - php: '7.4' + - php: '8.0' es_version: '6.8.23' multisite: 1 wp_version: '5.9.3' diff --git a/lib/class-sp-indexable.php b/lib/class-sp-indexable.php index 9c0fdf2..60f2e7a 100644 --- a/lib/class-sp-indexable.php +++ b/lib/class-sp-indexable.php @@ -84,7 +84,7 @@ public static function cast_meta_types( $value, $types = array() ) { } if ( ( isset( $types['date'] ) || isset( $types['datetime'] ) || isset( $types['time'] ) ) - && strlen( $value ) <= 255 // Limit date/time strings to 255 chars for performance. + && strlen( (string) $value ) <= 255 // Limit date/time strings to 255 chars for performance. ) { $time = false; $int = (int) $value; @@ -93,7 +93,7 @@ public static function cast_meta_types( $value, $types = array() ) { if ( (string) $int === (string) $value ) { $time = $int; } elseif ( ! is_numeric( $value ) ) { - $time = strtotime( $value ); + $time = strtotime( (string) $value ); } if ( false !== $time ) { diff --git a/lib/class-sp-sync-manager.php b/lib/class-sp-sync-manager.php index 58c672d..b9efa06 100644 --- a/lib/class-sp-sync-manager.php +++ b/lib/class-sp-sync-manager.php @@ -28,6 +28,13 @@ class SP_Sync_Manager extends SP_Singleton { */ public $published_posts = false; + /** + * Stores a cache of userdata to speed up indexing. + * + * @var array + */ + public $users = []; + /** * Sync a single post (on creation or update) *