Commit 5a82c86d00 for wordpress.org

commit 5a82c86d00ca5bd2453fc5a478372ec6642f5fb5
Author: Sergey Biryukov <sergeybiryukov.ru@gmail.com>
Date:   Tue Sep 16 22:47:31 2025 +0000

    External Libraries: Update the SimplePie library to version 1.9.0.

    References:
    * [https://github.com/simplepie/simplepie/releases/tag/1.9.0 SimplePie 1.9.0 release notes]
    * [https://github.com/simplepie/simplepie/compare/1.8.1...1.9.0 Full list of changes in SimplePie 1.9.0]

    Follow-up to [59141], [60490].

    Props swissspidy, TobiasBg, SergeyBiryukov.
    Fixes #63961.
    Built from https://develop.svn.wordpress.org/trunk@60771


    git-svn-id: http://core.svn.wordpress.org/trunk@60107 1a063a9b-81f0-0310-95a4-ce76da25c4cd

diff --git a/wp-includes/SimplePie/autoloader.php b/wp-includes/SimplePie/autoloader.php
index b1635ff15c..4356b456f9 100644
--- a/wp-includes/SimplePie/autoloader.php
+++ b/wp-includes/SimplePie/autoloader.php
@@ -1,46 +1,7 @@
 <?php
-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */

+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause

 /**
  * PSR-4 implementation for SimplePie.
@@ -93,9 +54,6 @@ if (!class_exists('SimplePie'))

 /**
  * Autoloader class
- *
- * @package SimplePie
- * @subpackage API
  */
 class SimplePie_Autoloader
 {
diff --git a/wp-includes/SimplePie/library/SimplePie.php b/wp-includes/SimplePie/library/SimplePie.php
index 14f5380c24..25d1ad146d 100644
--- a/wp-includes/SimplePie/library/SimplePie.php
+++ b/wp-includes/SimplePie/library/SimplePie.php
@@ -1,47 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2017, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @version 1.7.0
- * @copyright 2004-2017 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\SimplePie as NamespacedSimplePie;

@@ -49,6 +11,7 @@ class_exists('SimplePie\SimplePie');

 // @trigger_error(sprintf('Using the "SimplePie" class is deprecated since SimplePie 1.7.0, use "SimplePie\SimplePie" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\SimplePie" instead */
     class SimplePie extends NamespacedSimplePie
diff --git a/wp-includes/SimplePie/library/SimplePie/Author.php b/wp-includes/SimplePie/library/SimplePie/Author.php
index b4b7aaf8d7..77e366c314 100644
--- a/wp-includes/SimplePie/library/SimplePie/Author.php
+++ b/wp-includes/SimplePie/library/SimplePie/Author.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Author;

@@ -48,6 +11,7 @@ class_exists('SimplePie\Author');

 // @trigger_error(sprintf('Using the "SimplePie_Author" class is deprecated since SimplePie 1.7.0, use "SimplePie\Author" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Author" instead */
     class SimplePie_Author extends Author
diff --git a/wp-includes/SimplePie/library/SimplePie/Cache.php b/wp-includes/SimplePie/library/SimplePie/Cache.php
index 6e453d510a..dbbe315308 100644
--- a/wp-includes/SimplePie/library/SimplePie/Cache.php
+++ b/wp-includes/SimplePie/library/SimplePie/Cache.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Cache;

@@ -48,6 +11,7 @@ class_exists('SimplePie\Cache');

 // @trigger_error(sprintf('Using the "SimplePie_Cache" class is deprecated since SimplePie 1.7.0, use "SimplePie\Cache" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Cache" instead */
     class SimplePie_Cache extends Cache
diff --git a/wp-includes/SimplePie/library/SimplePie/Cache/Base.php b/wp-includes/SimplePie/library/SimplePie/Cache/Base.php
index f59928bb8b..6ae16b100a 100644
--- a/wp-includes/SimplePie/library/SimplePie/Cache/Base.php
+++ b/wp-includes/SimplePie/library/SimplePie/Cache/Base.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Cache\Base;

@@ -48,6 +11,7 @@ interface_exists('SimplePie\Cache\Base');

 // @trigger_error(sprintf('Using the "SimplePie_Cache_Base" class is deprecated since SimplePie 1.7.0, use "SimplePie\Cache\Base" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Cache\Base" instead */
     interface SimplePie_Cache_Base extends Base
diff --git a/wp-includes/SimplePie/library/SimplePie/Cache/DB.php b/wp-includes/SimplePie/library/SimplePie/Cache/DB.php
index 0393df331f..d0bd2b0b50 100644
--- a/wp-includes/SimplePie/library/SimplePie/Cache/DB.php
+++ b/wp-includes/SimplePie/library/SimplePie/Cache/DB.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Cache\DB;

@@ -48,6 +11,7 @@ class_exists('SimplePie\Cache\DB');

 // @trigger_error(sprintf('Using the "SimplePie_Cache_DB" class is deprecated since SimplePie 1.7.0, use "SimplePie\Cache\DB" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Cache\DB" instead */
     abstract class SimplePie_Cache_DB extends DB
diff --git a/wp-includes/SimplePie/library/SimplePie/Cache/File.php b/wp-includes/SimplePie/library/SimplePie/Cache/File.php
index 7c224ed388..283ea047a0 100644
--- a/wp-includes/SimplePie/library/SimplePie/Cache/File.php
+++ b/wp-includes/SimplePie/library/SimplePie/Cache/File.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Cache\File;

@@ -48,6 +11,7 @@ class_exists('SimplePie\Cache\File');

 // @trigger_error(sprintf('Using the "SimplePie_Cache_File" class is deprecated since SimplePie 1.7.0, use "SimplePie\Cache\File" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Cache\File" instead */
     class SimplePie_Cache_File extends File
diff --git a/wp-includes/SimplePie/library/SimplePie/Cache/Memcache.php b/wp-includes/SimplePie/library/SimplePie/Cache/Memcache.php
index 3c0cbc6532..71dc65246e 100644
--- a/wp-includes/SimplePie/library/SimplePie/Cache/Memcache.php
+++ b/wp-includes/SimplePie/library/SimplePie/Cache/Memcache.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Cache\Memcache;

@@ -48,6 +11,7 @@ class_exists('SimplePie\Cache\Memcache');

 // @trigger_error(sprintf('Using the "SimplePie_Cache_Memcache" class is deprecated since SimplePie 1.7.0, use "SimplePie\Cache\Memcache" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Cache\Memcache" instead */
     class SimplePie_Cache_Memcache extends Memcache
diff --git a/wp-includes/SimplePie/library/SimplePie/Cache/Memcached.php b/wp-includes/SimplePie/library/SimplePie/Cache/Memcached.php
index ccf68e5927..f43f9d509d 100644
--- a/wp-includes/SimplePie/library/SimplePie/Cache/Memcached.php
+++ b/wp-includes/SimplePie/library/SimplePie/Cache/Memcached.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Cache\Memcached;

@@ -48,6 +11,7 @@ class_exists('SimplePie\Cache\Memcached');

 // @trigger_error(sprintf('Using the "SimplePie_Cache_Memcached" class is deprecated since SimplePie 1.7.0, use "SimplePie\Cache\Memcached" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Cache\Memcached" instead */
     class SimplePie_Cache_Memcached extends Memcached
diff --git a/wp-includes/SimplePie/library/SimplePie/Cache/MySQL.php b/wp-includes/SimplePie/library/SimplePie/Cache/MySQL.php
index 6215e952b4..4b5047b041 100644
--- a/wp-includes/SimplePie/library/SimplePie/Cache/MySQL.php
+++ b/wp-includes/SimplePie/library/SimplePie/Cache/MySQL.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Cache\MySQL;

@@ -48,6 +11,7 @@ class_exists('SimplePie\Cache\MySQL');

 // @trigger_error(sprintf('Using the "SimplePie_Cache_MySQL" class is deprecated since SimplePie 1.7.0, use "SimplePie\Cache\MySQL" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Cache\MySQL" instead */
     class SimplePie_Cache_MySQL extends MySQL
diff --git a/wp-includes/SimplePie/library/SimplePie/Cache/Redis.php b/wp-includes/SimplePie/library/SimplePie/Cache/Redis.php
index 6a96c1e299..aa66212c60 100644
--- a/wp-includes/SimplePie/library/SimplePie/Cache/Redis.php
+++ b/wp-includes/SimplePie/library/SimplePie/Cache/Redis.php
@@ -1,14 +1,9 @@
 <?php

-/**
- * SimplePie Redis Cache Extension
- *
- * @package SimplePie
- * @author Jan Kozak <galvani78@gmail.com>
- * @link http://galvani.cz/
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- * @version 0.2.9
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Cache\Redis;

@@ -16,6 +11,7 @@ class_exists('SimplePie\Cache\Redis');

 // @trigger_error(sprintf('Using the "SimplePie_Cache_Redis" class is deprecated since SimplePie 1.7.0, use "SimplePie\Cache\Redis" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Cache\Redis" instead */
     class SimplePie_Cache_Redis extends Redis
diff --git a/wp-includes/SimplePie/library/SimplePie/Caption.php b/wp-includes/SimplePie/library/SimplePie/Caption.php
index 1f3a475c87..0162101e76 100644
--- a/wp-includes/SimplePie/library/SimplePie/Caption.php
+++ b/wp-includes/SimplePie/library/SimplePie/Caption.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Caption;

@@ -48,6 +11,7 @@ class_exists('SimplePie\Caption');

 // @trigger_error(sprintf('Using the "SimplePie_Caption" class is deprecated since SimplePie 1.7.0, use "SimplePie\Caption" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Caption" instead */
     class SimplePie_Caption extends Caption
diff --git a/wp-includes/SimplePie/library/SimplePie/Category.php b/wp-includes/SimplePie/library/SimplePie/Category.php
index fad39f069f..f98f13ff40 100644
--- a/wp-includes/SimplePie/library/SimplePie/Category.php
+++ b/wp-includes/SimplePie/library/SimplePie/Category.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Category;

@@ -48,6 +11,7 @@ class_exists('SimplePie\Category');

 // @trigger_error(sprintf('Using the "SimplePie_Category" class is deprecated since SimplePie 1.7.0, use "SimplePie\Category" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Category" instead */
     class SimplePie_Category extends Category
diff --git a/wp-includes/SimplePie/library/SimplePie/Content/Type/Sniffer.php b/wp-includes/SimplePie/library/SimplePie/Content/Type/Sniffer.php
index dc30fc8c8f..537c4cd63d 100644
--- a/wp-includes/SimplePie/library/SimplePie/Content/Type/Sniffer.php
+++ b/wp-includes/SimplePie/library/SimplePie/Content/Type/Sniffer.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Content\Type\Sniffer;

@@ -48,6 +11,7 @@ class_exists('SimplePie\Content\Type\Sniffer');

 // @trigger_error(sprintf('Using the "SimplePie_Content_Type_Sniffer" class is deprecated since SimplePie 1.7.0, use "SimplePie\Content\Type\Sniffer" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Content\Type\Sniffer" instead */
     class SimplePie_Content_Type_Sniffer extends Sniffer
diff --git a/wp-includes/SimplePie/library/SimplePie/Copyright.php b/wp-includes/SimplePie/library/SimplePie/Copyright.php
index dcb2d4a836..7fdf0d2bda 100644
--- a/wp-includes/SimplePie/library/SimplePie/Copyright.php
+++ b/wp-includes/SimplePie/library/SimplePie/Copyright.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Copyright;

@@ -48,6 +11,7 @@ class_exists('SimplePie\Copyright');

 // @trigger_error(sprintf('Using the "SimplePie_Copyright" class is deprecated since SimplePie 1.7.0, use "SimplePie\Copyright" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Copyright" instead */
     class SimplePie_Copyright extends Copyright
diff --git a/wp-includes/SimplePie/library/SimplePie/Core.php b/wp-includes/SimplePie/library/SimplePie/Core.php
index 5abf38a0a8..55bdece2fa 100644
--- a/wp-includes/SimplePie/library/SimplePie/Core.php
+++ b/wp-includes/SimplePie/library/SimplePie/Core.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 /**
  * SimplePie class.
@@ -48,8 +11,6 @@
  * Class for backward compatibility.
  *
  * @deprecated Use {@see SimplePie} directly
- * @package SimplePie
- * @subpackage API
  */
 class SimplePie_Core extends SimplePie
 {
diff --git a/wp-includes/SimplePie/library/SimplePie/Credit.php b/wp-includes/SimplePie/library/SimplePie/Credit.php
index b88c3f484d..1986e16523 100644
--- a/wp-includes/SimplePie/library/SimplePie/Credit.php
+++ b/wp-includes/SimplePie/library/SimplePie/Credit.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Credit;

@@ -48,6 +11,7 @@ class_exists('SimplePie\Credit');

 // @trigger_error(sprintf('Using the "SimplePie_Credit" class is deprecated since SimplePie 1.7.0, use "SimplePie\Credit" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Credit" instead */
     class SimplePie_Credit extends Credit
diff --git a/wp-includes/SimplePie/library/SimplePie/Decode/HTML/Entities.php b/wp-includes/SimplePie/library/SimplePie/Decode/HTML/Entities.php
index dba7688ea5..3366526a5d 100644
--- a/wp-includes/SimplePie/library/SimplePie/Decode/HTML/Entities.php
+++ b/wp-includes/SimplePie/library/SimplePie/Decode/HTML/Entities.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);


 /**
@@ -49,7 +12,6 @@
  * This implements HTML5 as of revision 967 (2007-06-28)
  *
  * @deprecated Use DOMDocument instead!
- * @package SimplePie
  */
 class SimplePie_Decode_HTML_Entities
 {
@@ -83,7 +45,7 @@ class SimplePie_Decode_HTML_Entities
      * @access public
      * @param string $data Input data
      */
-    public function __construct($data)
+    public function __construct(string $data)
     {
         $this->data = $data;
     }
@@ -96,7 +58,8 @@ class SimplePie_Decode_HTML_Entities
      */
     public function parse()
     {
-        while (($this->position = strpos($this->data, '&', $this->position)) !== false) {
+        while (($position = strpos($this->data, '&', $this->position)) !== false) {
+            $this->position = $position;
             $this->consume();
             $this->entity();
             $this->consumed = '';
@@ -108,7 +71,7 @@ class SimplePie_Decode_HTML_Entities
      * Consume the next byte
      *
      * @access private
-     * @return mixed The next byte, or false, if there is no more data
+     * @return string|false The next byte, or false, if there is no more data
      */
     public function consume()
     {
@@ -125,9 +88,9 @@ class SimplePie_Decode_HTML_Entities
      *
      * @access private
      * @param string $chars Characters to consume
-     * @return mixed A series of characters that match the range, or false
+     * @return string|false A series of characters that match the range, or false
      */
-    public function consume_range($chars)
+    public function consume_range(string $chars)
     {
         if ($len = strspn($this->data, $chars, $this->position)) {
             $data = substr($this->data, $this->position, $len);
@@ -143,6 +106,7 @@ class SimplePie_Decode_HTML_Entities
      * Unconsume one byte
      *
      * @access private
+     * @return void
      */
     public function unconsume()
     {
@@ -154,6 +118,7 @@ class SimplePie_Decode_HTML_Entities
      * Decode an entity
      *
      * @access private
+     * @return void
      */
     public function entity()
     {
@@ -187,9 +152,13 @@ class SimplePie_Decode_HTML_Entities
                     static $windows_1252_specials = [0x0D => "\x0A", 0x80 => "\xE2\x82\xAC", 0x81 => "\xEF\xBF\xBD", 0x82 => "\xE2\x80\x9A", 0x83 => "\xC6\x92", 0x84 => "\xE2\x80\x9E", 0x85 => "\xE2\x80\xA6", 0x86 => "\xE2\x80\xA0", 0x87 => "\xE2\x80\xA1", 0x88 => "\xCB\x86", 0x89 => "\xE2\x80\xB0", 0x8A => "\xC5\xA0", 0x8B => "\xE2\x80\xB9", 0x8C => "\xC5\x92", 0x8D => "\xEF\xBF\xBD", 0x8E => "\xC5\xBD", 0x8F => "\xEF\xBF\xBD", 0x90 => "\xEF\xBF\xBD", 0x91 => "\xE2\x80\x98", 0x92 => "\xE2\x80\x99", 0x93 => "\xE2\x80\x9C", 0x94 => "\xE2\x80\x9D", 0x95 => "\xE2\x80\xA2", 0x96 => "\xE2\x80\x93", 0x97 => "\xE2\x80\x94", 0x98 => "\xCB\x9C", 0x99 => "\xE2\x84\xA2", 0x9A => "\xC5\xA1", 0x9B => "\xE2\x80\xBA", 0x9C => "\xC5\x93", 0x9D => "\xEF\xBF\xBD", 0x9E => "\xC5\xBE", 0x9F => "\xC5\xB8"];

                     if ($hex) {
-                        $codepoint = hexdec($codepoint);
+                        // Cap to PHP_INT_MAX to ensure consistent behaviour if $codepoint is so large
+                        // it cannot fit into int – just casting float to int might return junk (e.g. a negative number).
+                        // If it is so large, `Misc::codepoint_to_utf8` will just return a replacement character.
+                        $codepoint = (int) min(hexdec($codepoint), \PHP_INT_MAX);
                     } else {
-                        $codepoint = intval($codepoint);
+                        // Casting string to int caps at PHP_INT_MAX automatically.
+                        $codepoint = (int) $codepoint;
                     }

                     if (isset($windows_1252_specials[$codepoint])) {
@@ -579,7 +548,9 @@ class SimplePie_Decode_HTML_Entities
                 ];

                 for ($i = 0, $match = null; $i < 9 && $this->consume() !== false; $i++) {
-                    $consumed = substr($this->consumed, 1);
+                    // Cast for PHPStan on PHP < 8.0: We consumed as per the loop condition,
+                    // so `$this->consumed` is non-empty and the substr offset is valid.
+                    $consumed = (string) substr($this->consumed, 1);
                     if (isset($entities[$consumed])) {
                         $match = $consumed;
                     }
diff --git a/wp-includes/SimplePie/library/SimplePie/Enclosure.php b/wp-includes/SimplePie/library/SimplePie/Enclosure.php
index 51e75d3d5e..dd3740ddb8 100644
--- a/wp-includes/SimplePie/library/SimplePie/Enclosure.php
+++ b/wp-includes/SimplePie/library/SimplePie/Enclosure.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Enclosure;

@@ -48,6 +11,7 @@ class_exists('SimplePie\Enclosure');

 // @trigger_error(sprintf('Using the "SimplePie_Enclosure" class is deprecated since SimplePie 1.7.0, use "SimplePie\Enclosure" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Enclosure" instead */
     class SimplePie_Enclosure extends Enclosure
diff --git a/wp-includes/SimplePie/library/SimplePie/Exception.php b/wp-includes/SimplePie/library/SimplePie/Exception.php
index 5a2a600cb2..7c9df9cdf0 100644
--- a/wp-includes/SimplePie/library/SimplePie/Exception.php
+++ b/wp-includes/SimplePie/library/SimplePie/Exception.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Exception as SimplePieException;

@@ -48,6 +11,7 @@ class_exists('SimplePie\Exception');

 // @trigger_error(sprintf('Using the "SimplePie_Exception" class is deprecated since SimplePie 1.7.0, use "SimplePie\Exception" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Exception" instead */
     class SimplePie_Exception extends SimplePieException
diff --git a/wp-includes/SimplePie/library/SimplePie/File.php b/wp-includes/SimplePie/library/SimplePie/File.php
index 803080dd91..3955d3de03 100644
--- a/wp-includes/SimplePie/library/SimplePie/File.php
+++ b/wp-includes/SimplePie/library/SimplePie/File.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\File;

@@ -48,6 +11,7 @@ class_exists('SimplePie\File');

 // @trigger_error(sprintf('Using the "SimplePie_File" class is deprecated since SimplePie 1.7.0, use "SimplePie\File" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\File" instead */
     class SimplePie_File extends File
diff --git a/wp-includes/SimplePie/library/SimplePie/HTTP/Parser.php b/wp-includes/SimplePie/library/SimplePie/HTTP/Parser.php
index d701315913..fa218f440e 100644
--- a/wp-includes/SimplePie/library/SimplePie/HTTP/Parser.php
+++ b/wp-includes/SimplePie/library/SimplePie/HTTP/Parser.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\HTTP\Parser;

@@ -48,8 +11,13 @@ class_exists('SimplePie\HTTP\Parser');

 // @trigger_error(sprintf('Using the "SimplePie_HTTP_Parser" class is deprecated since SimplePie 1.7.0, use "SimplePie\HTTP\Parser" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
-    /** @deprecated since SimplePie 1.7.0, use "SimplePie\HTTP\Parser" instead */
+    /**
+     * @deprecated since SimplePie 1.7.0, use "SimplePie\HTTP\Parser" instead
+     * @template Psr7Compatible of bool
+     * @extends Parser<Psr7Compatible>
+     */
     class SimplePie_HTTP_Parser extends Parser
     {
     }
diff --git a/wp-includes/SimplePie/library/SimplePie/IRI.php b/wp-includes/SimplePie/library/SimplePie/IRI.php
index b947d63bf5..7b1e81e2ae 100644
--- a/wp-includes/SimplePie/library/SimplePie/IRI.php
+++ b/wp-includes/SimplePie/library/SimplePie/IRI.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\IRI;

@@ -48,6 +11,7 @@ class_exists('SimplePie\IRI');

 // @trigger_error(sprintf('Using the "SimplePie_IRI" class is deprecated since SimplePie 1.7.0, use "SimplePie\IRI" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\IRI" instead */
     class SimplePie_IRI extends IRI
diff --git a/wp-includes/SimplePie/library/SimplePie/Item.php b/wp-includes/SimplePie/library/SimplePie/Item.php
index b0d7820b95..23e8278227 100644
--- a/wp-includes/SimplePie/library/SimplePie/Item.php
+++ b/wp-includes/SimplePie/library/SimplePie/Item.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Item;

@@ -48,6 +11,7 @@ class_exists('SimplePie\Item');

 // @trigger_error(sprintf('Using the "SimplePie_Item" class is deprecated since SimplePie 1.7.0, use "SimplePie\Item" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Item" instead */
     class SimplePie_Item extends Item
diff --git a/wp-includes/SimplePie/library/SimplePie/Locator.php b/wp-includes/SimplePie/library/SimplePie/Locator.php
index e975851e4c..3f9444af64 100644
--- a/wp-includes/SimplePie/library/SimplePie/Locator.php
+++ b/wp-includes/SimplePie/library/SimplePie/Locator.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Locator;

@@ -48,6 +11,7 @@ class_exists('SimplePie\Locator');

 // @trigger_error(sprintf('Using the "SimplePie_Locator" class is deprecated since SimplePie 1.7.0, use "SimplePie\Locator" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Locator" instead */
     class SimplePie_Locator extends Locator
diff --git a/wp-includes/SimplePie/library/SimplePie/Misc.php b/wp-includes/SimplePie/library/SimplePie/Misc.php
index 5f33c3406e..43b1e9cf85 100644
--- a/wp-includes/SimplePie/library/SimplePie/Misc.php
+++ b/wp-includes/SimplePie/library/SimplePie/Misc.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Misc;

@@ -48,6 +11,7 @@ class_exists('SimplePie\Misc');

 // @trigger_error(sprintf('Using the "SimplePie_Misc" class is deprecated since SimplePie 1.7.0, use "SimplePie\Misc" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Misc" instead */
     class SimplePie_Misc extends Misc
diff --git a/wp-includes/SimplePie/library/SimplePie/Net/IPv6.php b/wp-includes/SimplePie/library/SimplePie/Net/IPv6.php
index f8b4023436..09ddd5a87c 100644
--- a/wp-includes/SimplePie/library/SimplePie/Net/IPv6.php
+++ b/wp-includes/SimplePie/library/SimplePie/Net/IPv6.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Net\IPv6;

@@ -48,6 +11,7 @@ class_exists('SimplePie\Net\IPv6');

 // @trigger_error(sprintf('Using the "SimplePie_Net_IPv6" class is deprecated since SimplePie 1.7.0, use "SimplePie\Net\IPv6" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Net\IPv6" instead */
     class SimplePie_Net_IPv6 extends IPv6
diff --git a/wp-includes/SimplePie/library/SimplePie/Parse/Date.php b/wp-includes/SimplePie/library/SimplePie/Parse/Date.php
index da1033b0c3..469a939707 100644
--- a/wp-includes/SimplePie/library/SimplePie/Parse/Date.php
+++ b/wp-includes/SimplePie/library/SimplePie/Parse/Date.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Parse\Date;

@@ -48,6 +11,7 @@ class_exists('SimplePie\Parse\Date');

 // @trigger_error(sprintf('Using the "SimplePie_Parse_Date" class is deprecated since SimplePie 1.7.0, use "SimplePie\Parse\Date" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Parse\Date" instead */
     class SimplePie_Parse_Date extends Date
diff --git a/wp-includes/SimplePie/library/SimplePie/Parser.php b/wp-includes/SimplePie/library/SimplePie/Parser.php
index e281e107e8..b703219b86 100644
--- a/wp-includes/SimplePie/library/SimplePie/Parser.php
+++ b/wp-includes/SimplePie/library/SimplePie/Parser.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Parser;

@@ -48,6 +11,7 @@ class_exists('SimplePie\Parser');

 // @trigger_error(sprintf('Using the "SimplePie_Parser" class is deprecated since SimplePie 1.7.0, use "SimplePie\Parser" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Parser" instead */
     class SimplePie_Parser extends Parser
diff --git a/wp-includes/SimplePie/library/SimplePie/Rating.php b/wp-includes/SimplePie/library/SimplePie/Rating.php
index 00d99492f5..7ddb0d1553 100644
--- a/wp-includes/SimplePie/library/SimplePie/Rating.php
+++ b/wp-includes/SimplePie/library/SimplePie/Rating.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Rating;

@@ -48,6 +11,7 @@ class_exists('SimplePie\Rating');

 // @trigger_error(sprintf('Using the "SimplePie_Rating" class is deprecated since SimplePie 1.7.0, use "SimplePie\Rating" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Rating" instead */
     class SimplePie_Rating extends Rating
diff --git a/wp-includes/SimplePie/library/SimplePie/Registry.php b/wp-includes/SimplePie/library/SimplePie/Registry.php
index 6788c06147..bc3edd0976 100644
--- a/wp-includes/SimplePie/library/SimplePie/Registry.php
+++ b/wp-includes/SimplePie/library/SimplePie/Registry.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Registry;

@@ -48,6 +11,7 @@ class_exists('SimplePie\Registry');

 // @trigger_error(sprintf('Using the "SimplePie_Registry" class is deprecated since SimplePie 1.7.0, use "SimplePie\Registry" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Registry" instead */
     class SimplePie_Registry extends Registry
diff --git a/wp-includes/SimplePie/library/SimplePie/Restriction.php b/wp-includes/SimplePie/library/SimplePie/Restriction.php
index 566dee29c5..c40fd7d63c 100644
--- a/wp-includes/SimplePie/library/SimplePie/Restriction.php
+++ b/wp-includes/SimplePie/library/SimplePie/Restriction.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Restriction;

@@ -48,6 +11,7 @@ class_exists('SimplePie\Restriction');

 // @trigger_error(sprintf('Using the "SimplePie_Restriction" class is deprecated since SimplePie 1.7.0, use "SimplePie\Restriction" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Restriction" instead */
     class SimplePie_Restriction extends Restriction
diff --git a/wp-includes/SimplePie/library/SimplePie/Sanitize.php b/wp-includes/SimplePie/library/SimplePie/Sanitize.php
index 849edb4721..26d6da80c8 100644
--- a/wp-includes/SimplePie/library/SimplePie/Sanitize.php
+++ b/wp-includes/SimplePie/library/SimplePie/Sanitize.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Sanitize;

@@ -48,6 +11,7 @@ class_exists('SimplePie\Sanitize');

 // @trigger_error(sprintf('Using the "SimplePie_Sanitize" class is deprecated since SimplePie 1.7.0, use "SimplePie\Sanitize" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Sanitize" instead */
     class SimplePie_Sanitize extends Sanitize
diff --git a/wp-includes/SimplePie/library/SimplePie/Source.php b/wp-includes/SimplePie/library/SimplePie/Source.php
index 24b0f7c466..0850d62499 100644
--- a/wp-includes/SimplePie/library/SimplePie/Source.php
+++ b/wp-includes/SimplePie/library/SimplePie/Source.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Source;

@@ -48,6 +11,7 @@ class_exists('SimplePie\Source');

 // @trigger_error(sprintf('Using the "SimplePie_Source" class is deprecated since SimplePie 1.7.0, use "SimplePie\Source" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Source" instead */
     class SimplePie_Source extends Source
diff --git a/wp-includes/SimplePie/library/SimplePie/XML/Declaration/Parser.php b/wp-includes/SimplePie/library/SimplePie/XML/Declaration/Parser.php
index 7ccc731788..8b3c2a2123 100644
--- a/wp-includes/SimplePie/library/SimplePie/XML/Declaration/Parser.php
+++ b/wp-includes/SimplePie/library/SimplePie/XML/Declaration/Parser.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\XML\Declaration\Parser;

@@ -48,6 +11,7 @@ class_exists('SimplePie\XML\Declaration\Parser');

 // @trigger_error(sprintf('Using the "SimplePie_XML_Declaration_Parser" class is deprecated since SimplePie 1.7.0, use "SimplePie\XML\Declaration\Parser" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\XML\Declaration\Parser" instead */
     class SimplePie_XML_Declaration_Parser extends Parser
diff --git a/wp-includes/SimplePie/library/SimplePie/gzdecode.php b/wp-includes/SimplePie/library/SimplePie/gzdecode.php
index c428194b75..3d8a7dbdf3 100644
--- a/wp-includes/SimplePie/library/SimplePie/gzdecode.php
+++ b/wp-includes/SimplePie/library/SimplePie/gzdecode.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 use SimplePie\Gzdecode;

@@ -48,6 +11,7 @@ class_exists('SimplePie\Gzdecode');

 // @trigger_error(sprintf('Using the "SimplePie_gzdecode" class is deprecated since SimplePie 1.7.0, use "SimplePie\Gzdecode" instead.'), \E_USER_DEPRECATED);

+/** @phpstan-ignore-next-line */
 if (\false) {
     /** @deprecated since SimplePie 1.7.0, use "SimplePie\Gzdecode" instead */
     class SimplePie_gzdecode extends Gzdecode
diff --git a/wp-includes/SimplePie/src/Author.php b/wp-includes/SimplePie/src/Author.php
index 2cb7ad9ed0..1ac55589f7 100644
--- a/wp-includes/SimplePie/src/Author.php
+++ b/wp-includes/SimplePie/src/Author.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie;

@@ -50,16 +13,13 @@ namespace SimplePie;
  * Used by {@see Item::get_author()} and {@see SimplePie::get_authors()}
  *
  * This class can be overloaded with {@see SimplePie::set_author_class()}
- *
- * @package SimplePie
- * @subpackage API
  */
 class Author
 {
     /**
      * Author's name
      *
-     * @var string
+     * @var ?string
      * @see get_name()
      */
     public $name;
@@ -67,7 +27,7 @@ class Author
     /**
      * Author's link
      *
-     * @var string
+     * @var ?string
      * @see get_link()
      */
     public $link;
@@ -75,20 +35,19 @@ class Author
     /**
      * Author's email address
      *
-     * @var string
+     * @var ?string
      * @see get_email()
      */
     public $email;

     /**
      * Constructor, used to input the data
-     *
-     * @param string $name
-     * @param string $link
-     * @param string $email
      */
-    public function __construct($name = null, $link = null, $email = null)
-    {
+    public function __construct(
+        ?string $name = null,
+        ?string $link = null,
+        ?string $email = null
+    ) {
         $this->name = $name;
         $this->link = $link;
         $this->email = $email;
diff --git a/wp-includes/SimplePie/src/Cache.php b/wp-includes/SimplePie/src/Cache.php
index 8ed7038b49..587fb1522e 100644
--- a/wp-includes/SimplePie/src/Cache.php
+++ b/wp-includes/SimplePie/src/Cache.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie;

@@ -53,8 +16,6 @@ use SimplePie\Cache\Base;
  * although the preferred way is to create your own handler
  * via {@see register()}
  *
- * @package SimplePie
- * @subpackage Caching
  * @deprecated since SimplePie 1.8.0, use "SimplePie\SimplePie::set_cache()" instead
  */
 class Cache
@@ -64,13 +25,13 @@ class Cache
      *
      * These receive 3 parameters to their constructor, as documented in
      * {@see register()}
-     * @var array
+     * @var array<string, class-string<Base>>
      */
     protected static $handlers = [
-        'mysql'     => 'SimplePie\Cache\MySQL',
-        'memcache'  => 'SimplePie\Cache\Memcache',
-        'memcached' => 'SimplePie\Cache\Memcached',
-        'redis'     => 'SimplePie\Cache\Redis'
+        'mysql'     => Cache\MySQL::class,
+        'memcache'  => Cache\Memcache::class,
+        'memcached' => Cache\Memcached::class,
+        'redis'     => Cache\Redis::class,
     ];

     /**
@@ -88,7 +49,7 @@ class Cache
      * @param Base::TYPE_FEED|Base::TYPE_IMAGE $extension 'spi' or 'spc'
      * @return Base Type of object depends on scheme of `$location`
      */
-    public static function get_handler($location, $filename, $extension)
+    public static function get_handler(string $location, string $filename, $extension)
     {
         $type = explode(':', $location, 2);
         $type = $type[0];
@@ -104,8 +65,12 @@ class Cache
      * Create a new SimplePie\Cache object
      *
      * @deprecated since SimplePie 1.3.1, use {@see get_handler()} instead
+     * @param string $location
+     * @param string $filename
+     * @param Base::TYPE_FEED|Base::TYPE_IMAGE $extension
+     * @return Base
      */
-    public function create($location, $filename, $extension)
+    public function create(string $location, string $filename, $extension)
     {
         trigger_error('Cache::create() has been replaced with Cache::get_handler() since SimplePie 1.3.1, use the registry system instead.', \E_USER_DEPRECATED);

@@ -117,8 +82,9 @@ class Cache
      *
      * @param string $type DSN type to register for
      * @param class-string<Base> $class Name of handler class. Must implement Base
+     * @return void
      */
-    public static function register($type, $class)
+    public static function register(string $type, $class)
     {
         self::$handlers[$type] = $class;
     }
@@ -127,12 +93,17 @@ class Cache
      * Parse a URL into an array
      *
      * @param string $url
-     * @return array
+     * @return array<string, mixed>
      */
-    public static function parse_URL($url)
+    public static function parse_URL(string $url)
     {
-        $params = parse_url($url);
-        $params['extras'] = [];
+        $parsedUrl = parse_url($url);
+
+        if ($parsedUrl === false) {
+            return [];
+        }
+
+        $params = array_merge($parsedUrl, ['extras' => []]);
         if (isset($params['query'])) {
             parse_str($params['query'], $params['extras']);
         }
diff --git a/wp-includes/SimplePie/src/Cache/Base.php b/wp-includes/SimplePie/src/Cache/Base.php
index 674fe8c10e..7d6747a0bd 100644
--- a/wp-includes/SimplePie/src/Cache/Base.php
+++ b/wp-includes/SimplePie/src/Cache/Base.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie\Cache;

@@ -50,8 +13,6 @@ namespace SimplePie\Cache;
  * Classes to be used with {@see \SimplePie\Cache::register()} are expected
  * to implement this interface.
  *
- * @package SimplePie
- * @subpackage Caching
  * @deprecated since SimplePie 1.8.0, use "Psr\SimpleCache\CacheInterface" instead
  */
 interface Base
@@ -77,12 +38,12 @@ interface Base
      * @param string $name Unique ID for the cache
      * @param Base::TYPE_FEED|Base::TYPE_IMAGE $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data
      */
-    public function __construct($location, $name, $type);
+    public function __construct(string $location, string $name, $type);

     /**
      * Save data to the cache
      *
-     * @param array|\SimplePie\SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property
+     * @param array<mixed>|\SimplePie\SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property
      * @return bool Successfulness
      */
     public function save($data);
@@ -90,7 +51,7 @@ interface Base
     /**
      * Retrieve the data saved to the cache
      *
-     * @return array Data for SimplePie::$data
+     * @return array<mixed> Data for SimplePie::$data
      */
     public function load();

diff --git a/wp-includes/SimplePie/src/Cache/BaseDataCache.php b/wp-includes/SimplePie/src/Cache/BaseDataCache.php
index 44dbd66d44..60207b0750 100644
--- a/wp-includes/SimplePie/src/Cache/BaseDataCache.php
+++ b/wp-includes/SimplePie/src/Cache/BaseDataCache.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2022 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie\Cache;

@@ -49,8 +12,6 @@ use InvalidArgumentException;
 /**
  * Adapter for deprecated \SimplePie\Cache\Base implementations
  *
- * @package SimplePie
- * @subpackage Caching
  * @internal
  */
 final class BaseDataCache implements DataCache
@@ -114,7 +75,7 @@ final class BaseDataCache implements DataCache
      * </code>
      *
      * @param string   $key   The key of the item to store.
-     * @param array    $value The value of the item to store, must be serializable.
+     * @param array<mixed> $value The value of the item to store, must be serializable.
      * @param null|int $ttl   Optional. The TTL value of this item. If no value is sent and
      *                                      the driver supports TTL then the library may set a default value
      *                                      for it or let the driver take care of that.
diff --git a/wp-includes/SimplePie/src/Cache/CallableNameFilter.php b/wp-includes/SimplePie/src/Cache/CallableNameFilter.php
index 0583d0d9b2..e95fa29175 100644
--- a/wp-includes/SimplePie/src/Cache/CallableNameFilter.php
+++ b/wp-includes/SimplePie/src/Cache/CallableNameFilter.php
@@ -1,61 +1,25 @@
 <?php
-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2022 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie\Cache;

 /**
  * Creating a cache filename with callables
- *
- * @package SimplePie
- * @subpackage Caching
  */
 final class CallableNameFilter implements NameFilter
 {
     /**
-     * @var callable
+     * @var callable(string): string
      */
     private $callable;

+    /**
+     * @param callable(string): string $callable
+     */
     public function __construct(callable $callable)
     {
         $this->callable = $callable;
@@ -78,7 +42,7 @@ final class CallableNameFilter implements NameFilter
      * and encodings or longer lengths, but MUST support at least that
      * minimum.
      *
-     * @param string $name The name for the cache will be most likly an url with query string
+     * @param string $name The name for the cache will be most likely an url with query string
      *
      * @return string the new cache name
      */
diff --git a/wp-includes/SimplePie/src/Cache/DB.php b/wp-includes/SimplePie/src/Cache/DB.php
index a5357b26da..5dac94f407 100644
--- a/wp-includes/SimplePie/src/Cache/DB.php
+++ b/wp-includes/SimplePie/src/Cache/DB.php
@@ -1,54 +1,17 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie\Cache;

+use SimplePie\Item;
+
 /**
  * Base class for database-based caches
  *
- * @package SimplePie
- * @subpackage Caching
  * @deprecated since SimplePie 1.8.0, use implementation of "Psr\SimpleCache\CacheInterface" instead
  */
 abstract class DB implements Base
@@ -59,9 +22,9 @@ abstract class DB implements Base
      * Converts a given {@see SimplePie} object into data to be stored
      *
      * @param \SimplePie\SimplePie $data
-     * @return array First item is the serialized data for storage, second item is the unique ID for this item
+     * @return array{string, array<string, Item>} First item is the serialized data for storage, second item is the unique ID for this item
      */
-    protected static function prepare_simplepie_object_for_cache($data)
+    protected static function prepare_simplepie_object_for_cache(\SimplePie\SimplePie $data)
     {
         $items = $data->get_items();
         $items_by_id = [];
diff --git a/wp-includes/SimplePie/src/Cache/DataCache.php b/wp-includes/SimplePie/src/Cache/DataCache.php
index e754132431..02ec59e9c7 100644
--- a/wp-includes/SimplePie/src/Cache/DataCache.php
+++ b/wp-includes/SimplePie/src/Cache/DataCache.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2022 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie\Cache;

@@ -55,8 +18,6 @@ use InvalidArgumentException;
  * The methods names must be different, but should be compatible to the
  * methods of \Psr\SimpleCache\CacheInterface.
  *
- * @package SimplePie
- * @subpackage Caching
  * @internal
  */
 interface DataCache
@@ -88,7 +49,7 @@ interface DataCache
      * </code>
      *
      * @param string   $key   The key of the item to store.
-     * @param array    $value The value of the item to store, must be serializable.
+     * @param array<mixed> $value The value of the item to store, must be serializable.
      * @param null|int $ttl   Optional. The TTL value of this item. If no value is sent and
      *                                      the driver supports TTL then the library may set a default value
      *                                      for it or let the driver take care of that.
diff --git a/wp-includes/SimplePie/src/Cache/File.php b/wp-includes/SimplePie/src/Cache/File.php
index 0ffcdf9e25..110a77c43e 100644
--- a/wp-includes/SimplePie/src/Cache/File.php
+++ b/wp-includes/SimplePie/src/Cache/File.php
@@ -1,54 +1,15 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie\Cache;

 /**
  * Caches data to the filesystem
  *
- * @package SimplePie
- * @subpackage Caching
  * @deprecated since SimplePie 1.8.0, use implementation of "Psr\SimpleCache\CacheInterface" instead
  */
 class File implements Base
@@ -89,7 +50,7 @@ class File implements Base
      * @param string $name Unique ID for the cache
      * @param Base::TYPE_FEED|Base::TYPE_IMAGE $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data
      */
-    public function __construct($location, $name, $type)
+    public function __construct(string $location, string $name, $type)
     {
         $this->location = $location;
         $this->filename = $name;
@@ -100,7 +61,7 @@ class File implements Base
     /**
      * Save data to the cache
      *
-     * @param array|\SimplePie\SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property
+     * @param array<mixed>|\SimplePie\SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property
      * @return bool Successfulness
      */
     public function save($data)
@@ -119,12 +80,12 @@ class File implements Base
     /**
      * Retrieve the data saved to the cache
      *
-     * @return array Data for SimplePie::$data
+     * @return array<mixed>|false Data for SimplePie::$data
      */
     public function load()
     {
         if (file_exists($this->name) && is_readable($this->name)) {
-            return unserialize(file_get_contents($this->name));
+            return unserialize((string) file_get_contents($this->name));
         }
         return false;
     }
@@ -132,7 +93,7 @@ class File implements Base
     /**
      * Retrieve the last modified time for the cache
      *
-     * @return int Timestamp
+     * @return int|false Timestamp
      */
     public function mtime()
     {
diff --git a/wp-includes/SimplePie/src/Cache/Memcache.php b/wp-includes/SimplePie/src/Cache/Memcache.php
index d20f9bfcf6..261bb5d484 100644
--- a/wp-includes/SimplePie/src/Cache/Memcache.php
+++ b/wp-includes/SimplePie/src/Cache/Memcache.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie\Cache;

@@ -55,8 +18,6 @@ use Memcache as NativeMemcache;
  * connect to memcache on `localhost` on port 11211. All tables will be
  * prefixed with `sp_` and data will expire after 3600 seconds
  *
- * @package SimplePie
- * @subpackage Caching
  * @uses Memcache
  * @deprecated since SimplePie 1.8.0, use implementation of "Psr\SimpleCache\CacheInterface" instead
  */
@@ -65,14 +26,14 @@ class Memcache implements Base
     /**
      * Memcache instance
      *
-     * @var Memcache
+     * @var NativeMemcache
      */
     protected $cache;

     /**
      * Options
      *
-     * @var array
+     * @var array<string, mixed>
      */
     protected $options;

@@ -90,7 +51,7 @@ class Memcache implements Base
      * @param string $name Unique ID for the cache
      * @param Base::TYPE_FEED|Base::TYPE_IMAGE $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data
      */
-    public function __construct($location, $name, $type)
+    public function __construct(string $location, string $name, $type)
     {
         $this->options = [
             'host' => '127.0.0.1',
@@ -111,7 +72,7 @@ class Memcache implements Base
     /**
      * Save data to the cache
      *
-     * @param array|\SimplePie\SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property
+     * @param array<mixed>|\SimplePie\SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property
      * @return bool Successfulness
      */
     public function save($data)
@@ -125,7 +86,7 @@ class Memcache implements Base
     /**
      * Retrieve the data saved to the cache
      *
-     * @return array Data for SimplePie::$data
+     * @return array<mixed>|false Data for SimplePie::$data
      */
     public function load()
     {
@@ -140,7 +101,7 @@ class Memcache implements Base
     /**
      * Retrieve the last modified time for the cache
      *
-     * @return int Timestamp
+     * @return int|false Timestamp
      */
     public function mtime()
     {
diff --git a/wp-includes/SimplePie/src/Cache/Memcached.php b/wp-includes/SimplePie/src/Cache/Memcached.php
index 8a8d31e7b2..924f31fca5 100644
--- a/wp-includes/SimplePie/src/Cache/Memcached.php
+++ b/wp-includes/SimplePie/src/Cache/Memcached.php
@@ -1,46 +1,10 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-FileCopyrightText: 2015 Paul L. McNeely
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie\Cache;

@@ -55,9 +19,6 @@ use Memcached as NativeMemcached;
  * connect to memcached on `localhost` on port 11211. All tables will be
  * prefixed with `sp_` and data will expire after 3600 seconds
  *
- * @package    SimplePie
- * @subpackage Caching
- * @author     Paul L. McNeely
  * @uses       Memcached
  * @deprecated since SimplePie 1.8.0, use implementation of "Psr\SimpleCache\CacheInterface" instead
  */
@@ -71,7 +32,7 @@ class Memcached implements Base

     /**
      * Options
-     * @var array
+     * @var array<string, mixed>
      */
     protected $options;

@@ -87,7 +48,7 @@ class Memcached implements Base
      * @param string $name Unique ID for the cache
      * @param Base::TYPE_FEED|Base::TYPE_IMAGE $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data
      */
-    public function __construct($location, $name, $type)
+    public function __construct(string $location, string $name, $type)
     {
         $this->options = [
             'host'   => '127.0.0.1',
@@ -107,7 +68,7 @@ class Memcached implements Base

     /**
      * Save data to the cache
-     * @param array|\SimplePie\SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property
+     * @param array<mixed>|\SimplePie\SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property
      * @return bool Successfulness
      */
     public function save($data)
@@ -121,7 +82,7 @@ class Memcached implements Base

     /**
      * Retrieve the data saved to the cache
-     * @return array Data for SimplePie::$data
+     * @return array<mixed>|false Data for SimplePie::$data
      */
     public function load()
     {
@@ -164,9 +125,10 @@ class Memcached implements Base

     /**
      * Set the last modified time and data to NativeMemcached
+     * @param string|false $data
      * @return bool Success status
      */
-    private function setData($data)
+    private function setData($data): bool
     {
         if ($data !== false) {
             $this->cache->set($this->name . '_mtime', time(), (int)$this->options['extras']['timeout']);
diff --git a/wp-includes/SimplePie/src/Cache/MySQL.php b/wp-includes/SimplePie/src/Cache/MySQL.php
index 1d7986bfc3..73699ad75f 100644
--- a/wp-includes/SimplePie/src/Cache/MySQL.php
+++ b/wp-includes/SimplePie/src/Cache/MySQL.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie\Cache;

@@ -53,8 +16,6 @@ namespace SimplePie\Cache;
  * connect to the `mydb` database on `localhost` on port 3306, with the user
  * `root` and the password `password`. All tables will be prefixed with `sp_`
  *
- * @package SimplePie
- * @subpackage Caching
  * @deprecated since SimplePie 1.8.0, use implementation of "Psr\SimpleCache\CacheInterface" instead
  */
 class MySQL extends DB
@@ -62,14 +23,14 @@ class MySQL extends DB
     /**
      * PDO instance
      *
-     * @var \PDO
+     * @var \PDO|null
      */
     protected $mysql;

     /**
      * Options
      *
-     * @var array
+     * @var array<string, mixed>
      */
     protected $options;

@@ -87,7 +48,7 @@ class MySQL extends DB
      * @param string $name Unique ID for the cache
      * @param Base::TYPE_FEED|Base::TYPE_IMAGE $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data
      */
-    public function __construct($location, $name, $type)
+    public function __construct(string $location, string $name, $type)
     {
         $this->options = [
             'user' => null,
@@ -147,7 +108,7 @@ class MySQL extends DB
     /**
      * Save data to the cache
      *
-     * @param array|\SimplePie\SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property
+     * @param array<string>|\SimplePie\SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property
      * @return bool Successfulness
      */
     public function save($data)
@@ -268,7 +229,7 @@ class MySQL extends DB
     /**
      * Retrieve the data saved to the cache
      *
-     * @return array Data for SimplePie::$data
+     * @return array<string>|false Data for SimplePie::$data
      */
     public function load()
     {
@@ -310,7 +271,7 @@ class MySQL extends DB
                     $query->bindValue(':feed', $this->id);
                     if ($query->execute()) {
                         while ($row = $query->fetchColumn()) {
-                            $feed['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['entry'][] = unserialize($row);
+                            $feed['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['entry'][] = unserialize((string) $row);
                         }
                     } else {
                         return false;
@@ -325,7 +286,7 @@ class MySQL extends DB
     /**
      * Retrieve the last modified time for the cache
      *
-     * @return int Timestamp
+     * @return int|false Timestamp
      */
     public function mtime()
     {
@@ -336,7 +297,7 @@ class MySQL extends DB
         $query = $this->mysql->prepare('SELECT `mtime` FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :id');
         $query->bindValue(':id', $this->id);
         if ($query->execute() && ($time = $query->fetchColumn())) {
-            return $time;
+            return (int) $time;
         }

         return false;
diff --git a/wp-includes/SimplePie/src/Cache/NameFilter.php b/wp-includes/SimplePie/src/Cache/NameFilter.php
index 19ce7b0a23..9babb41f96 100644
--- a/wp-includes/SimplePie/src/Cache/NameFilter.php
+++ b/wp-includes/SimplePie/src/Cache/NameFilter.php
@@ -1,53 +1,14 @@
 <?php
-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2022 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie\Cache;

 /**
  * Interface for creating a cache filename
- *
- * @package SimplePie
- * @subpackage Caching
  */
 interface NameFilter
 {
@@ -68,7 +29,7 @@ interface NameFilter
      * and encodings or longer lengths, but MUST support at least that
      * minimum.
      *
-     * @param string $name The name for the cache will be most likly an url with query string
+     * @param string $name The name for the cache will be most likely an url with query string
      *
      * @return string the new cache name
      */
diff --git a/wp-includes/SimplePie/src/Cache/Psr16.php b/wp-includes/SimplePie/src/Cache/Psr16.php
index 15fe6db920..4dc8161d2d 100644
--- a/wp-includes/SimplePie/src/Cache/Psr16.php
+++ b/wp-includes/SimplePie/src/Cache/Psr16.php
@@ -1,57 +1,19 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2022 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie\Cache;

 use Psr\SimpleCache\CacheInterface;
 use Psr\SimpleCache\InvalidArgumentException;
+use Throwable;

 /**
  * Caches data into a PSR-16 cache implementation
  *
- * @package SimplePie
- * @subpackage Caching
  * @internal
  */
 final class Psr16 implements DataCache
@@ -86,7 +48,7 @@ final class Psr16 implements DataCache
      *
      * @return array|mixed The value of the item from the cache, or $default in case of cache miss.
      *
-     * @throws InvalidArgumentException
+     * @throws InvalidArgumentException&Throwable
      *   MUST be thrown if the $key string is not a legal value.
      */
     public function get_data(string $key, $default = null)
@@ -109,14 +71,14 @@ final class Psr16 implements DataCache
      * </code>
      *
      * @param string   $key   The key of the item to store.
-     * @param array    $value The value of the item to store, must be serializable.
+     * @param array<mixed> $value The value of the item to store, must be serializable.
      * @param null|int $ttl   Optional. The TTL value of this item. If no value is sent and
      *                                      the driver supports TTL then the library may set a default value
      *                                      for it or let the driver take care of that.
      *
      * @return bool True on success and false on failure.
      *
-     * @throws InvalidArgumentException
+     * @throws InvalidArgumentException&Throwable
      *   MUST be thrown if the $key string is not a legal value.
      */
     public function set_data(string $key, array $value, ?int $ttl = null): bool
@@ -136,7 +98,7 @@ final class Psr16 implements DataCache
      *
      * @return bool True if the item was successfully removed. False if there was an error.
      *
-     * @throws InvalidArgumentException
+     * @throws InvalidArgumentException&Throwable
      *   MUST be thrown if the $key string is not a legal value.
      */
     public function delete_data(string $key): bool
diff --git a/wp-includes/SimplePie/src/Cache/Redis.php b/wp-includes/SimplePie/src/Cache/Redis.php
index 5997668c00..3ba0a3ed59 100644
--- a/wp-includes/SimplePie/src/Cache/Redis.php
+++ b/wp-includes/SimplePie/src/Cache/Redis.php
@@ -1,46 +1,10 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-FileCopyrightText: 2015 Jan Kozak <galvani78@gmail.com>
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie\Cache;

@@ -55,8 +19,6 @@ use Redis as NativeRedis;
  * connect to redis on `localhost` on port 6379. All tables will be
  * prefixed with `simple_primary-` and data will expire after 3600 seconds
  *
- * @package SimplePie
- * @subpackage Caching
  * @uses Redis
  * @deprecated since SimplePie 1.8.0, use implementation of "Psr\SimpleCache\CacheInterface" instead
  */
@@ -72,7 +34,7 @@ class Redis implements Base
     /**
      * Options
      *
-     * @var array
+     * @var array<string, mixed>
      */
     protected $options;

@@ -88,9 +50,9 @@ class Redis implements Base
      *
      * @param string $location Location string (from SimplePie::$cache_location)
      * @param string $name Unique ID for the cache
-     * @param Base::TYPE_FEED|Base::TYPE_IMAGE $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data
+     * @param Base::TYPE_FEED|Base::TYPE_IMAGE|array<string, mixed>|null $options Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data
      */
-    public function __construct($location, $name, $options = null)
+    public function __construct(string $location, string $name, $options = null)
     {
         //$this->cache = \flow\simple\cache\Redis::getRedisClientInstance();
         $parsed = \SimplePie\Cache::parse_URL($location);
@@ -118,6 +80,7 @@ class Redis implements Base

     /**
      * @param NativeRedis $cache
+     * @return void
      */
     public function setRedisClient(NativeRedis $cache)
     {
@@ -127,7 +90,7 @@ class Redis implements Base
     /**
      * Save data to the cache
      *
-     * @param array|\SimplePie\SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property
+     * @param array<mixed>|\SimplePie\SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property
      * @return bool Successfulness
      */
     public function save($data)
@@ -146,7 +109,7 @@ class Redis implements Base
     /**
      * Retrieve the data saved to the cache
      *
-     * @return array Data for SimplePie::$data
+     * @return array<mixed>|false Data for SimplePie::$data
      */
     public function load()
     {
@@ -161,7 +124,7 @@ class Redis implements Base
     /**
      * Retrieve the last modified time for the cache
      *
-     * @return int Timestamp
+     * @return int|false Timestamp
      */
     public function mtime()
     {
diff --git a/wp-includes/SimplePie/src/Caption.php b/wp-includes/SimplePie/src/Caption.php
index ef72c0b7ac..0c25fa5ce1 100644
--- a/wp-includes/SimplePie/src/Caption.php
+++ b/wp-includes/SimplePie/src/Caption.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie;

@@ -50,16 +13,13 @@ namespace SimplePie;
  * Used by {@see \SimplePie\Enclosure::get_caption()} and {@see \SimplePie\Enclosure::get_captions()}
  *
  * This class can be overloaded with {@see \SimplePie\SimplePie::set_caption_class()}
- *
- * @package SimplePie
- * @subpackage API
  */
 class Caption
 {
     /**
      * Content type
      *
-     * @var string
+     * @var ?string
      * @see get_type()
      */
     public $type;
@@ -67,7 +27,7 @@ class Caption
     /**
      * Language
      *
-     * @var string
+     * @var ?string
      * @see get_language()
      */
     public $lang;
@@ -75,7 +35,7 @@ class Caption
     /**
      * Start time
      *
-     * @var string
+     * @var ?string
      * @see get_starttime()
      */
     public $startTime;
@@ -83,7 +43,7 @@ class Caption
     /**
      * End time
      *
-     * @var string
+     * @var ?string
      * @see get_endtime()
      */
     public $endTime;
@@ -91,7 +51,7 @@ class Caption
     /**
      * Caption text
      *
-     * @var string
+     * @var ?string
      * @see get_text()
      */
     public $text;
@@ -102,8 +62,13 @@ class Caption
      * For documentation on all the parameters, see the corresponding
      * properties and their accessors
      */
-    public function __construct($type = null, $lang = null, $startTime = null, $endTime = null, $text = null)
-    {
+    public function __construct(
+        ?string $type = null,
+        ?string $lang = null,
+        ?string $startTime = null,
+        ?string $endTime = null,
+        ?string $text = null
+    ) {
         $this->type = $type;
         $this->lang = $lang;
         $this->startTime = $startTime;
diff --git a/wp-includes/SimplePie/src/Category.php b/wp-includes/SimplePie/src/Category.php
index d7da8e6831..5439ef4415 100644
--- a/wp-includes/SimplePie/src/Category.php
+++ b/wp-includes/SimplePie/src/Category.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie;

@@ -50,9 +13,6 @@ namespace SimplePie;
  * Used by {@see \SimplePie\Item::get_category()} and {@see \SimplePie\Item::get_categories()}
  *
  * This class can be overloaded with {@see \SimplePie\SimplePie::set_category_class()}
- *
- * @package SimplePie
- * @subpackage API
  */
 class Category
 {
@@ -99,7 +59,7 @@ class Category
      * @param string|null $label
      * @param string|null $type
      */
-    public function __construct($term = null, $scheme = null, $label = null, $type = null)
+    public function __construct(?string $term = null, ?string $scheme = null, ?string $label = null, ?string $type = null)
     {
         $this->term = $term;
         $this->scheme = $scheme;
@@ -144,7 +104,7 @@ class Category
      * @param bool $strict
      * @return string|null
      */
-    public function get_label($strict = false)
+    public function get_label(bool $strict = false)
     {
         if ($this->label === null && $strict !== true) {
             return $this->get_term();
diff --git a/wp-includes/SimplePie/src/Content/Type/Sniffer.php b/wp-includes/SimplePie/src/Content/Type/Sniffer.php
index 8c7e089ac5..d1da5fd71f 100644
--- a/wp-includes/SimplePie/src/Content/Type/Sniffer.php
+++ b/wp-includes/SimplePie/src/Content/Type/Sniffer.php
@@ -1,49 +1,16 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie\Content\Type;

+use InvalidArgumentException;
+use SimplePie\File;
+use SimplePie\HTTP\Response;
+
 /**
  * Content-type sniffing
  *
@@ -54,26 +21,32 @@ namespace SimplePie\Content\Type;
  *
  *
  * This class can be overloaded with {@see \SimplePie\SimplePie::set_content_type_sniffer_class()}
- *
- * @package SimplePie
- * @subpackage HTTP
  */
 class Sniffer
 {
     /**
      * File object
      *
-     * @var \SimplePie\File
+     * @var File|Response
      */
     public $file;

     /**
      * Create an instance of the class with the input file
      *
-     * @param Sniffer $file Input file
+     * @param File|Response $file Input file
      */
-    public function __construct($file)
+    public function __construct(/* File */ $file)
     {
+        if (!is_object($file) || !$file instanceof Response) {
+            // For BC we're asking for `File`, but internally we accept every `Response` implementation
+            throw new InvalidArgumentException(sprintf(
+                '%s(): Argument #1 ($file) must be of type %s',
+                __METHOD__,
+                File::class
+            ), 1);
+        }
+
         $this->file = $file;
     }

@@ -84,19 +57,21 @@ class Sniffer
      */
     public function get_type()
     {
-        if (isset($this->file->headers['content-type'])) {
-            if (!isset($this->file->headers['content-encoding'])
-                && ($this->file->headers['content-type'] === 'text/plain'
-                    || $this->file->headers['content-type'] === 'text/plain; charset=ISO-8859-1'
-                    || $this->file->headers['content-type'] === 'text/plain; charset=iso-8859-1'
-                    || $this->file->headers['content-type'] === 'text/plain; charset=UTF-8')) {
+        $content_type = $this->file->has_header('content-type') ? $this->file->get_header_line('content-type') : null;
+        $content_encoding = $this->file->has_header('content-encoding') ? $this->file->get_header_line('content-encoding') : null;
+        if ($content_type !== null) {
+            if ($content_encoding === null
+                && ($content_type === 'text/plain'
+                    || $content_type === 'text/plain; charset=ISO-8859-1'
+                    || $content_type === 'text/plain; charset=iso-8859-1'
+                    || $content_type === 'text/plain; charset=UTF-8')) {
                 return $this->text_or_binary();
             }

-            if (($pos = strpos($this->file->headers['content-type'], ';')) !== false) {
-                $official = substr($this->file->headers['content-type'], 0, $pos);
+            if (($pos = strpos($content_type, ';')) !== false) {
+                $official = substr($content_type, 0, $pos);
             } else {
-                $official = $this->file->headers['content-type'];
+                $official = $content_type;
             }
             $official = trim(strtolower($official));

@@ -130,12 +105,14 @@ class Sniffer
      */
     public function text_or_binary()
     {
-        if (substr($this->file->body, 0, 2) === "\xFE\xFF"
-            || substr($this->file->body, 0, 2) === "\xFF\xFE"
-            || substr($this->file->body, 0, 4) === "\x00\x00\xFE\xFF"
-            || substr($this->file->body, 0, 3) === "\xEF\xBB\xBF") {
+        $body = $this->file->get_body_content();
+
+        if (substr($body, 0, 2) === "\xFE\xFF"
+            || substr($body, 0, 2) === "\xFF\xFE"
+            || substr($body, 0, 4) === "\x00\x00\xFE\xFF"
+            || substr($body, 0, 3) === "\xEF\xBB\xBF") {
             return 'text/plain';
-        } elseif (preg_match('/[\x00-\x08\x0E-\x1A\x1C-\x1F]/', $this->file->body)) {
+        } elseif (preg_match('/[\x00-\x08\x0E-\x1A\x1C-\x1F]/', $body)) {
             return 'application/octet-stream';
         }

@@ -149,25 +126,27 @@ class Sniffer
      */
     public function unknown()
     {
-        $ws = strspn($this->file->body, "\x09\x0A\x0B\x0C\x0D\x20");
-        if (strtolower(substr($this->file->body, $ws, 14)) === '<!doctype html'
-            || strtolower(substr($this->file->body, $ws, 5)) === '<html'
-            || strtolower(substr($this->file->body, $ws, 7)) === '<script') {
+        $body = $this->file->get_body_content();
+
+        $ws = strspn($body, "\x09\x0A\x0B\x0C\x0D\x20");
+        if (strtolower(substr($body, $ws, 14)) === '<!doctype html'
+            || strtolower(substr($body, $ws, 5)) === '<html'
+            || strtolower(substr($body, $ws, 7)) === '<script') {
             return 'text/html';
-        } elseif (substr($this->file->body, 0, 5) === '%PDF-') {
+        } elseif (substr($body, 0, 5) === '%PDF-') {
             return 'application/pdf';
-        } elseif (substr($this->file->body, 0, 11) === '%!PS-Adobe-') {
+        } elseif (substr($body, 0, 11) === '%!PS-Adobe-') {
             return 'application/postscript';
-        } elseif (substr($this->file->body, 0, 6) === 'GIF87a'
-            || substr($this->file->body, 0, 6) === 'GIF89a') {
+        } elseif (substr($body, 0, 6) === 'GIF87a'
+            || substr($body, 0, 6) === 'GIF89a') {
             return 'image/gif';
-        } elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A") {
+        } elseif (substr($body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A") {
             return 'image/png';
-        } elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF") {
+        } elseif (substr($body, 0, 3) === "\xFF\xD8\xFF") {
             return 'image/jpeg';
-        } elseif (substr($this->file->body, 0, 2) === "\x42\x4D") {
+        } elseif (substr($body, 0, 2) === "\x42\x4D") {
             return 'image/bmp';
-        } elseif (substr($this->file->body, 0, 4) === "\x00\x00\x01\x00") {
+        } elseif (substr($body, 0, 4) === "\x00\x00\x01\x00") {
             return 'image/vnd.microsoft.icon';
         }

@@ -177,20 +156,22 @@ class Sniffer
     /**
      * Sniff images
      *
-     * @return string Actual Content-Type
+     * @return string|false Actual Content-Type
      */
     public function image()
     {
-        if (substr($this->file->body, 0, 6) === 'GIF87a'
-            || substr($this->file->body, 0, 6) === 'GIF89a') {
+        $body = $this->file->get_body_content();
+
+        if (substr($body, 0, 6) === 'GIF87a'
+            || substr($body, 0, 6) === 'GIF89a') {
             return 'image/gif';
-        } elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A") {
+        } elseif (substr($body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A") {
             return 'image/png';
-        } elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF") {
+        } elseif (substr($body, 0, 3) === "\xFF\xD8\xFF") {
             return 'image/jpeg';
-        } elseif (substr($this->file->body, 0, 2) === "\x42\x4D") {
+        } elseif (substr($body, 0, 2) === "\x42\x4D") {
             return 'image/bmp';
-        } elseif (substr($this->file->body, 0, 4) === "\x00\x00\x01\x00") {
+        } elseif (substr($body, 0, 4) === "\x00\x00\x01\x00") {
             return 'image/vnd.microsoft.icon';
         }

@@ -204,16 +185,18 @@ class Sniffer
      */
     public function feed_or_html()
     {
-        $len = strlen($this->file->body);
-        $pos = strspn($this->file->body, "\x09\x0A\x0D\x20\xEF\xBB\xBF");
+        $body = $this->file->get_body_content();
+
+        $len = strlen($body);
+        $pos = strspn($body, "\x09\x0A\x0D\x20\xEF\xBB\xBF");

         while ($pos < $len) {
-            switch ($this->file->body[$pos]) {
+            switch ($body[$pos]) {
                 case "\x09":
                 case "\x0A":
                 case "\x0D":
                 case "\x20":
-                    $pos += strspn($this->file->body, "\x09\x0A\x0D\x20", $pos);
+                    $pos += strspn($body, "\x09\x0A\x0D\x20", $pos);
                     continue 2;

                 case '<':
@@ -224,29 +207,29 @@ class Sniffer
                     return 'text/html';
             }

-            if (substr($this->file->body, $pos, 3) === '!--') {
+            if (substr($body, $pos, 3) === '!--') {
                 $pos += 3;
-                if ($pos < $len && ($pos = strpos($this->file->body, '-->', $pos)) !== false) {
+                if ($pos < $len && ($pos = strpos($body, '-->', $pos)) !== false) {
                     $pos += 3;
                 } else {
                     return 'text/html';
                 }
-            } elseif (substr($this->file->body, $pos, 1) === '!') {
-                if ($pos < $len && ($pos = strpos($this->file->body, '>', $pos)) !== false) {
+            } elseif (substr($body, $pos, 1) === '!') {
+                if ($pos < $len && ($pos = strpos($body, '>', $pos)) !== false) {
                     $pos++;
                 } else {
                     return 'text/html';
                 }
-            } elseif (substr($this->file->body, $pos, 1) === '?') {
-                if ($pos < $len && ($pos = strpos($this->file->body, '?>', $pos)) !== false) {
+            } elseif (substr($body, $pos, 1) === '?') {
+                if ($pos < $len && ($pos = strpos($body, '?>', $pos)) !== false) {
                     $pos += 2;
                 } else {
                     return 'text/html';
                 }
-            } elseif (substr($this->file->body, $pos, 3) === 'rss'
-                || substr($this->file->body, $pos, 7) === 'rdf:RDF') {
+            } elseif (substr($body, $pos, 3) === 'rss'
+                || substr($body, $pos, 7) === 'rdf:RDF') {
                 return 'application/rss+xml';
-            } elseif (substr($this->file->body, $pos, 4) === 'feed') {
+            } elseif (substr($body, $pos, 4) === 'feed') {
                 return 'application/atom+xml';
             } else {
                 return 'text/html';
diff --git a/wp-includes/SimplePie/src/Copyright.php b/wp-includes/SimplePie/src/Copyright.php
index 150362f015..080e332bd0 100644
--- a/wp-includes/SimplePie/src/Copyright.php
+++ b/wp-includes/SimplePie/src/Copyright.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie;

@@ -50,16 +13,13 @@ namespace SimplePie;
  * Used by {@see \SimplePie\Enclosure::get_copyright()}
  *
  * This class can be overloaded with {@see \SimplePie\SimplePie::set_copyright_class()}
- *
- * @package SimplePie
- * @subpackage API
  */
 class Copyright
 {
     /**
      * Copyright URL
      *
-     * @var string
+     * @var ?string
      * @see get_url()
      */
     public $url;
@@ -67,7 +27,7 @@ class Copyright
     /**
      * Attribution
      *
-     * @var string
+     * @var ?string
      * @see get_attribution()
      */
     public $label;
@@ -78,8 +38,10 @@ class Copyright
      * For documentation on all the parameters, see the corresponding
      * properties and their accessors
      */
-    public function __construct($url = null, $label = null)
-    {
+    public function __construct(
+        ?string $url = null,
+        ?string $label = null
+    ) {
         $this->url = $url;
         $this->label = $label;
     }
diff --git a/wp-includes/SimplePie/src/Credit.php b/wp-includes/SimplePie/src/Credit.php
index 947f231e81..3fc0ea1c17 100644
--- a/wp-includes/SimplePie/src/Credit.php
+++ b/wp-includes/SimplePie/src/Credit.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie;

@@ -50,16 +13,13 @@ namespace SimplePie;
  * Used by {@see \SimplePie\Enclosure::get_credit()} and {@see \SimplePie\Enclosure::get_credits()}
  *
  * This class can be overloaded with {@see \SimplePie\SimplePie::set_credit_class()}
- *
- * @package SimplePie
- * @subpackage API
  */
 class Credit
 {
     /**
      * Credited role
      *
-     * @var string
+     * @var ?string
      * @see get_role()
      */
     public $role;
@@ -67,7 +27,7 @@ class Credit
     /**
      * Organizational scheme
      *
-     * @var string
+     * @var ?string
      * @see get_scheme()
      */
     public $scheme;
@@ -75,7 +35,7 @@ class Credit
     /**
      * Credited name
      *
-     * @var string
+     * @var ?string
      * @see get_name()
      */
     public $name;
@@ -86,8 +46,11 @@ class Credit
      * For documentation on all the parameters, see the corresponding
      * properties and their accessors
      */
-    public function __construct($role = null, $scheme = null, $name = null)
-    {
+    public function __construct(
+        ?string $role = null,
+        ?string $scheme = null,
+        ?string $name = null
+    ) {
         $this->role = $role;
         $this->scheme = $scheme;
         $this->name = $name;
diff --git a/wp-includes/SimplePie/src/Enclosure.php b/wp-includes/SimplePie/src/Enclosure.php
index e7dcb25270..89231c7f99 100644
--- a/wp-includes/SimplePie/src/Enclosure.php
+++ b/wp-includes/SimplePie/src/Enclosure.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie;

@@ -50,86 +13,83 @@ namespace SimplePie;
  * Used by {@see \SimplePie\Item::get_enclosure()} and {@see \SimplePie\Item::get_enclosures()}
  *
  * This class can be overloaded with {@see \SimplePie\SimplePie::set_enclosure_class()}
- *
- * @package SimplePie
- * @subpackage API
  */
 class Enclosure
 {
     /**
-     * @var string
+     * @var ?string
      * @see get_bitrate()
      */
     public $bitrate;

     /**
-     * @var array
+     * @var Caption[]|null
      * @see get_captions()
      */
     public $captions;

     /**
-     * @var array
+     * @var Category[]|null
      * @see get_categories()
      */
     public $categories;

     /**
-     * @var int
+     * @var ?int
      * @see get_channels()
      */
     public $channels;

     /**
-     * @var \SimplePie\Copyright
+     * @var ?Copyright
      * @see get_copyright()
      */
     public $copyright;

     /**
-     * @var array
+     * @var Credit[]|null
      * @see get_credits()
      */
     public $credits;

     /**
-     * @var string
+     * @var ?string
      * @see get_description()
      */
     public $description;

     /**
-     * @var int
+     * @var ?int
      * @see get_duration()
      */
     public $duration;

     /**
-     * @var string
+     * @var ?string
      * @see get_expression()
      */
     public $expression;

     /**
-     * @var string
+     * @var ?string
      * @see get_framerate()
      */
     public $framerate;

     /**
-     * @var string
+     * @var ?string
      * @see get_handler()
      */
     public $handler;

     /**
-     * @var array
+     * @var string[]|null
      * @see get_hashes()
      */
     public $hashes;

     /**
-     * @var string
+     * @var ?string
      * @see get_height()
      */
     public $height;
@@ -141,79 +101,79 @@ class Enclosure
     public $javascript;

     /**
-     * @var array
+     * @var string[]|null
      * @see get_keywords()
      */
     public $keywords;

     /**
-     * @var string
+     * @var ?string
      * @see get_language()
      */
     public $lang;

     /**
-     * @var string
+     * @var ?int
      * @see get_length()
      */
     public $length;

     /**
-     * @var string
+     * @var ?string
      * @see get_link()
      */
     public $link;

     /**
-     * @var string
+     * @var ?string
      * @see get_medium()
      */
     public $medium;

     /**
-     * @var string
+     * @var ?string
      * @see get_player()
      */
     public $player;

     /**
-     * @var array
+     * @var Rating[]|null
      * @see get_ratings()
      */
     public $ratings;

     /**
-     * @var array
+     * @var ?Restriction[]
      * @see get_restrictions()
      */
     public $restrictions;

     /**
-     * @var string
+     * @var ?string
      * @see get_sampling_rate()
      */
     public $samplingrate;

     /**
-     * @var array
+     * @var string[]|null
      * @see get_thumbnails()
      */
     public $thumbnails;

     /**
-     * @var string
+     * @var ?string
      * @see get_title()
      */
     public $title;

     /**
-     * @var string
+     * @var ?string
      * @see get_type()
      */
     public $type;

     /**
-     * @var string
+     * @var ?string
      * @see get_width()
      */
     public $width;
@@ -224,10 +184,46 @@ class Enclosure
      * For documentation on all the parameters, see the corresponding
      * properties and their accessors
      *
-     * @uses idna_convert If available, this will convert an IDN
-     */
-    public function __construct($link = null, $type = null, $length = null, $javascript = null, $bitrate = null, $captions = null, $categories = null, $channels = null, $copyright = null, $credits = null, $description = null, $duration = null, $expression = null, $framerate = null, $hashes = null, $height = null, $keywords = null, $lang = null, $medium = null, $player = null, $ratings = null, $restrictions = null, $samplingrate = null, $thumbnails = null, $title = null, $width = null)
-    {
+     * @uses idn_to_ascii If available, this will convert an IDN
+     *
+     * @param null $javascript
+     * @param Caption[]|null $captions
+     * @param Category[]|null $categories
+     * @param Credit[]|null $credits
+     * @param string[]|null $hashes
+     * @param string[]|null $keywords
+     * @param Rating[]|null $ratings
+     * @param Restriction[]|null $restrictions
+     * @param string[]|null $thumbnails
+     */
+    public function __construct(
+        ?string $link = null,
+        ?string $type = null,
+        ?int $length = null,
+        $javascript = null,
+        ?string $bitrate = null,
+        ?array $captions = null,
+        ?array $categories = null,
+        ?int $channels = null,
+        ?Copyright $copyright = null,
+        ?array $credits = null,
+        ?string $description = null,
+        ?int $duration = null,
+        ?string $expression = null,
+        ?string $framerate = null,
+        ?array $hashes = null,
+        ?string $height = null,
+        ?array $keywords = null,
+        ?string $lang = null,
+        ?string $medium = null,
+        ?string $player = null,
+        ?array $ratings = null,
+        ?array $restrictions = null,
+        ?string $samplingrate = null,
+        ?array $thumbnails = null,
+        ?string $title = null,
+        ?string $width = null
+    ) {
         $this->bitrate = $bitrate;
         $this->captions = $captions;
         $this->categories = $categories;
@@ -254,10 +250,12 @@ class Enclosure
         $this->type = $type;
         $this->width = $width;

-        if (class_exists('idna_convert')) {
-            $idn = new \idna_convert();
-            $parsed = \SimplePie\Misc::parse_url($link);
-            $this->link = \SimplePie\Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']);
+        if (function_exists('idn_to_ascii')) {
+            $parsed = \SimplePie\Misc::parse_url($link ?? '');
+            if ($parsed['authority'] !== '' && !ctype_print($parsed['authority'])) {
+                $authority = (string) \idn_to_ascii($parsed['authority'], \IDNA_NONTRANSITIONAL_TO_ASCII, \INTL_IDNA_VARIANT_UTS46);
+                $this->link = \SimplePie\Misc::compress_parse_url($parsed['scheme'], $authority, $parsed['path'], $parsed['query'], $parsed['fragment']);
+            }
         }
         $this->handler = $this->get_handler(); // Needs to load last
     }
@@ -293,7 +291,7 @@ class Enclosure
      * @param int $key
      * @return \SimplePie\Caption|null
      */
-    public function get_caption($key = 0)
+    public function get_caption(int $key = 0)
     {
         $captions = $this->get_captions();
         if (isset($captions[$key])) {
@@ -306,7 +304,7 @@ class Enclosure
     /**
      * Get all captions
      *
-     * @return array|null Array of {@see \SimplePie\Caption} objects
+     * @return Caption[]|null
      */
     public function get_captions()
     {
@@ -323,7 +321,7 @@ class Enclosure
      * @param int $key
      * @return \SimplePie\Category|null
      */
-    public function get_category($key = 0)
+    public function get_category(int $key = 0)
     {
         $categories = $this->get_categories();
         if (isset($categories[$key])) {
@@ -336,7 +334,7 @@ class Enclosure
     /**
      * Get all categories
      *
-     * @return array|null Array of {@see \SimplePie\Category} objects
+     * @return \SimplePie\Category[]|null
      */
     public function get_categories()
     {
@@ -381,7 +379,7 @@ class Enclosure
      * @param int $key
      * @return \SimplePie\Credit|null
      */
-    public function get_credit($key = 0)
+    public function get_credit(int $key = 0)
     {
         $credits = $this->get_credits();
         if (isset($credits[$key])) {
@@ -394,7 +392,7 @@ class Enclosure
     /**
      * Get all credits
      *
-     * @return array|null Array of {@see \SimplePie\Credit} objects
+     * @return Credit[]|null
      */
     public function get_credits()
     {
@@ -425,7 +423,7 @@ class Enclosure
      * @param bool $convert Convert seconds into hh:mm:ss
      * @return string|int|null 'hh:mm:ss' string if `$convert` was specified, otherwise integer (or null if none found)
      */
-    public function get_duration($convert = false)
+    public function get_duration(bool $convert = false)
     {
         if ($this->duration !== null) {
             if ($convert) {
@@ -500,7 +498,7 @@ class Enclosure
      * @param int $key
      * @return string|null Hash as per `media:hash`, prefixed with "$algo:"
      */
-    public function get_hash($key = 0)
+    public function get_hash(int $key = 0)
     {
         $hashes = $this->get_hashes();
         if (isset($hashes[$key])) {
@@ -513,7 +511,7 @@ class Enclosure
     /**
      * Get all credits
      *
-     * @return array|null Array of strings, see {@see get_hash()}
+     * @return string[]|null Array of strings, see {@see get_hash()}
      */
     public function get_hashes()
     {
@@ -559,7 +557,7 @@ class Enclosure
      * @param int $key
      * @return string|null
      */
-    public function get_keyword($key = 0)
+    public function get_keyword(int $key = 0)
     {
         $keywords = $this->get_keywords();
         if (isset($keywords[$key])) {
@@ -572,7 +570,7 @@ class Enclosure
     /**
      * Get all keywords
      *
-     * @return array|null Array of strings
+     * @return string[]|null
      */
     public function get_keywords()
     {
@@ -586,7 +584,7 @@ class Enclosure
     /**
      * Get length
      *
-     * @return float Length in bytes
+     * @return ?int Length in bytes
      */
     public function get_length()
     {
@@ -647,7 +645,7 @@ class Enclosure
      * @param int $key
      * @return \SimplePie\Rating|null
      */
-    public function get_rating($key = 0)
+    public function get_rating(int $key = 0)
     {
         $ratings = $this->get_ratings();
         if (isset($ratings[$key])) {
@@ -660,7 +658,7 @@ class Enclosure
     /**
      * Get all ratings
      *
-     * @return array|null Array of {@see \SimplePie\Rating} objects
+     * @return Rating[]|null
      */
     public function get_ratings()
     {
@@ -677,7 +675,7 @@ class Enclosure
      * @param int $key
      * @return \SimplePie\Restriction|null
      */
-    public function get_restriction($key = 0)
+    public function get_restriction(int $key = 0)
     {
         $restrictions = $this->get_restrictions();
         if (isset($restrictions[$key])) {
@@ -690,7 +688,7 @@ class Enclosure
     /**
      * Get all restrictions
      *
-     * @return array|null Array of {@see \SimplePie\Restriction} objects
+     * @return Restriction[]|null
      */
     public function get_restrictions()
     {
@@ -736,7 +734,7 @@ class Enclosure
      * @param int $key
      * @return string|null Thumbnail URL
      */
-    public function get_thumbnail($key = 0)
+    public function get_thumbnail(int $key = 0)
     {
         $thumbnails = $this->get_thumbnails();
         if (isset($thumbnails[$key])) {
@@ -749,7 +747,7 @@ class Enclosure
     /**
      * Get all thumbnails
      *
-     * @return array|null Array of thumbnail URLs
+     * @return string[]|null Array of thumbnail URLs
      */
     public function get_thumbnails()
     {
@@ -808,7 +806,7 @@ class Enclosure
      *
      * @deprecated Use the second parameter to {@see embed} instead
      *
-     * @param array|string $options See first parameter to {@see embed}
+     * @param array<string, mixed>|string $options See first parameter to {@see embed}
      * @return string HTML string to output
      */
     public function native_embed($options = '')
@@ -857,11 +855,11 @@ class Enclosure
      * `width` and `height` set to `auto` will default to 480x270 video resolution.
      *
      * @todo If the dimensions for media:content are defined, use them when width/height are set to 'auto'.
-     * @param array|string $options Comma-separated key:value list, or array
+     * @param array<string, mixed>|string $options Comma-separated key:value list, or array
      * @param bool $native Use `<embed>`
      * @return string HTML string to output
      */
-    public function embed($options = '', $native = false)
+    public function embed($options = '', bool $native = false)
     {
         // Set up defaults
         $audio = '';
@@ -933,7 +931,7 @@ class Enclosure
             }
         }

-        $mime = explode('/', $type, 2);
+        $mime = explode('/', (string) $type, 2);
         $mime = $mime[0];

         // Process values for 'auto'
@@ -994,7 +992,10 @@ class Enclosure
         // Flash Media Player file types.
         // Preferred handler for MP3 file types.
         elseif ($handler === 'fmedia' || ($handler === 'mp3' && $mediaplayer !== '')) {
-            $height += 20;
+            if (is_numeric($height)) {
+                $height += 20;
+            }
+
             if ($native) {
                 $embed .= "<embed src=\"$mediaplayer\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" quality=\"high\" width=\"$width\" height=\"$height\" wmode=\"transparent\" flashvars=\"file=" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "&autostart=false&repeat=$loop&showdigits=true&showfsbutton=false\"></embed>";
             } else {
@@ -1005,7 +1006,10 @@ class Enclosure
         // QuickTime 7 file types.  Need to test with QuickTime 6.
         // Only handle MP3's if the Flash Media Player is not present.
         elseif ($handler === 'quicktime' || ($handler === 'mp3' && $mediaplayer === '')) {
-            $height += 16;
+            if (is_numeric($height)) {
+                $height += 16;
+            }
+
             if ($native) {
                 if ($placeholder !== '') {
                     $embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" href=\"" . $this->get_link() . "\" src=\"$placeholder\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"false\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
@@ -1019,7 +1023,10 @@ class Enclosure

         // Windows Media
         elseif ($handler === 'wmedia') {
-            $height += 45;
+            if (is_numeric($height)) {
+                $height += 45;
+            }
+
             if ($native) {
                 $embed .= "<embed type=\"application/x-mplayer2\" src=\"" . $this->get_link() . "\" autosize=\"1\" width=\"$width\" height=\"$height\" showcontrols=\"1\" showstatusbar=\"0\" showdisplay=\"0\" autostart=\"0\"></embed>";
             } else {
@@ -1044,9 +1051,9 @@ class Enclosure
      *
      * @see get_type()
      * @param bool $find_handler Internal use only, use {@see get_handler()} instead
-     * @return string MIME type
+     * @return string|null MIME type
      */
-    public function get_real_type($find_handler = false)
+    public function get_real_type(bool $find_handler = false)
     {
         // Mime-types by handler.
         $types_flash = ['application/x-shockwave-flash', 'application/futuresplash']; // Flash
@@ -1055,10 +1062,9 @@ class Enclosure
         $types_wmedia = ['application/asx', 'application/x-mplayer2', 'audio/x-ms-wma', 'audio/x-ms-wax', 'video/x-ms-asf-plugin', 'video/x-ms-asf', 'video/x-ms-wm', 'video/x-ms-wmv', 'video/x-ms-wvx']; // Windows Media
         $types_mp3 = ['audio/mp3', 'audio/x-mp3', 'audio/mpeg', 'audio/x-mpeg']; // MP3

-        if ($this->get_type() !== null) {
-            $type = strtolower($this->type);
-        } else {
-            $type = null;
+        $type = $this->get_type();
+        if ($type !== null) {
+            $type = strtolower($type);
         }

         // If we encounter an unsupported mime-type, check the file extension and guess intelligently.
@@ -1114,9 +1120,9 @@ class Enclosure
                     $type = 'audio/x-ms-wma';
                     break;

-                    // Video mime-types
                 case '3gp':
                 case '3gpp':
+                    // Video mime-types
                     $type = 'video/3gpp';
                     break;

@@ -1177,8 +1183,8 @@ class Enclosure
                     $type = 'video/x-ms-wvx';
                     break;

-                    // Flash mime-types
                 case 'spl':
+                    // Flash mime-types
                     $type = 'application/futuresplash';
                     break;

diff --git a/wp-includes/SimplePie/src/Exception.php b/wp-includes/SimplePie/src/Exception.php
index ae67ae38cd..c5d3ba3a02 100644
--- a/wp-includes/SimplePie/src/Exception.php
+++ b/wp-includes/SimplePie/src/Exception.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie;

@@ -48,8 +11,6 @@ use Exception as NativeException;

 /**
  * General SimplePie exception class
- *
- * @package SimplePie
  */
 class Exception extends NativeException
 {
diff --git a/wp-includes/SimplePie/src/File.php b/wp-includes/SimplePie/src/File.php
index fac7aabc17..2d6ddf2b22 100644
--- a/wp-includes/SimplePie/src/File.php
+++ b/wp-includes/SimplePie/src/File.php
@@ -1,49 +1,14 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie;

+use SimplePie\HTTP\Response;
+
 /**
  * Used for fetching remote files and reading local files
  *
@@ -51,36 +16,93 @@ namespace SimplePie;
  *
  * This class can be overloaded with {@see \SimplePie\SimplePie::set_file_class()}
  *
- * @package SimplePie
- * @subpackage HTTP
  * @todo Move to properly supporting RFC2616 (HTTP/1.1)
  */
-class File
+class File implements Response
 {
+    /**
+     * @var string The final URL after following all redirects
+     * @deprecated Use `get_final_requested_uri()` method.
+     */
     public $url;
+
+    /**
+     * @var ?string User agent to use in requests
+     * @deprecated Set the user agent in constructor.
+     */
     public $useragent;
+
+    /** @var bool */
     public $success = true;
+
+    /** @var array<string, non-empty-array<string>> Canonical representation of headers */
+    private $parsed_headers = [];
+    /** @var array<string, string> Last known value of $headers property (used to detect external modification) */
+    private $last_headers = [];
+    /**
+     * @var array<string, string> Headers as string for BC
+     * @deprecated Use `get_headers()` method.
+     */
     public $headers = [];
+
+    /**
+     * @var ?string Body of the HTTP response
+     * @deprecated Use `get_body_content()` method.
+     */
     public $body;
+
+    /**
+     * @var int Status code of the HTTP response
+     * @deprecated Use `get_status_code()` method.
+     */
     public $status_code = 0;
+
+    /** @var non-negative-int Number of redirect that were already performed during this request sequence. */
     public $redirects = 0;
+
+    /** @var ?string */
     public $error;
+
+    /**
+     * @var int-mask-of<SimplePie::FILE_SOURCE_*> Bit mask representing the method used to fetch the file and whether it is a local file or remote file obtained over HTTP.
+     * @deprecated Backend is implementation detail which you should not care about; to see if the file was retrieved over HTTP, check if `get_final_requested_uri()` with `Misc::is_remote_uri()`.
+     */
     public $method = \SimplePie\SimplePie::FILE_SOURCE_NONE;
+
+    /**
+     * @var string The permanent URL or the resource (first URL after the prefix of (only) permanent redirects)
+     * @deprecated Use `get_permanent_uri()` method.
+     */
     public $permanent_url;
+    /** @var bool Whether the permanent URL is still writeable (prefix of permanent redirects has not ended) */
+    private $permanentUrlMutable = true;

-    public function __construct($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false, $curl_options = [])
+    /**
+     * @param string $url
+     * @param int $timeout
+     * @param int $redirects
+     * @param ?array<string, string> $headers
+     * @param ?string $useragent
+     * @param bool $force_fsockopen
+     * @param array<int, mixed> $curl_options
+     */
+    public function __construct(string $url, int $timeout = 10, int $redirects = 5, ?array $headers = null, ?string $useragent = null, bool $force_fsockopen = false, array $curl_options = [])
     {
-        if (class_exists('idna_convert')) {
-            $idn = new \idna_convert();
+        if (function_exists('idn_to_ascii')) {
             $parsed = \SimplePie\Misc::parse_url($url);
-            $url = \SimplePie\Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], null);
+            if ($parsed['authority'] !== '' && !ctype_print($parsed['authority'])) {
+                $authority = (string) \idn_to_ascii($parsed['authority'], \IDNA_NONTRANSITIONAL_TO_ASCII, \INTL_IDNA_VARIANT_UTS46);
+                $url = \SimplePie\Misc::compress_parse_url($parsed['scheme'], $authority, $parsed['path'], $parsed['query'], null);
+            }
         }
         $this->url = $url;
-        $this->permanent_url = $url;
+        if ($this->permanentUrlMutable) {
+            $this->permanent_url = $url;
+        }
         $this->useragent = $useragent;
         if (preg_match('/^http(s)?:\/\//i', $url)) {
             if ($useragent === null) {
-                $useragent = ini_get('user_agent');
+                $useragent = (string) ini_get('user_agent');
                 $this->useragent = $useragent;
             }
             if (!is_array($headers)) {
@@ -93,6 +115,12 @@ class File
                 foreach ($headers as $key => $value) {
                     $headers2[] = "$key: $value";
                 }
+                if (isset($curl_options[CURLOPT_HTTPHEADER])) {
+                    if (is_array($curl_options[CURLOPT_HTTPHEADER])) {
+                        $headers2 = array_merge($headers2, $curl_options[CURLOPT_HTTPHEADER]);
+                    }
+                    unset($curl_options[CURLOPT_HTTPHEADER]);
+                }
                 if (version_compare(\SimplePie\Misc::get_curl_version(), '7.10.5', '>=')) {
                     curl_setopt($fp, CURLOPT_ENCODING, '');
                 }
@@ -109,10 +137,10 @@ class File
                     curl_setopt($fp, $curl_param, $curl_value);
                 }

-                $this->headers = curl_exec($fp);
-                if (curl_errno($fp) === 23 || curl_errno($fp) === 61) {
+                $responseHeaders = curl_exec($fp);
+                if (curl_errno($fp) === CURLE_WRITE_ERROR || curl_errno($fp) === CURLE_BAD_CONTENT_ENCODING) {
                     curl_setopt($fp, CURLOPT_ENCODING, 'none');
-                    $this->headers = curl_exec($fp);
+                    $responseHeaders = curl_exec($fp);
                 }
                 $this->status_code = curl_getinfo($fp, CURLINFO_HTTP_CODE);
                 if (curl_errno($fp)) {
@@ -123,29 +151,42 @@ class File
                     if ($info = curl_getinfo($fp)) {
                         $this->url = $info['url'];
                     }
-                    curl_close($fp);
-                    $this->headers = \SimplePie\HTTP\Parser::prepareHeaders($this->headers, $info['redirect_count'] + 1);
-                    $parser = new \SimplePie\HTTP\Parser($this->headers);
+                    // For PHPStan: We already checked that error did not occur.
+                    assert(is_array($info) && $info['redirect_count'] >= 0);
+                    if (\PHP_VERSION_ID < 80000) {
+                        curl_close($fp);
+                    }
+                    $responseHeaders = \SimplePie\HTTP\Parser::prepareHeaders((string) $responseHeaders, $info['redirect_count'] + 1);
+                    $parser = new \SimplePie\HTTP\Parser($responseHeaders, true);
                     if ($parser->parse()) {
-                        $this->headers = $parser->headers;
-                        $this->body = trim($parser->body);
+                        $this->set_headers($parser->headers);
+                        $this->body = $parser->body;
                         $this->status_code = $parser->status_code;
-                        if ((in_array($this->status_code, [300, 301, 302, 303, 307]) || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects) {
+                        if ((in_array($this->status_code, [300, 301, 302, 303, 307]) || $this->status_code > 307 && $this->status_code < 400) && ($locationHeader = $this->get_header_line('location')) !== '' && $this->redirects < $redirects) {
                             $this->redirects++;
-                            $location = \SimplePie\Misc::absolutize_url($this->headers['location'], $url);
-                            $previousStatusCode = $this->status_code;
+                            $location = \SimplePie\Misc::absolutize_url($locationHeader, $url);
+                            if ($location === false) {
+                                $this->error = "Invalid redirect location, trying to base “{$locationHeader}” onto “{$url}”";
+                                $this->success = false;
+                                return;
+                            }
+                            $this->permanentUrlMutable = $this->permanentUrlMutable && ($this->status_code == 301 || $this->status_code == 308);
                             $this->__construct($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen, $curl_options);
-                            $this->permanent_url = ($previousStatusCode == 301) ? $location : $url;
                             return;
                         }
                     }
                 }
             } else {
                 $this->method = \SimplePie\SimplePie::FILE_SOURCE_REMOTE | \SimplePie\SimplePie::FILE_SOURCE_FSOCKOPEN;
-                $url_parts = parse_url($url);
+                if (($url_parts = parse_url($url)) === false) {
+                    throw new \InvalidArgumentException('Malformed URL: ' . $url);
+                }
+                if (!isset($url_parts['host'])) {
+                    throw new \InvalidArgumentException('Missing hostname: ' . $url);
+                }
                 $socket_host = $url_parts['host'];
                 if (isset($url_parts['scheme']) && strtolower($url_parts['scheme']) === 'https') {
-                    $socket_host = "ssl://$url_parts[host]";
+                    $socket_host = 'ssl://' . $socket_host;
                     $url_parts['port'] = 443;
                 }
                 if (!isset($url_parts['port'])) {
@@ -184,36 +225,39 @@ class File

                     $info = stream_get_meta_data($fp);

-                    $this->headers = '';
+                    $responseHeaders = '';
                     while (!$info['eof'] && !$info['timed_out']) {
-                        $this->headers .= fread($fp, 1160);
+                        $responseHeaders .= fread($fp, 1160);
                         $info = stream_get_meta_data($fp);
                     }
                     if (!$info['timed_out']) {
-                        $parser = new \SimplePie\HTTP\Parser($this->headers);
+                        $parser = new \SimplePie\HTTP\Parser($responseHeaders, true);
                         if ($parser->parse()) {
-                            $this->headers = $parser->headers;
+                            $this->set_headers($parser->headers);
                             $this->body = $parser->body;
                             $this->status_code = $parser->status_code;
-                            if ((in_array($this->status_code, [300, 301, 302, 303, 307]) || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects) {
+                            if ((in_array($this->status_code, [300, 301, 302, 303, 307]) || $this->status_code > 307 && $this->status_code < 400) && ($locationHeader = $this->get_header_line('location')) !== '' && $this->redirects < $redirects) {
                                 $this->redirects++;
-                                $location = \SimplePie\Misc::absolutize_url($this->headers['location'], $url);
-                                $previousStatusCode = $this->status_code;
+                                $location = \SimplePie\Misc::absolutize_url($locationHeader, $url);
+                                $this->permanentUrlMutable = $this->permanentUrlMutable && ($this->status_code == 301 || $this->status_code == 308);
+                                if ($location === false) {
+                                    $this->error = "Invalid redirect location, trying to base “{$locationHeader}” onto “{$url}”";
+                                    $this->success = false;
+                                    return;
+                                }
                                 $this->__construct($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen, $curl_options);
-                                $this->permanent_url = ($previousStatusCode == 301) ? $location : $url;
                                 return;
                             }
-                            if (isset($this->headers['content-encoding'])) {
+                            if (($contentEncodingHeader = $this->get_header_line('content-encoding')) !== '') {
                                 // Hey, we act dumb elsewhere, so let's do that here too
-                                switch (strtolower(trim($this->headers['content-encoding'], "\x09\x0A\x0D\x20"))) {
+                                switch (strtolower(trim($contentEncodingHeader, "\x09\x0A\x0D\x20"))) {
                                     case 'gzip':
                                     case 'x-gzip':
-                                        $decoder = new \SimplePie\Gzdecode($this->body);
-                                        if (!$decoder->parse()) {
+                                        if (($decompressed = gzdecode($this->body)) === false) {
                                             $this->error = 'Unable to decode HTTP "gzip" stream';
                                             $this->success = false;
                                         } else {
-                                            $this->body = trim($decoder->data);
+                                            $this->body = $decompressed;
                                         }
                                         break;

@@ -222,7 +266,7 @@ class File
                                             $this->body = $decompressed;
                                         } elseif (($decompressed = gzuncompress($this->body)) !== false) {
                                             $this->body = $decompressed;
-                                        } elseif (function_exists('gzdecode') && ($decompressed = gzdecode($this->body)) !== false) {
+                                        } elseif (($decompressed = gzdecode($this->body)) !== false) {
                                             $this->body = $decompressed;
                                         } else {
                                             $this->error = 'Unable to decode HTTP "deflate" stream';
@@ -245,11 +289,155 @@ class File
             }
         } else {
             $this->method = \SimplePie\SimplePie::FILE_SOURCE_LOCAL | \SimplePie\SimplePie::FILE_SOURCE_FILE_GET_CONTENTS;
-            if (empty($url) || !($this->body = trim(file_get_contents($url)))) {
-                $this->error = 'file_get_contents could not read the file';
+            if (empty($url) || !is_readable($url) ||  false === $filebody = file_get_contents($url)) {
+                $this->body = '';
+                $this->error = sprintf('file "%s" is not readable', $url);
                 $this->success = false;
+            } else {
+                $this->body = $filebody;
+                $this->status_code = 200;
             }
         }
+        if ($this->success) {
+            assert($this->body !== null); // For PHPStan
+            // Leading whitespace may cause XML parsing errors (XML declaration cannot be preceded by anything other than BOM) so we trim it.
+            // Note that unlike built-in `trim` function’s default settings, we do not trim `\x00` to avoid breaking characters in UTF-16 or UTF-32 encoded strings.
+            // We also only do that when the whitespace is followed by `<`, so that we do not break e.g. UTF-16LE encoded whitespace like `\n\x00` in half.
+            $this->body = preg_replace('/^[ \n\r\t\v]+</', '<', $this->body);
+        }
+    }
+
+    public function get_permanent_uri(): string
+    {
+        return (string) $this->permanent_url;
+    }
+
+    public function get_final_requested_uri(): string
+    {
+        return (string) $this->url;
+    }
+
+    public function get_status_code(): int
+    {
+        return (int) $this->status_code;
+    }
+
+    public function get_headers(): array
+    {
+        $this->maybe_update_headers();
+        return $this->parsed_headers;
+    }
+
+    public function has_header(string $name): bool
+    {
+        $this->maybe_update_headers();
+        return $this->get_header($name) !== [];
+    }
+
+    public function get_header(string $name): array
+    {
+        $this->maybe_update_headers();
+        return $this->parsed_headers[strtolower($name)] ?? [];
+    }
+
+    public function with_header(string $name, $value)
+    {
+        $this->maybe_update_headers();
+        $new = clone $this;
+
+        $newHeader = [
+            strtolower($name) => (array) $value,
+        ];
+        $new->set_headers($newHeader + $this->get_headers());
+
+        return $new;
+    }
+
+    public function get_header_line(string $name): string
+    {
+        $this->maybe_update_headers();
+        return implode(', ', $this->get_header($name));
+    }
+
+    public function get_body_content(): string
+    {
+        return (string) $this->body;
+    }
+
+    /**
+     * Check if the $headers property was changed and update the internal state accordingly.
+     */
+    private function maybe_update_headers(): void
+    {
+        if ($this->headers !== $this->last_headers) {
+            $this->parsed_headers = array_map(
+                function (string $header_line): array {
+                    if (strpos($header_line, ',') === false) {
+                        return [$header_line];
+                    } else {
+                        return array_map('trim', explode(',', $header_line));
+                    }
+                },
+                $this->headers
+            );
+        }
+        $this->last_headers = $this->headers;
+    }
+
+    /**
+     * Sets headers internally.
+     *
+     * @param array<string, non-empty-array<string>> $headers
+     */
+    private function set_headers(array $headers): void
+    {
+        $this->parsed_headers = $headers;
+        $this->headers = self::flatten_headers($headers);
+        $this->last_headers = $this->headers;
+    }
+
+    /**
+     * Converts PSR-7 compatible headers into a legacy format.
+     *
+     * @param array<string, non-empty-array<string>> $headers
+     *
+     * @return array<string, string>
+     */
+    private function flatten_headers(array $headers): array
+    {
+        return array_map(function (array $values): string {
+            return implode(',', $values);
+        }, $headers);
+    }
+
+    /**
+     * Create a File instance from another Response
+     *
+     * For BC reasons in some places there MUST be a `File` instance
+     * instead of a `Response` implementation
+     *
+     * @see Locator::__construct()
+     * @internal
+     */
+    final public static function fromResponse(Response $response): self
+    {
+        $headers = [];
+
+        foreach ($response->get_headers() as $name => $header) {
+            $headers[$name] = implode(', ', $header);
+        }
+
+        /** @var File */
+        $file = (new \ReflectionClass(File::class))->newInstanceWithoutConstructor();
+
+        $file->url = $response->get_final_requested_uri();
+        $file->useragent = null;
+        $file->headers = $headers;
+        $file->body = $response->get_body_content();
+        $file->status_code = $response->get_status_code();
+        $file->permanent_url = $response->get_permanent_uri();
+
+        return $file;
     }
 }

diff --git a/wp-includes/SimplePie/src/Gzdecode.php b/wp-includes/SimplePie/src/Gzdecode.php
index acb120126e..2c97707837 100644
--- a/wp-includes/SimplePie/src/Gzdecode.php
+++ b/wp-includes/SimplePie/src/Gzdecode.php
@@ -1,55 +1,18 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie;

 /**
  * Decode 'gzip' encoded HTTP data
  *
- * @package SimplePie
- * @subpackage HTTP
  * @link http://www.gzip.org/format.txt
+ * @link https://www.php.net/manual/en/function.gzdecode.php
+ * @deprecated since SimplePie 1.9.0, use `gzdecode` function instead.
  */
 class Gzdecode
 {
@@ -179,7 +142,7 @@ class Gzdecode
      * @param string $name
      * @param mixed $value
      */
-    public function __set($name, $value)
+    public function __set(string $name, $value)
     {
         throw new Exception("Cannot write property $name");
     }
@@ -189,7 +152,7 @@ class Gzdecode
      *
      * @param string $data
      */
-    public function __construct($data)
+    public function __construct(string $data)
     {
         $this->compressed_data = $data;
         $this->compressed_size = strlen($data);
@@ -224,10 +187,10 @@ class Gzdecode
             // MTIME
             $mtime = substr($this->compressed_data, $this->position, 4);
             // Reverse the string if we're on a big-endian arch because l is the only signed long and is machine endianness
-            if (current(unpack('S', "\x00\x01")) === 1) {
+            if (current((array) unpack('S', "\x00\x01")) === 1) {
                 $mtime = strrev($mtime);
             }
-            $this->MTIME = current(unpack('l', $mtime));
+            $this->MTIME = current((array) unpack('l', $mtime));
             $this->position += 4;

             // Get the XFL (eXtra FLags)
@@ -248,7 +211,7 @@ class Gzdecode
                 }

                 // Get the length of the extra field
-                $len = current(unpack('v', substr($this->compressed_data, $this->position, 2)));
+                $len = current((array) unpack('v', substr($this->compressed_data, $this->position, 2)));
                 $this->position += 2;

                 // Check the length of the string is still valid
@@ -300,7 +263,7 @@ class Gzdecode
                 $this->min_compressed_size += $len + 2;
                 if ($this->compressed_size >= $this->min_compressed_size) {
                     // Read the CRC
-                    $crc = current(unpack('v', substr($this->compressed_data, $this->position, 2)));
+                    $crc = current((array) unpack('v', substr($this->compressed_data, $this->position, 2)));

                     // Check the CRC matches
                     if ((crc32(substr($this->compressed_data, 0, $this->position)) & 0xFFFF) === $crc) {
@@ -314,14 +277,15 @@ class Gzdecode
             }

             // Decompress the actual data
-            if (($this->data = gzinflate(substr($this->compressed_data, $this->position, -8))) === false) {
+            if (($data = gzinflate(substr($this->compressed_data, $this->position, -8))) === false) {
                 return false;
             }

+            $this->data = $data;
             $this->position = $this->compressed_size - 8;

             // Check CRC of data
-            $crc = current(unpack('V', substr($this->compressed_data, $this->position, 4)));
+            $crc = current((array) unpack('V', substr($this->compressed_data, $this->position, 4)));
             $this->position += 4;
             /*if (extension_loaded('hash') && sprintf('%u', current(unpack('V', hash('crc32b', $this->data)))) !== sprintf('%u', $crc))
             {
@@ -329,7 +293,7 @@ class Gzdecode
             }*/

             // Check ISIZE of data
-            $isize = current(unpack('V', substr($this->compressed_data, $this->position, 4)));
+            $isize = current((array) unpack('V', substr($this->compressed_data, $this->position, 4)));
             $this->position += 4;
             if (sprintf('%u', strlen($this->data) & 0xFFFFFFFF) !== sprintf('%u', $isize)) {
                 return false;
diff --git a/wp-includes/SimplePie/src/HTTP/Client.php b/wp-includes/SimplePie/src/HTTP/Client.php
new file mode 100644
index 0000000000..507c1b0f1f
--- /dev/null
+++ b/wp-includes/SimplePie/src/HTTP/Client.php
@@ -0,0 +1,28 @@
+<?php
+
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);
+
+namespace SimplePie\HTTP;
+
+/**
+ * HTTP Client interface
+ *
+ * @internal
+ */
+interface Client
+{
+    public const METHOD_GET = 'GET';
+
+    /**
+     * send a request and return the response
+     *
+     * @param Client::METHOD_* $method
+     * @param array<string, string> $headers
+     *
+     * @throws ClientException if anything goes wrong requesting the data
+     */
+    public function request(string $method, string $url, array $headers = []): Response;
+}
diff --git a/wp-includes/SimplePie/src/HTTP/ClientException.php b/wp-includes/SimplePie/src/HTTP/ClientException.php
new file mode 100644
index 0000000000..d7c0056808
--- /dev/null
+++ b/wp-includes/SimplePie/src/HTTP/ClientException.php
@@ -0,0 +1,19 @@
+<?php
+
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);
+
+namespace SimplePie\HTTP;
+
+use SimplePie\Exception as SimplePieException;
+
+/**
+ * Client exception class
+ *
+ * @internal
+ */
+final class ClientException extends SimplePieException
+{
+}
diff --git a/wp-includes/SimplePie/src/HTTP/FileClient.php b/wp-includes/SimplePie/src/HTTP/FileClient.php
new file mode 100644
index 0000000000..90fefebb0a
--- /dev/null
+++ b/wp-includes/SimplePie/src/HTTP/FileClient.php
@@ -0,0 +1,77 @@
+<?php
+
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);
+
+namespace SimplePie\HTTP;
+
+use InvalidArgumentException;
+use SimplePie\File;
+use SimplePie\Misc;
+use SimplePie\Registry;
+use Throwable;
+
+/**
+ * HTTP Client based on \SimplePie\File
+ *
+ * @internal
+ */
+final class FileClient implements Client
+{
+    /** @var Registry */
+    private $registry;
+
+    /** @var array{timeout?: int, redirects?: int, useragent?: string, force_fsockopen?: bool, curl_options?: array<mixed>} */
+    private $options;
+
+    /**
+     * @param array{timeout?: int, redirects?: int, useragent?: string, force_fsockopen?: bool, curl_options?: array<mixed>} $options
+     */
+    public function __construct(Registry $registry, array $options = [])
+    {
+        $this->registry = $registry;
+        $this->options = $options;
+    }
+
+    /**
+     * send a request and return the response
+     *
+     * @param Client::METHOD_* $method
+     * @param array<string, string> $headers
+     *
+     * @throws ClientException if anything goes wrong requesting the data
+     */
+    public function request(string $method, string $url, array $headers = []): Response
+    {
+        // @phpstan-ignore-next-line Enforce PHPDoc type.
+        if ($method !== self::METHOD_GET) {
+            throw new InvalidArgumentException(sprintf(
+                '%s(): Argument #1 ($method) only supports method "%s".',
+                __METHOD__,
+                self::METHOD_GET
+            ), 1);
+        }
+
+        try {
+            $file = $this->registry->create(File::class, [
+                $url,
+                $this->options['timeout'] ?? 10,
+                $this->options['redirects'] ?? 5,
+                $headers,
+                $this->options['useragent'] ?? Misc::get_default_useragent(),
+                $this->options['force_fsockopen'] ?? false,
+                $this->options['curl_options'] ?? []
+            ]);
+        } catch (Throwable $th) {
+            throw new ClientException($th->getMessage(), $th->getCode(), $th);
+        }
+
+        if ($file->error !== null && $file->get_status_code() === 0) {
+            throw new ClientException($file->error);
+        }
+
+        return $file;
+    }
+}
diff --git a/wp-includes/SimplePie/src/HTTP/Parser.php b/wp-includes/SimplePie/src/HTTP/Parser.php
index 524885a1a6..e9bcc46716 100644
--- a/wp-includes/SimplePie/src/HTTP/Parser.php
+++ b/wp-includes/SimplePie/src/HTTP/Parser.php
@@ -1,54 +1,15 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie\HTTP;

 /**
  * HTTP Response Parser
- *
- * @package SimplePie
- * @subpackage HTTP
+ * @template Psr7Compatible of bool
  */
 class Parser
 {
@@ -73,10 +34,15 @@ class Parser
      */
     public $reason = '';

+    /**
+     * @var Psr7Compatible whether headers are compatible with PSR-7 format.
+     */
+    private $psr7Compatible;
+
     /**
      * Key/value pairs of the headers
      *
-     * @var array
+     * @var (Psr7Compatible is true ? array<string, non-empty-array<string>> : array<string, string>)
      */
     public $headers = [];

@@ -144,14 +110,14 @@ class Parser
     protected $position = 0;

     /**
-     * Name of the hedaer currently being parsed
+     * Name of the header currently being parsed
      *
      * @var string
      */
     protected $name = '';

     /**
-     * Value of the hedaer currently being parsed
+     * Value of the header currently being parsed
      *
      * @var string
      */
@@ -161,11 +127,13 @@ class Parser
      * Create an instance of the class with the input data
      *
      * @param string $data Input data
+     * @param Psr7Compatible $psr7Compatible Whether the data types are in format compatible with PSR-7.
      */
-    public function __construct($data)
+    public function __construct(string $data, bool $psr7Compatible = false)
     {
         $this->data = $data;
         $this->data_length = strlen($this->data);
+        $this->psr7Compatible = $psr7Compatible;
     }

     /**
@@ -184,7 +152,8 @@ class Parser
             return true;
         }

-        $this->http_version = '';
+        // Reset the parser state.
+        $this->http_version = 0.0;
         $this->status_code = 0;
         $this->reason = '';
         $this->headers = [];
@@ -218,15 +187,16 @@ class Parser

     /**
      * Parse the HTTP version
+     * @return void
      */
     protected function http_version()
     {
         if (strpos($this->data, "\x0A") !== false && strtoupper(substr($this->data, 0, 5)) === 'HTTP/') {
             $len = strspn($this->data, '0123456789.', 5);
-            $this->http_version = substr($this->data, 5, $len);
+            $http_version = substr($this->data, 5, $len);
             $this->position += 5 + $len;
-            if (substr_count($this->http_version, '.') <= 1) {
-                $this->http_version = (float) $this->http_version;
+            if (substr_count($http_version, '.') <= 1) {
+                $this->http_version = (float) $http_version;
                 $this->position += strspn($this->data, "\x09\x20", $this->position);
                 $this->state = self::STATE_STATUS;
             } else {
@@ -239,6 +209,7 @@ class Parser

     /**
      * Parse the status code
+     * @return void
      */
     protected function status()
     {
@@ -253,6 +224,7 @@ class Parser

     /**
      * Parse the reason phrase
+     * @return void
      */
     protected function reason()
     {
@@ -262,8 +234,39 @@ class Parser
         $this->state = self::STATE_NEW_LINE;
     }

+    private function add_header(string $name, string $value): void
+    {
+        if ($this->psr7Compatible) {
+            // For PHPStan: should be enforced by template parameter but PHPStan is not smart enough.
+            /** @var array<string, non-empty-array<string>> */
+            $headers = &$this->headers;
+            $headers[$name][] = $value;
+        } else {
+            // For PHPStan: should be enforced by template parameter but PHPStan is not smart enough.
+            /** @var array<string, string>) */
+            $headers = &$this->headers;
+            $headers[$name] .= ', ' . $value;
+        }
+    }
+
+    private function replace_header(string $name, string $value): void
+    {
+        if ($this->psr7Compatible) {
+            // For PHPStan: should be enforced by template parameter but PHPStan is not smart enough.
+            /** @var array<string, non-empty-array<string>> */
+            $headers = &$this->headers;
+            $headers[$name] = [$value];
+        } else {
+            // For PHPStan: should be enforced by template parameter but PHPStan is not smart enough.
+            /** @var array<string, string>) */
+            $headers = &$this->headers;
+            $headers[$name] = $value;
+        }
+    }
+
     /**
      * Deal with a new line, shifting data around as needed
+     * @return void
      */
     protected function new_line()
     {
@@ -272,9 +275,9 @@ class Parser
             $this->name = strtolower($this->name);
             // We should only use the last Content-Type header. c.f. issue #1
             if (isset($this->headers[$this->name]) && $this->name !== 'content-type') {
-                $this->headers[$this->name] .= ', ' . $this->value;
+                $this->add_header($this->name, $this->value);
             } else {
-                $this->headers[$this->name] = $this->value;
+                $this->replace_header($this->name, $this->value);
             }
         }
         $this->name = '';
@@ -292,6 +295,7 @@ class Parser

     /**
      * Parse a header name
+     * @return void
      */
     protected function name()
     {
@@ -312,6 +316,7 @@ class Parser

     /**
      * Parse LWS, replacing consecutive LWS characters with a single space
+     * @return void
      */
     protected function linear_whitespace()
     {
@@ -328,6 +333,7 @@ class Parser

     /**
      * See what state to move to while within non-quoted header values
+     * @return void
      */
     protected function value()
     {
@@ -362,6 +368,7 @@ class Parser

     /**
      * Parse a header value while outside quotes
+     * @return void
      */
     protected function value_char()
     {
@@ -373,6 +380,7 @@ class Parser

     /**
      * See what state to move to while within quoted header values
+     * @return void
      */
     protected function quote()
     {
@@ -404,6 +412,7 @@ class Parser

     /**
      * Parse a header value while within quotes
+     * @return void
      */
     protected function quote_char()
     {
@@ -415,6 +424,7 @@ class Parser

     /**
      * Parse an escaped character within quotes
+     * @return void
      */
     protected function quote_escaped()
     {
@@ -425,6 +435,7 @@ class Parser

     /**
      * Parse the body
+     * @return void
      */
     protected function body()
     {
@@ -439,6 +450,7 @@ class Parser

     /**
      * Parsed a "Transfer-Encoding: chunked" body
+     * @return void
      */
     protected function chunked()
     {
@@ -459,6 +471,9 @@ class Parser
             }

             $length = hexdec(trim($matches[1]));
+            // For PHPStan: this will only be float when larger than PHP_INT_MAX.
+            // But even on 32-bit systems, it would mean 2GiB chunk, which sounds unlikely.
+            \assert(\is_int($length), "Length needs to be shorter than PHP_INT_MAX");
             if ($length === 0) {
                 // Ignore trailer headers
                 $this->state = self::STATE_EMIT;
@@ -485,11 +500,11 @@ class Parser
      * Prepare headers (take care of proxies headers)
      *
      * @param string  $headers Raw headers
-     * @param integer $count   Redirection count. Default to 1.
+     * @param non-negative-int $count Redirection count. Default to 1.
      *
      * @return string
      */
-    public static function prepareHeaders($headers, $count = 1)
+    public static function prepareHeaders(string $headers, int $count = 1)
     {
         $data = explode("\r\n\r\n", $headers, $count);
         $data = array_pop($data);
diff --git a/wp-includes/SimplePie/src/HTTP/Psr18Client.php b/wp-includes/SimplePie/src/HTTP/Psr18Client.php
new file mode 100644
index 0000000000..b920333e4d
--- /dev/null
+++ b/wp-includes/SimplePie/src/HTTP/Psr18Client.php
@@ -0,0 +1,162 @@
+<?php
+
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);
+
+namespace SimplePie\HTTP;
+
+use InvalidArgumentException;
+use Psr\Http\Client\ClientExceptionInterface;
+use Psr\Http\Client\ClientInterface;
+use Psr\Http\Message\RequestFactoryInterface;
+use Psr\Http\Message\UriFactoryInterface;
+use Throwable;
+
+/**
+ * HTTP Client based on PSR-18 and PSR-17 implementations
+ *
+ * @internal
+ */
+final class Psr18Client implements Client
+{
+    /**
+     * @var ClientInterface
+     */
+    private $httpClient;
+
+    /**
+     * @var RequestFactoryInterface
+     */
+    private $requestFactory;
+
+    /**
+     * @var UriFactoryInterface
+     */
+    private $uriFactory;
+
+    /**
+     * @var int
+     */
+    private $allowedRedirects = 5;
+
+    public function __construct(ClientInterface $httpClient, RequestFactoryInterface $requestFactory, UriFactoryInterface $uriFactory)
+    {
+        $this->httpClient = $httpClient;
+        $this->requestFactory = $requestFactory;
+        $this->uriFactory = $uriFactory;
+    }
+
+    public function getHttpClient(): ClientInterface
+    {
+        return $this->httpClient;
+    }
+
+    public function getRequestFactory(): RequestFactoryInterface
+    {
+        return $this->requestFactory;
+    }
+
+    public function getUriFactory(): UriFactoryInterface
+    {
+        return $this->uriFactory;
+    }
+
+    /**
+     * send a request and return the response
+     *
+     * @param Client::METHOD_* $method
+     * @param string $url
+     * @param array<string,string|string[]> $headers
+     *
+     * @throws ClientException if anything goes wrong requesting the data
+     */
+    public function request(string $method, string $url, array $headers = []): Response
+    {
+        if ($method !== self::METHOD_GET) {
+            throw new InvalidArgumentException(sprintf(
+                '%s(): Argument #1 ($method) only supports method "%s".',
+                __METHOD__,
+                self::METHOD_GET
+            ), 1);
+        }
+
+        if (preg_match('/^http(s)?:\/\//i', $url)) {
+            return $this->requestUrl($method, $url, $headers);
+        }
+
+        return $this->requestLocalFile($url);
+    }
+
+    /**
+     * @param array<string,string|string[]> $headers
+     */
+    private function requestUrl(string $method, string $url, array $headers): Response
+    {
+        $permanentUrl = $url;
+        $requestedUrl = $url;
+        $remainingRedirects = $this->allowedRedirects;
+
+        $request = $this->requestFactory->createRequest(
+            $method,
+            $this->uriFactory->createUri($requestedUrl)
+        );
+
+        foreach ($headers as $name => $value) {
+            $request = $request->withHeader($name, $value);
+        }
+
+        do {
+            $followRedirect = false;
+
+            try {
+                $response = $this->httpClient->sendRequest($request);
+            } catch (ClientExceptionInterface $th) {
+                throw new ClientException($th->getMessage(), $th->getCode(), $th);
+            }
+
+            $statusCode = $response->getStatusCode();
+
+            // If we have a redirect
+            if (in_array($statusCode, [300, 301, 302, 303, 307]) && $response->hasHeader('Location')) {
+                // Prevent infinity redirect loops
+                if ($remainingRedirects <= 0) {
+                    break;
+                }
+
+                $remainingRedirects--;
+                $followRedirect = true;
+
+                $requestedUrl = $response->getHeaderLine('Location');
+
+                if ($statusCode === 301) {
+                    $permanentUrl = $requestedUrl;
+                }
+
+                $request = $request->withUri($this->uriFactory->createUri($requestedUrl));
+            }
+        } while ($followRedirect);
+
+        return new Psr7Response($response, $permanentUrl, $requestedUrl);
+    }
+
+    private function requestLocalFile(string $path): Response
+    {
+        if (!is_readable($path)) {
+            throw new ClientException(sprintf('file "%s" is not readable', $path));
+        }
+
+        try {
+            $raw = file_get_contents($path);
+        } catch (Throwable $th) {
+            throw new ClientException($th->getMessage(), $th->getCode(), $th);
+        }
+
+        if ($raw === false) {
+            throw new ClientException('file_get_contents() could not read the file', 1);
+        }
+
+        return new RawTextResponse($raw, $path);
+    }
+}
diff --git a/wp-includes/SimplePie/src/HTTP/Psr7Response.php b/wp-includes/SimplePie/src/HTTP/Psr7Response.php
new file mode 100644
index 0000000000..418fddf523
--- /dev/null
+++ b/wp-includes/SimplePie/src/HTTP/Psr7Response.php
@@ -0,0 +1,91 @@
+<?php
+
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);
+
+namespace SimplePie\HTTP;
+
+use Psr\Http\Message\ResponseInterface;
+
+/**
+ * HTTP Response based on a PSR-7 response
+ *
+ * This interface must be interoperable with Psr\Http\Message\ResponseInterface
+ * @see https://www.php-fig.org/psr/psr-7/#33-psrhttpmessageresponseinterface
+ *
+ * @internal
+ */
+final class Psr7Response implements Response
+{
+    /**
+     * @var ResponseInterface
+     */
+    private $response;
+
+    /**
+     * @var string
+     */
+    private $permanent_url;
+
+    /**
+     * @var string
+     */
+    private $requested_url;
+
+    public function __construct(ResponseInterface $response, string $permanent_url, string $requested_url)
+    {
+        $this->response = $response;
+        $this->permanent_url = $permanent_url;
+        $this->requested_url = $requested_url;
+    }
+
+    public function get_permanent_uri(): string
+    {
+        return $this->permanent_url;
+    }
+
+    public function get_final_requested_uri(): string
+    {
+        return $this->requested_url;
+    }
+
+    public function get_status_code(): int
+    {
+        return $this->response->getStatusCode();
+    }
+
+    public function get_headers(): array
+    {
+        // The filtering is probably redundant but let’s make PHPStan happy.
+        return array_filter($this->response->getHeaders(), function (array $header): bool {
+            return count($header) >= 1;
+        });
+    }
+
+    public function has_header(string $name): bool
+    {
+        return $this->response->hasHeader($name);
+    }
+
+    public function with_header(string $name, $value)
+    {
+        return new self($this->response->withHeader($name, $value), $this->permanent_url, $this->requested_url);
+    }
+
+    public function get_header(string $name): array
+    {
+        return $this->response->getHeader($name);
+    }
+
+    public function get_header_line(string $name): string
+    {
+        return $this->response->getHeaderLine($name);
+    }
+
+    public function get_body_content(): string
+    {
+        return $this->response->getBody()->__toString();
+    }
+}
diff --git a/wp-includes/SimplePie/src/HTTP/RawTextResponse.php b/wp-includes/SimplePie/src/HTTP/RawTextResponse.php
new file mode 100644
index 0000000000..fee5e53725
--- /dev/null
+++ b/wp-includes/SimplePie/src/HTTP/RawTextResponse.php
@@ -0,0 +1,98 @@
+<?php
+
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);
+
+namespace SimplePie\HTTP;
+
+/**
+ * HTTP Response for rax text
+ *
+ * This interface must be interoperable with Psr\Http\Message\ResponseInterface
+ * @see https://www.php-fig.org/psr/psr-7/#33-psrhttpmessageresponseinterface
+ *
+ * @internal
+ */
+final class RawTextResponse implements Response
+{
+    /**
+     * @var string
+     */
+    private $raw_text;
+
+    /**
+     * @var string
+     */
+    private $permanent_url;
+
+    /**
+     * @var array<non-empty-array<string>>
+     */
+    private $headers = [];
+
+    /**
+     * @var string
+     */
+    private $requested_url;
+
+    public function __construct(string $raw_text, string $filepath)
+    {
+        $this->raw_text = $raw_text;
+        $this->permanent_url = $filepath;
+        $this->requested_url = $filepath;
+    }
+
+    public function get_permanent_uri(): string
+    {
+        return $this->permanent_url;
+    }
+
+    public function get_final_requested_uri(): string
+    {
+        return $this->requested_url;
+    }
+
+    public function get_status_code(): int
+    {
+        return 200;
+    }
+
+    public function get_headers(): array
+    {
+        return $this->headers;
+    }
+
+    public function has_header(string $name): bool
+    {
+        return isset($this->headers[strtolower($name)]);
+    }
+
+    public function get_header(string $name): array
+    {
+        return isset($this->headers[strtolower($name)]) ? $this->headers[$name] : [];
+    }
+
+    public function with_header(string $name, $value)
+    {
+        $new = clone $this;
+
+        $newHeader = [
+            strtolower($name) => (array) $value,
+        ];
+        $new->headers = $newHeader + $this->headers;
+
+        return $new;
+    }
+
+    public function get_header_line(string $name): string
+    {
+        return isset($this->headers[strtolower($name)]) ? implode(", ", $this->headers[$name]) : '';
+    }
+
+    public function get_body_content(): string
+    {
+        return $this->raw_text;
+    }
+}
diff --git a/wp-includes/SimplePie/src/HTTP/Response.php b/wp-includes/SimplePie/src/HTTP/Response.php
new file mode 100644
index 0000000000..cc52967586
--- /dev/null
+++ b/wp-includes/SimplePie/src/HTTP/Response.php
@@ -0,0 +1,171 @@
+<?php
+
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-FileCopyrightText: 2014 PHP Framework Interoperability Group
+// SPDX-License-Identifier: MIT
+
+declare(strict_types=1);
+
+namespace SimplePie\HTTP;
+
+/**
+ * HTTP Response interface
+ *
+ * This interface must be interoperable with Psr\Http\Message\ResponseInterface
+ * @see https://www.php-fig.org/psr/psr-7/#33-psrhttpmessageresponseinterface
+ *
+ * @internal
+ */
+interface Response
+{
+    /**
+     * Return the string representation of the permanent URI of the requested resource
+     * (the first location after a prefix of (only) permanent redirects).
+     *
+     * Depending on which components of the URI are present, the resulting
+     * string is either a full URI or relative reference according to RFC 3986,
+     * Section 4.1. The method concatenates the various components of the URI,
+     * using the appropriate delimiters:
+     *
+     * - If a scheme is present, it MUST be suffixed by ":".
+     * - If an authority is present, it MUST be prefixed by "//".
+     * - The path can be concatenated without delimiters. But there are two
+     *   cases where the path has to be adjusted to make the URI reference
+     *   valid as PHP does not allow to throw an exception in __toString():
+     *     - If the path is rootless and an authority is present, the path MUST
+     *       be prefixed by "/".
+     *     - If the path is starting with more than one "/" and no authority is
+     *       present, the starting slashes MUST be reduced to one.
+     * - If a query is present, it MUST be prefixed by "?".
+     * - If a fragment is present, it MUST be prefixed by "#".
+     *
+     * @see http://tools.ietf.org/html/rfc3986#section-4.1
+     */
+    public function get_permanent_uri(): string;
+
+    /**
+     * Return the string representation of the final requested URL after following all redirects.
+     *
+     * Depending on which components of the URI are present, the resulting
+     * string is either a full URI or relative reference according to RFC 3986,
+     * Section 4.1. The method concatenates the various components of the URI,
+     * using the appropriate delimiters:
+     *
+     * - If a scheme is present, it MUST be suffixed by ":".
+     * - If an authority is present, it MUST be prefixed by "//".
+     * - The path can be concatenated without delimiters. But there are two
+     *   cases where the path has to be adjusted to make the URI reference
+     *   valid as PHP does not allow to throw an exception in __toString():
+     *     - If the path is rootless and an authority is present, the path MUST
+     *       be prefixed by "/".
+     *     - If the path is starting with more than one "/" and no authority is
+     *       present, the starting slashes MUST be reduced to one.
+     * - If a query is present, it MUST be prefixed by "?".
+     * - If a fragment is present, it MUST be prefixed by "#".
+     *
+     * @see http://tools.ietf.org/html/rfc3986#section-4.1
+     */
+    public function get_final_requested_uri(): string;
+
+    /**
+     * Gets the response status code.
+     *
+     * The status code is a 3-digit integer result code of the server's attempt
+     * to understand and satisfy the request.
+     *
+     * @return int Status code.
+     */
+    public function get_status_code(): int;
+
+    /**
+     * Retrieves all message header values.
+     *
+     * The keys represent the header name as it will be sent over the wire, and
+     * each value is an array of strings associated with the header.
+     *
+     *     // Represent the headers as a string
+     *     foreach ($message->get_headers() as $name => $values) {
+     *         echo $name . ': ' . implode(', ', $values);
+     *     }
+     *
+     *     // Emit headers iteratively:
+     *     foreach ($message->get_headers() as $name => $values) {
+     *         foreach ($values as $value) {
+     *             header(sprintf('%s: %s', $name, $value), false);
+     *         }
+     *     }
+     *
+     * @return array<non-empty-array<string>> Returns an associative array of the message's headers.
+     *     Each key MUST be a header name, and each value MUST be an array of
+     *     strings for that header.
+     */
+    public function get_headers(): array;
+
+    /**
+     * Checks if a header exists by the given case-insensitive name.
+     *
+     * @param string $name Case-insensitive header field name.
+     * @return bool Returns true if any header names match the given header
+     *     name using a case-insensitive string comparison. Returns false if
+     *     no matching header name is found in the message.
+     */
+    public function has_header(string $name): bool;
+
+    /**
+     * Retrieves a message header value by the given case-insensitive name.
+     *
+     * This method returns an array of all the header values of the given
+     * case-insensitive header name.
+     *
+     * If the header does not appear in the message, this method MUST return an
+     * empty array.
+     *
+     * @param string $name Case-insensitive header field name.
+     * @return string[] An array of string values as provided for the given
+     *    header. If the header does not appear in the message, this method MUST
+     *    return an empty array.
+     */
+    public function get_header(string $name): array;
+
+    /**
+     * Return an instance with the provided value replacing the specified header.
+     *
+     * This method MUST be implemented in such a way as to retain the
+     * immutability of the message, and MUST return an instance that has the
+     * new and/or updated header and value.
+     *
+     * @param string $name Case-insensitive header field name.
+     * @param string|non-empty-array<string> $value Header value(s).
+     * @return static
+     * @throws \InvalidArgumentException for invalid header names or values.
+     */
+    public function with_header(string $name, $value);
+
+    /**
+     * Retrieves a comma-separated string of the values for a single header.
+     *
+     * This method returns all of the header values of the given
+     * case-insensitive header name as a string concatenated together using
+     * a comma.
+     *
+     * NOTE: Not all header values may be appropriately represented using
+     * comma concatenation. For such headers, use getHeader() instead
+     * and supply your own delimiter when concatenating.
+     *
+     * If the header does not appear in the message, this method MUST return
+     * an empty string.
+     *
+     * @param string $name Case-insensitive header field name.
+     * @return string A string of values as provided for the given header
+     *    concatenated together using a comma. If the header does not appear in
+     *    the message, this method MUST return an empty string.
+     */
+    public function get_header_line(string $name): string;
+
+    /**
+     * get the body as string
+     *
+     * @return string
+     */
+    public function get_body_content(): string;
+}
diff --git a/wp-includes/SimplePie/src/IRI.php b/wp-includes/SimplePie/src/IRI.php
index dfd5eaa8a1..7fc538cd43 100644
--- a/wp-includes/SimplePie/src/IRI.php
+++ b/wp-includes/SimplePie/src/IRI.php
@@ -1,87 +1,53 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-FileCopyrightText: 2008 Steve Minutillo
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie;

 /**
  * IRI parser/serialiser/normaliser
  *
- * @package SimplePie
- * @subpackage HTTP
- * @author Sam Sneddon
- * @author Steve Minutillo
- * @author Ryan McCue
- * @copyright 2007-2012 Sam Sneddon, Steve Minutillo, Ryan McCue
- * @license http://www.opensource.org/licenses/bsd-license.php
+ * @property ?string $scheme
+ * @property ?string $userinfo
+ * @property ?string $host
+ * @property ?int $port
+ * @property-write int|string|null $port
+ * @property ?string $authority
+ * @property string $path
+ * @property ?string $query
+ * @property ?string $fragment
  */
 class IRI
 {
     /**
      * Scheme
      *
-     * @var string
+     * @var ?string
      */
     protected $scheme = null;

     /**
      * User Information
      *
-     * @var string
+     * @var ?string
      */
     protected $iuserinfo = null;

     /**
      * ihost
      *
-     * @var string
+     * @var ?string
      */
     protected $ihost = null;

     /**
      * Port
      *
-     * @var string
+     * @var ?int
      */
     protected $port = null;

@@ -95,14 +61,14 @@ class IRI
     /**
      * iquery
      *
-     * @var string
+     * @var ?string
      */
     protected $iquery = null;

     /**
      * ifragment
      *
-     * @var string
+     * @var ?string
      */
     protected $ifragment = null;

@@ -111,6 +77,8 @@ class IRI
      *
      * Each key is the scheme, each value is an array with each key as the IRI
      * part and value as the default value for that part.
+     *
+     * @var array<string, array<string, mixed>>
      */
     protected $normalization = [
         'acap' => [
@@ -139,7 +107,7 @@ class IRI
      */
     public function __toString()
     {
-        return $this->get_iri();
+        return (string) $this->get_iri();
     }

     /**
@@ -147,11 +115,13 @@ class IRI
      *
      * @param string $name Property name
      * @param mixed $value Property value
+     * @return void
      */
-    public function __set($name, $value)
+    public function __set(string $name, $value)
     {
-        if (method_exists($this, 'set_' . $name)) {
-            call_user_func([$this, 'set_' . $name], $value);
+        $callable = [$this, 'set_' . $name];
+        if (is_callable($callable)) {
+            call_user_func($callable, $value);
         } elseif (
             $name === 'iauthority'
             || $name === 'iuserinfo'
@@ -170,7 +140,7 @@ class IRI
      * @param string $name Property name
      * @return mixed
      */
-    public function __get($name)
+    public function __get(string $name)
     {
         // isset() returns false for null, we don't want to do that
         // Also why we use array_key_exists below instead of isset()
@@ -187,7 +157,7 @@ class IRI
             $return = $this->$name;
         }
         // host -> ihost
-        elseif (($prop = 'i' . $name) && array_key_exists($prop, $props)) {
+        elseif (array_key_exists($prop = 'i' . $name, $props)) {
             $name = $prop;
             $return = $this->$prop;
         }
@@ -213,7 +183,7 @@ class IRI
      * @param string $name Property name
      * @return bool
      */
-    public function __isset($name)
+    public function __isset(string $name)
     {
         return method_exists($this, 'get_' . $name) || isset($this->$name);
     }
@@ -222,26 +192,29 @@ class IRI
      * Overload __unset() to provide access via properties
      *
      * @param string $name Property name
+     * @return void
      */
-    public function __unset($name)
+    public function __unset(string $name)
     {
-        if (method_exists($this, 'set_' . $name)) {
-            call_user_func([$this, 'set_' . $name], '');
+        $callable = [$this, 'set_' . $name];
+        if (is_callable($callable)) {
+            call_user_func($callable, '');
         }
     }

     /**
      * Create a new IRI object, from a specified string
      *
-     * @param string $iri
+     * @param string|null $iri
      */
-    public function __construct($iri = null)
+    public function __construct(?string $iri = null)
     {
         $this->set_iri($iri);
     }

     /**
      * Clean up
+     * @return void
      */
     public function __destruct()
     {
@@ -321,27 +294,21 @@ class IRI
      * Parse an IRI into scheme/authority/path/query/fragment segments
      *
      * @param string $iri
-     * @return array
+     * @return array{
+     *   scheme: string|null,
+     *   authority: string|null,
+     *   path: string,
+     *   query: string|null,
+     *   fragment: string|null,
+     * }|false
      */
-    protected function parse_iri($iri)
+    protected function parse_iri(string $iri)
     {
         $iri = trim($iri, "\x20\x09\x0A\x0C\x0D");
-        if (preg_match('/^((?P<scheme>[^:\/?#]+):)?(\/\/(?P<authority>[^\/?#]*))?(?P<path>[^?#]*)(\?(?P<query>[^#]*))?(#(?P<fragment>.*))?$/', $iri, $match)) {
-            if ($match[1] === '') {
-                $match['scheme'] = null;
-            }
-            if (!isset($match[3]) || $match[3] === '') {
-                $match['authority'] = null;
-            }
-            if (!isset($match[5])) {
-                $match['path'] = '';
-            }
-            if (!isset($match[6]) || $match[6] === '') {
-                $match['query'] = null;
-            }
-            if (!isset($match[8]) || $match[8] === '') {
-                $match['fragment'] = null;
-            }
+        if (preg_match('/^(?:(?P<scheme>[^:\/?#]+):)?(:?\/\/(?P<authority>[^\/?#]*))?(?P<path>[^?#]*)(?:\?(?P<query>[^#]*))?(?:#(?P<fragment>.*))?$/', $iri, $match, \PREG_UNMATCHED_AS_NULL)) {
+            // TODO: Remove once we require PHP ≥ 7.4.
+            $match['query'] = $match['query'] ?? null;
+            $match['fragment'] = $match['fragment'] ?? null;
             return $match;
         }

@@ -355,7 +322,7 @@ class IRI
      * @param string $input
      * @return string
      */
-    protected function remove_dot_segments($input)
+    protected function remove_dot_segments(string $input)
     {
         $output = '';
         while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..') {
@@ -404,13 +371,15 @@ class IRI
      * @param bool $iprivate Allow iprivate
      * @return string
      */
-    protected function replace_invalid_with_pct_encoding($string, $extra_chars, $iprivate = false)
+    protected function replace_invalid_with_pct_encoding(string $string, string $extra_chars, bool $iprivate = false)
     {
         // Normalize as many pct-encoded sections as possible
         $string = preg_replace_callback('/(?:%[A-Fa-f0-9]{2})+/', [$this, 'remove_iunreserved_percent_encoded'], $string);
+        \assert(\is_string($string), "For PHPStan: Should not occur, the regex is valid");

         // Replace invalid percent characters
         $string = preg_replace('/%(?![A-Fa-f0-9]{2})/', '%25', $string);
+        \assert(\is_string($string), "For PHPStan: Should not occur, the regex is valid");

         // Add unreserved and % to $extra_chars (the latter is safe because all
         // pct-encoded sections are now valid).
@@ -525,10 +494,10 @@ class IRI
      * Removes sequences of percent encoded bytes that represent UTF-8
      * encoded characters in iunreserved
      *
-     * @param array $match PCRE match
+     * @param array{string} $match PCRE match, a capture group #0 consisting of a sequence of valid percent-encoded bytes
      * @return string Replacement
      */
-    protected function remove_iunreserved_percent_encoded($match)
+    protected function remove_iunreserved_percent_encoded(array $match)
     {
         // As we just have valid percent encoded sequences we can just explode
         // and ignore the first member of the returned array (an empty string).
@@ -631,7 +600,8 @@ class IRI
                     }
                 } else {
                     for ($j = $start; $j <= $i; $j++) {
-                        $string .= chr(hexdec($bytes[$j]));
+                        // Cast for PHPStan, this will always be a number between 0 and 0xFF so hexdec will return int.
+                        $string .= chr((int) hexdec($bytes[$j]));
                     }
                 }
             }
@@ -648,6 +618,9 @@ class IRI
         return $string;
     }

+    /**
+     * @return void
+     */
     protected function scheme_normalization()
     {
         if (isset($this->normalization[$this->scheme]['iuserinfo']) && $this->iuserinfo === $this->normalization[$this->scheme]['iuserinfo']) {
@@ -708,15 +681,15 @@ class IRI
      * Set the entire IRI. Returns true on success, false on failure (if there
      * are any invalid characters).
      *
-     * @param string $iri
+     * @param string|null $iri
      * @return bool
      */
-    public function set_iri($iri, $clear_cache = false)
+    public function set_iri(?string $iri, bool $clear_cache = false)
     {
         static $cache;
         if ($clear_cache) {
             $cache = null;
-            return;
+            return false;
         }
         if (!$cache) {
             $cache = [];
@@ -768,10 +741,10 @@ class IRI
      * Set the scheme. Returns true on success, false on failure (if there are
      * any invalid characters).
      *
-     * @param string $scheme
+     * @param string|null $scheme
      * @return bool
      */
-    public function set_scheme($scheme)
+    public function set_scheme(?string $scheme)
     {
         if ($scheme === null) {
             $this->scheme = null;
@@ -788,15 +761,15 @@ class IRI
      * Set the authority. Returns true on success, false on failure (if there are
      * any invalid characters).
      *
-     * @param string $authority
+     * @param string|null $authority
      * @return bool
      */
-    public function set_authority($authority, $clear_cache = false)
+    public function set_authority(?string $authority, bool $clear_cache = false)
     {
         static $cache;
         if ($clear_cache) {
             $cache = null;
-            return;
+            return false;
         }
         if (!$cache) {
             $cache = [];
@@ -820,13 +793,16 @@ class IRI

         $remaining = $authority;
         if (($iuserinfo_end = strrpos($remaining, '@')) !== false) {
-            $iuserinfo = substr($remaining, 0, $iuserinfo_end);
+            // Cast for PHPStan on PHP < 8.0. It does not detect that
+            // the range is not flipped so substr cannot return false.
+            $iuserinfo = (string) substr($remaining, 0, $iuserinfo_end);
             $remaining = substr($remaining, $iuserinfo_end + 1);
         } else {
             $iuserinfo = null;
         }
         if (($port_start = strpos($remaining, ':', intval(strpos($remaining, ']')))) !== false) {
-            if (($port = substr($remaining, $port_start + 1)) === false) {
+            $port = substr($remaining, $port_start + 1);
+            if ($port === false) {
                 $port = null;
             }
             $remaining = substr($remaining, 0, $port_start);
@@ -851,10 +827,10 @@ class IRI
     /**
      * Set the iuserinfo.
      *
-     * @param string $iuserinfo
+     * @param string|null $iuserinfo
      * @return bool
      */
-    public function set_userinfo($iuserinfo)
+    public function set_userinfo(?string $iuserinfo)
     {
         if ($iuserinfo === null) {
             $this->iuserinfo = null;
@@ -870,10 +846,10 @@ class IRI
      * Set the ihost. Returns true on success, false on failure (if there are
      * any invalid characters).
      *
-     * @param string $ihost
+     * @param string|null $ihost
      * @return bool
      */
-    public function set_host($ihost)
+    public function set_host(?string $ihost)
     {
         if ($ihost === null) {
             $this->ihost = null;
@@ -914,7 +890,7 @@ class IRI
      * Set the port. Returns true on success, false on failure (if there are
      * any invalid characters).
      *
-     * @param string $port
+     * @param string|int|null $port
      * @return bool
      */
     public function set_port($port)
@@ -922,7 +898,7 @@ class IRI
         if ($port === null) {
             $this->port = null;
             return true;
-        } elseif (strspn($port, '0123456789') === strlen($port)) {
+        } elseif (strspn((string) $port, '0123456789') === strlen((string) $port)) {
             $this->port = (int) $port;
             $this->scheme_normalization();
             return true;
@@ -935,15 +911,15 @@ class IRI
     /**
      * Set the ipath.
      *
-     * @param string $ipath
+     * @param string|null $ipath
      * @return bool
      */
-    public function set_path($ipath, $clear_cache = false)
+    public function set_path(?string $ipath, bool $clear_cache = false)
     {
         static $cache;
         if ($clear_cache) {
             $cache = null;
-            return;
+            return false;
         }
         if (!$cache) {
             $cache = [];
@@ -968,10 +944,10 @@ class IRI
     /**
      * Set the iquery.
      *
-     * @param string $iquery
+     * @param string|null $iquery
      * @return bool
      */
-    public function set_query($iquery)
+    public function set_query(?string $iquery)
     {
         if ($iquery === null) {
             $this->iquery = null;
@@ -985,10 +961,10 @@ class IRI
     /**
      * Set the ifragment.
      *
-     * @param string $ifragment
+     * @param string|null $ifragment
      * @return bool
      */
-    public function set_fragment($ifragment)
+    public function set_fragment(?string $ifragment)
     {
         if ($ifragment === null) {
             $this->ifragment = null;
@@ -1002,9 +978,10 @@ class IRI
     /**
      * Convert an IRI to a URI (or parts thereof)
      *
+     * @param string $string
      * @return string
      */
-    public function to_uri($string)
+    public function to_uri(string $string)
     {
         static $non_ascii;
         if (!$non_ascii) {
@@ -1025,7 +1002,7 @@ class IRI
     /**
      * Get the complete IRI
      *
-     * @return string
+     * @return string|false
      */
     public function get_iri()
     {
@@ -1062,13 +1039,13 @@ class IRI
      */
     public function get_uri()
     {
-        return $this->to_uri($this->get_iri());
+        return $this->to_uri((string) $this->get_iri());
     }

     /**
      * Get the complete iauthority
      *
-     * @return string
+     * @return ?string
      */
     protected function get_iauthority()
     {
@@ -1092,7 +1069,7 @@ class IRI
     /**
      * Get the complete authority
      *
-     * @return string
+     * @return ?string
      */
     protected function get_authority()
     {
diff --git a/wp-includes/SimplePie/src/Item.php b/wp-includes/SimplePie/src/Item.php
index 3ec8f2f982..c2f7460c61 100644
--- a/wp-includes/SimplePie/src/Item.php
+++ b/wp-includes/SimplePie/src/Item.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie;

@@ -50,9 +13,6 @@ namespace SimplePie;
  * Used by {@see \SimplePie\SimplePie::get_item()} and {@see \SimplePie\SimplePie::get_items()}
  *
  * This class can be overloaded with {@see \SimplePie\SimplePie::set_item_class()}
- *
- * @package \SimplePie\SimplePie
- * @subpackage API
  */
 class Item implements RegistryAware
 {
@@ -68,7 +28,7 @@ class Item implements RegistryAware
      * Raw data
      *
      * @access private
-     * @var array
+     * @var array<string, mixed>
      */
     public $data = [];

@@ -80,6 +40,11 @@ class Item implements RegistryAware
      */
     protected $registry;

+    /**
+     * @var Sanitize|null
+     */
+    private $sanitize = null;
+
     /**
      * Create a new item object
      *
@@ -87,9 +52,9 @@ class Item implements RegistryAware
      * {@see \SimplePie\SimplePie::get_item}. Avoid creating this manually.
      *
      * @param \SimplePie\SimplePie $feed Parent feed
-     * @param array $data Raw data
+     * @param array<string, mixed> $data Raw data
      */
-    public function __construct($feed, $data)
+    public function __construct(\SimplePie\SimplePie $feed, array $data)
     {
         $this->feed = $feed;
         $this->data = $data;
@@ -102,8 +67,9 @@ class Item implements RegistryAware
      *
      * @since 1.3
      * @param \SimplePie\Registry $registry
+     * @return void
      */
-    public function set_registry(\SimplePie\Registry $registry)/* : void */
+    public function set_registry(\SimplePie\Registry $registry)
     {
         $this->registry = $registry;
     }
@@ -140,9 +106,9 @@ class Item implements RegistryAware
      * @see http://simplepie.org/wiki/faq/supported_xml_namespaces
      * @param string $namespace The URL of the XML namespace of the elements you're trying to access
      * @param string $tag Tag name
-     * @return array
+     * @return array<array<string, mixed>>|null
      */
-    public function get_item_tags($namespace, $tag)
+    public function get_item_tags(string $namespace, string $tag)
     {
         if (isset($this->data['child'][$namespace][$tag])) {
             return $this->data['child'][$namespace][$tag];
@@ -151,14 +117,32 @@ class Item implements RegistryAware
         return null;
     }

+    /**
+     * Get base URL of the item itself.
+     * Returns `<xml:base>` or feed base URL.
+     * Similar to `Item::get_base()` but can safely be used during initialisation methods
+     * such as `Item::get_links()` (`Item::get_base()` and `Item::get_links()` call each-other)
+     * and is not affected by enclosures.
+     *
+     * @param array<string, mixed> $element
+     * @see get_base
+     */
+    private function get_own_base(array $element = []): string
+    {
+        if (!empty($element['xml_base_explicit']) && isset($element['xml_base'])) {
+            return $element['xml_base'];
+        }
+        return $this->feed->get_base();
+    }
+
     /**
      * Get the base URL value.
-     * Uses `<xml:base>`, or item link, or feed base URL.
+     * Uses `<xml:base>`, or item link, or enclosure link, or feed base URL.
      *
-     * @param array $element
+     * @param array<string, mixed> $element
      * @return string
      */
-    public function get_base($element = [])
+    public function get_base(array $element = [])
     {
         if (!empty($element['xml_base_explicit']) && isset($element['xml_base'])) {
             return $element['xml_base'];
@@ -176,12 +160,13 @@ class Item implements RegistryAware
      * @access private
      * @see \SimplePie\SimplePie::sanitize()
      * @param string $data Data to sanitize
-     * @param int $type One of the \SimplePie\SimplePie::CONSTRUCT_* constants
+     * @param int-mask-of<SimplePie::CONSTRUCT_*> $type
      * @param string $base Base URL to resolve URLs against
      * @return string Sanitized data
      */
-    public function sanitize($data, $type, $base = '')
+    public function sanitize(string $data, int $type, string $base = '')
     {
+        // This really returns string|false but changing encoding is uncommon and we are going to deprecate it, so let’s just lie to PHPStan in the interest of cleaner annotations.
         return $this->feed->sanitize($data, $type, $base);
     }

@@ -209,11 +194,11 @@ class Item implements RegistryAware
      * MD5 hash based on the permalink, title and content.
      *
      * @since Beta 2
-     * @param boolean $hash Should we force using a hash instead of the supplied ID?
+     * @param bool $hash Should we force using a hash instead of the supplied ID?
      * @param string|false $fn User-supplied function to generate an hash
      * @return string|null
      */
-    public function get_id($hash = false, $fn = 'md5')
+    public function get_id(bool $hash = false, $fn = 'md5')
     {
         if (!$hash) {
             if ($return = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_10, 'id')) {
@@ -286,10 +271,10 @@ class Item implements RegistryAware
      * `<itunes:subtitle>`
      *
      * @since 0.8
-     * @param boolean $description_only Should we avoid falling back to the content?
+     * @param bool $description_only Should we avoid falling back to the content?
      * @return string|null
      */
-    public function get_description($description_only = false)
+    public function get_description(bool $description_only = false)
     {
         if (($tags = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_10, 'summary')) &&
             ($return = $this->sanitize($tags[0]['data'], $this->registry->call(Misc::class, 'atom_10_construct_type', [$tags[0]['attribs']]), $this->get_base($tags[0])))) {
@@ -336,10 +321,10 @@ class Item implements RegistryAware
      * Uses `<atom:content>` or `<content:encoded>` (RSS 1.0 Content Module)
      *
      * @since 1.0
-     * @param boolean $content_only Should we avoid falling back to the description?
+     * @param bool $content_only Should we avoid falling back to the description?
      * @return string|null
      */
-    public function get_content($content_only = false)
+    public function get_content(bool $content_only = false)
     {
         if (($tags = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_10, 'content')) &&
             ($return = $this->sanitize($tags[0]['data'], $this->registry->call(Misc::class, 'atom_10_content_construct_type', [$tags[0]['attribs']]), $this->get_base($tags[0])))) {
@@ -363,7 +348,7 @@ class Item implements RegistryAware
      * Uses `<media:thumbnail>`
      *
      *
-     * @return array|null
+     * @return array{url: string, height?: string, width?: string, time?: string}|null
      */
     public function get_thumbnail()
     {
@@ -390,7 +375,7 @@ class Item implements RegistryAware
      * @param int $key The category that you want to return.  Remember that arrays begin with 0, not 1
      * @return \SimplePie\Category|null
      */
-    public function get_category($key = 0)
+    public function get_category(int $key = 0)
     {
         $categories = $this->get_categories();
         if (isset($categories[$key])) {
@@ -462,7 +447,7 @@ class Item implements RegistryAware
      * @param int $key The author that you want to return.  Remember that arrays begin with 0, not 1
      * @return \SimplePie\Author|null
      */
-    public function get_author($key = 0)
+    public function get_author(int $key = 0)
     {
         $authors = $this->get_authors();
         if (isset($authors[$key])) {
@@ -479,7 +464,7 @@ class Item implements RegistryAware
      * @param int $key The contrbutor that you want to return.  Remember that arrays begin with 0, not 1
      * @return \SimplePie\Author|null
      */
-    public function get_contributor($key = 0)
+    public function get_contributor(int $key = 0)
     {
         $contributors = $this->get_contributors();
         if (isset($contributors[$key])) {
@@ -508,7 +493,8 @@ class Item implements RegistryAware
                 $name = $this->sanitize($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['name'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
             }
             if (isset($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['uri'][0]['data'])) {
-                $uri = $this->sanitize($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['uri'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['uri'][0]));
+                $uri = $contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['uri'][0];
+                $uri = $this->sanitize($uri['data'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($uri));
             }
             if (isset($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['email'][0]['data'])) {
                 $email = $this->sanitize($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['email'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
@@ -525,7 +511,8 @@ class Item implements RegistryAware
                 $name = $this->sanitize($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['name'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
             }
             if (isset($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['url'][0]['data'])) {
-                $url = $this->sanitize($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['url'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['url'][0]));
+                $url = $contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['url'][0];
+                $url = $this->sanitize($url['data'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($url));
             }
             if (isset($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['email'][0]['data'])) {
                 $email = $this->sanitize($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['email'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
@@ -561,7 +548,8 @@ class Item implements RegistryAware
                 $name = $this->sanitize($author['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['name'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
             }
             if (isset($author['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['uri'][0]['data'])) {
-                $uri = $this->sanitize($author['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['uri'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($author['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['uri'][0]));
+                $uri = $author['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['uri'][0];
+                $uri = $this->sanitize($uri['data'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($uri));
             }
             if (isset($author['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['email'][0]['data'])) {
                 $email = $this->sanitize($author['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['email'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
@@ -578,7 +566,8 @@ class Item implements RegistryAware
                 $name = $this->sanitize($author[0]['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['name'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
             }
             if (isset($author[0]['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['url'][0]['data'])) {
-                $url = $this->sanitize($author[0]['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['url'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($author[0]['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['url'][0]));
+                $url = $author[0]['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['url'][0];
+                $url = $this->sanitize($url['data'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($url));
             }
             if (isset($author[0]['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['email'][0]['data'])) {
                 $email = $this->sanitize($author[0]['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['email'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
@@ -617,7 +606,7 @@ class Item implements RegistryAware
      * Uses `<atom:rights>` or `<dc:rights>`
      *
      * @since 1.1
-     * @return string
+     * @return string|null
      */
     public function get_copyright()
     {
@@ -644,9 +633,9 @@ class Item implements RegistryAware
      * @since Beta 2 (previously called `get_item_date` since 0.8)
      *
      * @param string $date_format Supports any PHP date format from {@see http://php.net/date} (empty for the raw data)
-     * @return int|string|null
+     * @return ($date_format is 'U' ? ?int : ?string)
      */
-    public function get_date($date_format = 'j F Y, g:i a')
+    public function get_date(string $date_format = 'j F Y, g:i a')
     {
         if (!isset($this->data['date'])) {
             if ($return = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_10, 'published')) {
@@ -675,7 +664,6 @@ class Item implements RegistryAware
             }
         }
         if ($this->data['date']) {
-            $date_format = (string) $date_format;
             switch ($date_format) {
                 case '':
                     return $this->sanitize($this->data['date']['raw'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
@@ -700,9 +688,9 @@ class Item implements RegistryAware
      * {@see get_gmdate}
      *
      * @param string $date_format Supports any PHP date format from {@see http://php.net/date} (empty for the raw data)
-     * @return int|string|null
+     * @return ($date_format is 'U' ? ?int : ?string)
      */
-    public function get_updated_date($date_format = 'j F Y, g:i a')
+    public function get_updated_date(string $date_format = 'j F Y, g:i a')
     {
         if (!isset($this->data['updated'])) {
             if ($return = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_10, 'updated')) {
@@ -717,7 +705,6 @@ class Item implements RegistryAware
             }
         }
         if ($this->data['updated']) {
-            $date_format = (string) $date_format;
             switch ($date_format) {
                 case '':
                     return $this->sanitize($this->data['updated']['raw'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
@@ -744,12 +731,16 @@ class Item implements RegistryAware
      * @since 1.0
      *
      * @param string $date_format Supports any PHP date format from {@see http://php.net/strftime} (empty for the raw data)
-     * @return int|string|null
+     * @return string|null|false see `strftime` for when this can return `false`
      */
-    public function get_local_date($date_format = '%c')
+    public function get_local_date(string $date_format = '%c')
     {
-        if (!$date_format) {
-            return $this->sanitize($this->get_date(''), \SimplePie\SimplePie::CONSTRUCT_TEXT);
+        if ($date_format === '') {
+            if (($raw_date = $this->get_date('')) === null) {
+                return null;
+            }
+
+            return $this->sanitize($raw_date, \SimplePie\SimplePie::CONSTRUCT_TEXT);
         } elseif (($date = $this->get_date('U')) !== null && $date !== false) {
             return strftime($date_format, $date);
         }
@@ -762,9 +753,9 @@ class Item implements RegistryAware
      *
      * @see get_date
      * @param string $date_format Supports any PHP date format from {@see http://php.net/date}
-     * @return int|string|null
+     * @return string|null
      */
-    public function get_gmdate($date_format = 'j F Y, g:i a')
+    public function get_gmdate(string $date_format = 'j F Y, g:i a')
     {
         $date = $this->get_date('U');
         if ($date === null) {
@@ -779,9 +770,9 @@ class Item implements RegistryAware
      *
      * @see get_updated_date
      * @param string $date_format Supports any PHP date format from {@see http://php.net/date}
-     * @return int|string|null
+     * @return string|null
      */
-    public function get_updated_gmdate($date_format = 'j F Y, g:i a')
+    public function get_updated_gmdate(string $date_format = 'j F Y, g:i a')
     {
         $date = $this->get_updated_date('U');
         if ($date === null) {
@@ -822,7 +813,7 @@ class Item implements RegistryAware
      * @param string $rel The relationship of the link to return
      * @return string|null Link URL
      */
-    public function get_link($key = 0, $rel = 'alternate')
+    public function get_link(int $key = 0, string $rel = 'alternate')
     {
         $links = $this->get_links($rel);
         if ($links && $links[$key] !== null) {
@@ -839,36 +830,36 @@ class Item implements RegistryAware
      *
      * @since Beta 2
      * @param string $rel The relationship of links to return
-     * @return array|null Links found for the item (strings)
+     * @return array<string>|null Links found for the item (strings)
      */
-    public function get_links($rel = 'alternate')
+    public function get_links(string $rel = 'alternate')
     {
         if (!isset($this->data['links'])) {
             $this->data['links'] = [];
             foreach ((array) $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_10, 'link') as $link) {
                 if (isset($link['attribs']['']['href'])) {
                     $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
-                    $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($link));
+                    $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_own_base($link));
                 }
             }
             foreach ((array) $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_03, 'link') as $link) {
                 if (isset($link['attribs']['']['href'])) {
                     $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
-                    $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($link));
+                    $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_own_base($link));
                 }
             }
             if ($links = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_RSS_10, 'link')) {
-                $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($links[0]));
+                $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_own_base($links[0]));
             }
             if ($links = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_RSS_090, 'link')) {
-                $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($links[0]));
+                $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_own_base($links[0]));
             }
             if ($links = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_RSS_20, 'link')) {
-                $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($links[0]));
+                $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_own_base($links[0]));
             }
             if ($links = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_RSS_20, 'guid')) {
                 if (!isset($links[0]['attribs']['']['isPermaLink']) || strtolower(trim($links[0]['attribs']['']['isPermaLink'])) === 'true') {
-                    $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($links[0]));
+                    $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_own_base($links[0]));
                 }
             }

@@ -881,8 +872,8 @@ class Item implements RegistryAware
                     } else {
                         $this->data['links'][\SimplePie\SimplePie::IANA_LINK_RELATIONS_REGISTRY . $key] = &$this->data['links'][$key];
                     }
-                } elseif (substr($key, 0, 41) === \SimplePie\SimplePie::IANA_LINK_RELATIONS_REGISTRY) {
-                    $this->data['links'][substr($key, 41)] = &$this->data['links'][$key];
+                } elseif (substr((string) $key, 0, 41) === \SimplePie\SimplePie::IANA_LINK_RELATIONS_REGISTRY) {
+                    $this->data['links'][substr((string) $key, 41)] = &$this->data['links'][$key];
                 }
                 $this->data['links'][$key] = array_unique($this->data['links'][$key]);
             }
@@ -904,7 +895,7 @@ class Item implements RegistryAware
      * @param int $key The enclosure that you want to return.  Remember that arrays begin with 0, not 1
      * @return \SimplePie\Enclosure|null
      */
-    public function get_enclosure($key = 0, $prefer = null)
+    public function get_enclosure(int $key = 0)
     {
         $enclosures = $this->get_enclosures();
         if (isset($enclosures[$key])) {
@@ -944,7 +935,7 @@ class Item implements RegistryAware
             $keywords_parent = null;
             $player_parent = null;
             $ratings_parent = null;
-            $restrictions_parent = null;
+            $restrictions_parent = [];
             $thumbnails_parent = null;
             $title_parent = null;

@@ -1139,20 +1130,19 @@ class Item implements RegistryAware
             }

             // DURATION
-            if ($duration_parent = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_ITUNES, 'duration')) {
+            $duration_tags = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_ITUNES, 'duration');
+            if ($duration_tags !== null) {
                 $seconds = null;
                 $minutes = null;
                 $hours = null;
-                if (isset($duration_parent[0]['data'])) {
-                    $temp = explode(':', $this->sanitize($duration_parent[0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT));
-                    if (sizeof($temp) > 0) {
-                        $seconds = (int) array_pop($temp);
-                    }
-                    if (sizeof($temp) > 0) {
+                if (isset($duration_tags[0]['data'])) {
+                    $temp = explode(':', $this->sanitize($duration_tags[0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT));
+                    $seconds = (int) array_pop($temp);
+                    if (count($temp) > 0) {
                         $minutes = (int) array_pop($temp);
                         $seconds += $minutes * 60;
                     }
-                    if (sizeof($temp) > 0) {
+                    if (count($temp) > 0) {
                         $hours = (int) array_pop($temp);
                         $seconds += $hours * 3600;
                     }
@@ -1236,11 +1226,11 @@ class Item implements RegistryAware
             // PLAYER
             if ($player_parent = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_MEDIARSS, 'player')) {
                 if (isset($player_parent[0]['attribs']['']['url'])) {
-                    $player_parent = $this->sanitize($player_parent[0]['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI);
+                    $player_parent = $this->sanitize($player_parent[0]['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_own_base($player_parent[0]));
                 }
             } elseif ($player_parent = $parent->get_channel_tags(\SimplePie\SimplePie::NAMESPACE_MEDIARSS, 'player')) {
                 if (isset($player_parent[0]['attribs']['']['url'])) {
-                    $player_parent = $this->sanitize($player_parent[0]['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI);
+                    $player_parent = $this->sanitize($player_parent[0]['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_own_base($player_parent[0]));
                 }
             }

@@ -1315,11 +1305,11 @@ class Item implements RegistryAware
                 }
             } elseif ($restrictions = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_ITUNES, 'block')) {
                 foreach ($restrictions as $restriction) {
-                    $restriction_relationship = 'allow';
+                    $restriction_relationship = Restriction::RELATIONSHIP_ALLOW;
                     $restriction_type = null;
                     $restriction_value = 'itunes';
                     if (isset($restriction['data']) && strtolower($restriction['data']) === 'yes') {
-                        $restriction_relationship = 'deny';
+                        $restriction_relationship = Restriction::RELATIONSHIP_DENY;
                     }
                     $restrictions_parent[] = $this->registry->create(Restriction::class, [$restriction_relationship, $restriction_type, $restriction_value]);
                 }
@@ -1341,32 +1331,32 @@ class Item implements RegistryAware
                 }
             } elseif ($restrictions = $parent->get_channel_tags(\SimplePie\SimplePie::NAMESPACE_ITUNES, 'block')) {
                 foreach ($restrictions as $restriction) {
-                    $restriction_relationship = 'allow';
+                    $restriction_relationship = Restriction::RELATIONSHIP_ALLOW;
                     $restriction_type = null;
                     $restriction_value = 'itunes';
                     if (isset($restriction['data']) && strtolower($restriction['data']) === 'yes') {
-                        $restriction_relationship = 'deny';
+                        $restriction_relationship = Restriction::RELATIONSHIP_DENY;
                     }
                     $restrictions_parent[] = $this->registry->create(Restriction::class, [$restriction_relationship, $restriction_type, $restriction_value]);
                 }
             }
-            if (is_array($restrictions_parent)) {
+            if (count($restrictions_parent) > 0) {
                 $restrictions_parent = array_values(array_unique($restrictions_parent));
             } else {
-                $restrictions_parent = [new \SimplePie\Restriction('allow', null, 'default')];
+                $restrictions_parent = [new \SimplePie\Restriction(Restriction::RELATIONSHIP_ALLOW, null, 'default')];
             }

             // THUMBNAILS
             if ($thumbnails = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_MEDIARSS, 'thumbnail')) {
                 foreach ($thumbnails as $thumbnail) {
                     if (isset($thumbnail['attribs']['']['url'])) {
-                        $thumbnails_parent[] = $this->sanitize($thumbnail['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI);
+                        $thumbnails_parent[] = $this->sanitize($thumbnail['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_own_base($thumbnail));
                     }
                 }
             } elseif ($thumbnails = $parent->get_channel_tags(\SimplePie\SimplePie::NAMESPACE_MEDIARSS, 'thumbnail')) {
                 foreach ($thumbnails as $thumbnail) {
                     if (isset($thumbnail['attribs']['']['url'])) {
-                        $thumbnails_parent[] = $this->sanitize($thumbnail['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI);
+                        $thumbnails_parent[] = $this->sanitize($thumbnail['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_own_base($thumbnail));
                     }
                 }
             }
@@ -1490,7 +1480,7 @@ class Item implements RegistryAware
                             if (isset($content['attribs']['']['width'])) {
                                 $width = $this->sanitize($content['attribs']['']['width'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
                             }
-                            $url = $this->sanitize($content['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI);
+                            $url = $this->sanitize($content['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_own_base($content));

                             // Checking the other optional media: elements. Priority: media:content, media:group, item, channel

@@ -1749,9 +1739,11 @@ class Item implements RegistryAware

                             // PLAYER
                             if (isset($content['child'][\SimplePie\SimplePie::NAMESPACE_MEDIARSS]['player'])) {
-                                $player = $this->sanitize($content['child'][\SimplePie\SimplePie::NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI);
+                                $playerElem = $content['child'][\SimplePie\SimplePie::NAMESPACE_MEDIARSS]['player'][0];
+                                $player = $this->sanitize($playerElem['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_own_base($playerElem));
                             } elseif (isset($group['child'][\SimplePie\SimplePie::NAMESPACE_MEDIARSS]['player'])) {
-                                $player = $this->sanitize($group['child'][\SimplePie\SimplePie::NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI);
+                                $playerElem = $group['child'][\SimplePie\SimplePie::NAMESPACE_MEDIARSS]['player'][0];
+                                $player = $this->sanitize($playerElem['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_own_base($playerElem));
                             } else {
                                 $player = $player_parent;
                             }
@@ -1841,14 +1833,14 @@ class Item implements RegistryAware
                             // THUMBNAILS
                             if (isset($content['child'][\SimplePie\SimplePie::NAMESPACE_MEDIARSS]['thumbnail'])) {
                                 foreach ($content['child'][\SimplePie\SimplePie::NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail) {
-                                    $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI);
+                                    $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_own_base($thumbnail));
                                 }
                                 if (is_array($thumbnails)) {
                                     $thumbnails = array_values(array_unique($thumbnails));
                                 }
                             } elseif (isset($group['child'][\SimplePie\SimplePie::NAMESPACE_MEDIARSS]['thumbnail'])) {
                                 foreach ($group['child'][\SimplePie\SimplePie::NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail) {
-                                    $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI);
+                                    $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_own_base($thumbnail));
                                 }
                                 if (is_array($thumbnails)) {
                                     $thumbnails = array_values(array_unique($thumbnails));
@@ -1946,7 +1938,7 @@ class Item implements RegistryAware
                             $width = $this->sanitize($content['attribs']['']['width'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
                         }
                         if (isset($content['attribs']['']['url'])) {
-                            $url = $this->sanitize($content['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI);
+                            $url = $this->sanitize($content['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_own_base($content));
                         }
                         // Checking the other optional media: elements. Priority: media:content, media:group, item, channel

@@ -2101,7 +2093,8 @@ class Item implements RegistryAware
                         // PLAYER
                         if (isset($content['child'][\SimplePie\SimplePie::NAMESPACE_MEDIARSS]['player'])) {
                             if (isset($content['child'][\SimplePie\SimplePie::NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'])) {
-                                $player = $this->sanitize($content['child'][\SimplePie\SimplePie::NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI);
+                                $playerElem = $content['child'][\SimplePie\SimplePie::NAMESPACE_MEDIARSS]['player'][0];
+                                $player = $this->sanitize($playerElem['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_own_base($playerElem));
                             }
                         } else {
                             $player = $player_parent;
@@ -2157,7 +2150,7 @@ class Item implements RegistryAware
                         if (isset($content['child'][\SimplePie\SimplePie::NAMESPACE_MEDIARSS]['thumbnail'])) {
                             foreach ($content['child'][\SimplePie\SimplePie::NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail) {
                                 if (isset($thumbnail['attribs']['']['url'])) {
-                                    $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI);
+                                    $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_own_base($thumbnail));
                                 }
                             }
                             if (is_array($thumbnails)) {
@@ -2197,7 +2190,7 @@ class Item implements RegistryAware
                     $url = null;
                     $width = null;

-                    $url = $this->sanitize($link['attribs']['']['href'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($link));
+                    $url = $this->sanitize($link['attribs']['']['href'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_own_base($link));
                     if (isset($link['attribs']['']['type'])) {
                         $type = $this->sanitize($link['attribs']['']['type'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
                     }
@@ -2233,7 +2226,7 @@ class Item implements RegistryAware
                     $url = null;
                     $width = null;

-                    $url = $this->sanitize($link['attribs']['']['href'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($link));
+                    $url = $this->sanitize($link['attribs']['']['href'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_own_base($link));
                     if (isset($link['attribs']['']['type'])) {
                         $type = $this->sanitize($link['attribs']['']['type'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
                     }
@@ -2264,8 +2257,8 @@ class Item implements RegistryAware
                     $url = null;
                     $width = null;

-                    $url = $this->sanitize($enclosure['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($enclosure));
-                    $url = $this->feed->sanitize->https_url($url);
+                    $url = $this->sanitize($enclosure['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_own_base($enclosure));
+                    $url = $this->get_sanitize()->https_url($url);
                     if (isset($enclosure['attribs']['']['type'])) {
                         $type = $this->sanitize($enclosure['attribs']['']['type'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
                     }
@@ -2278,7 +2271,7 @@ class Item implements RegistryAware
                 }
             }

-            if (sizeof($this->data['enclosures']) === 0 && ($url || $type || $length || $bitrate || $captions_parent || $categories_parent || $channels || $copyrights_parent || $credits_parent || $description_parent || $duration_parent || $expression || $framerate || $hashes_parent || $height || $keywords_parent || $lang || $medium || $player_parent || $ratings_parent || $restrictions_parent || $samplingrate || $thumbnails_parent || $title_parent || $width)) {
+            if (count($this->data['enclosures']) === 0 && ($url || $type || $length || $bitrate || $captions_parent || $categories_parent || $channels || $copyrights_parent || $credits_parent || $description_parent || $duration_parent || $expression || $framerate || $hashes_parent || $height || $keywords_parent || $lang || $medium || $player_parent || $ratings_parent || $samplingrate || $thumbnails_parent || $title_parent || $width)) {
                 // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
                 $this->data['enclosures'][] = $this->registry->create(Enclosure::class, [$url, $type, $length, null, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width]);
             }
@@ -2302,7 +2295,7 @@ class Item implements RegistryAware
      * @since 1.0
      * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo
      * @link http://www.georss.org/ GeoRSS
-     * @return string|null
+     * @return float|null
      */
     public function get_latitude()
     {
@@ -2325,7 +2318,7 @@ class Item implements RegistryAware
      * @since 1.0
      * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo
      * @link http://www.georss.org/ GeoRSS
-     * @return string|null
+     * @return float|null
      */
     public function get_longitude()
     {
@@ -2354,6 +2347,20 @@ class Item implements RegistryAware

         return null;
     }
+
+    public function set_sanitize(Sanitize $sanitize): void
+    {
+        $this->sanitize = $sanitize;
+    }
+
+    protected function get_sanitize(): Sanitize
+    {
+        if ($this->sanitize === null) {
+            $this->sanitize = new Sanitize();
+        }
+
+        return $this->sanitize;
+    }
 }

 class_alias('SimplePie\Item', 'SimplePie_Item');
diff --git a/wp-includes/SimplePie/src/Locator.php b/wp-includes/SimplePie/src/Locator.php
index e17b3a3761..30a7fe5259 100644
--- a/wp-includes/SimplePie/src/Locator.php
+++ b/wp-includes/SimplePie/src/Locator.php
@@ -1,76 +1,70 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie;

+use DomDocument;
+use Psr\Http\Client\ClientInterface;
+use Psr\Http\Message\RequestFactoryInterface;
+use Psr\Http\Message\UriFactoryInterface;
+use SimplePie\HTTP\Client;
+use SimplePie\HTTP\ClientException;
+use SimplePie\HTTP\FileClient;
+use SimplePie\HTTP\Psr18Client;
+use SimplePie\HTTP\Response;
+
 /**
  * Used for feed auto-discovery
  *
  *
  * This class can be overloaded with {@see \SimplePie\SimplePie::set_locator_class()}
- *
- * @package SimplePie
  */
 class Locator implements RegistryAware
 {
-    public $useragent;
-    public $timeout;
+    /** @var ?string */
+    public $useragent = null;
+    /** @var int */
+    public $timeout = 10;
+    /** @var File */
     public $file;
+    /** @var string[] */
     public $local = [];
+    /** @var string[] */
     public $elsewhere = [];
+    /** @var array<mixed> */
     public $cached_entities = [];
+    /** @var string */
     public $http_base;
+    /** @var string */
     public $base;
+    /** @var int */
     public $base_location = 0;
+    /** @var int */
     public $checked_feeds = 0;
+    /** @var int */
     public $max_checked_feeds = 10;
+    /** @var bool */
     public $force_fsockopen = false;
+    /** @var array<int, mixed> */
     public $curl_options = [];
+    /** @var ?\DomDocument */
     public $dom;
+    /** @var ?Registry */
     protected $registry;

-    public function __construct(\SimplePie\File $file, $timeout = 10, $useragent = null, $max_checked_feeds = 10, $force_fsockopen = false, $curl_options = [])
+    /**
+     * @var Client|null
+     */
+    private $http_client = null;
+
+    /**
+     * @param array<int, mixed> $curl_options
+     */
+    public function __construct(File $file, int $timeout = 10, ?string $useragent = null, int $max_checked_feeds = 10, bool $force_fsockopen = false, array $curl_options = [])
     {
         $this->file = $file;
         $this->useragent = $useragent;
@@ -79,12 +73,14 @@ class Locator implements RegistryAware
         $this->force_fsockopen = $force_fsockopen;
         $this->curl_options = $curl_options;

-        if (class_exists('DOMDocument') && $this->file->body != '') {
+        $body = $this->file->get_body_content();
+
+        if (class_exists('DOMDocument') && $body != '') {
             $this->dom = new \DOMDocument();

-            set_error_handler(['SimplePie\Misc', 'silence_errors']);
+            set_error_handler([Misc::class, 'silence_errors']);
             try {
-                $this->dom->loadHTML($this->file->body);
+                $this->dom->loadHTML($body);
             } catch (\Throwable $ex) {
                 $this->dom = null;
             }
@@ -94,18 +90,41 @@ class Locator implements RegistryAware
         }
     }

-    public function set_registry(\SimplePie\Registry $registry)/* : void */
+    /**
+     * Set a PSR-18 client and PSR-17 factories
+     *
+     * Allows you to use your own HTTP client implementations.
+     */
+    final public function set_http_client(
+        ClientInterface $http_client,
+        RequestFactoryInterface $request_factory,
+        UriFactoryInterface $uri_factory
+    ): void {
+        $this->http_client = new Psr18Client($http_client, $request_factory, $uri_factory);
+    }
+
+    /**
+     * @return void
+     */
+    public function set_registry(\SimplePie\Registry $registry)
     {
         $this->registry = $registry;
     }

-    public function find($type = \SimplePie\SimplePie::LOCATOR_ALL, &$working = null)
+    /**
+     * @param SimplePie::LOCATOR_* $type
+     * @param array<Response>|null $working
+     * @return Response|null
+     */
+    public function find(int $type = \SimplePie\SimplePie::LOCATOR_ALL, ?array &$working = null)
     {
+        assert($this->registry !== null);
+
         if ($this->is_feed($this->file)) {
             return $this->file;
         }

-        if ($this->file->method & \SimplePie\SimplePie::FILE_SOURCE_REMOTE) {
+        if (Misc::is_remote_uri($this->file->get_final_requested_uri())) {
             $sniffer = $this->registry->create(Content\Type\Sniffer::class, [$this->file]);
             if ($sniffer->get_type() !== 'text/html') {
                 return null;
@@ -140,9 +159,14 @@ class Locator implements RegistryAware
         return null;
     }

-    public function is_feed($file, $check_html = false)
+    /**
+     * @return bool
+     */
+    public function is_feed(Response $file, bool $check_html = false)
     {
-        if ($file->method & \SimplePie\SimplePie::FILE_SOURCE_REMOTE) {
+        assert($this->registry !== null);
+
+        if (Misc::is_remote_uri($file->get_final_requested_uri())) {
             $sniffer = $this->registry->create(Content\Type\Sniffer::class, [$file]);
             $sniffed = $sniffer->get_type();
             $mime_types = ['application/rss+xml', 'application/rdf+xml',
@@ -153,19 +177,24 @@ class Locator implements RegistryAware
             }

             return in_array($sniffed, $mime_types);
-        } elseif ($file->method & \SimplePie\SimplePie::FILE_SOURCE_LOCAL) {
+        } elseif (is_file($file->get_final_requested_uri())) {
             return true;
         } else {
             return false;
         }
     }

+    /**
+     * @return void
+     */
     public function get_base()
     {
+        assert($this->registry !== null);
+
         if ($this->dom === null) {
             throw new \SimplePie\Exception('DOMDocument not found, unable to use locator');
         }
-        $this->http_base = $this->file->url;
+        $this->http_base = $this->file->get_final_requested_uri();
         $this->base = $this->http_base;
         $elements = $this->dom->getElementsByTagName('base');
         foreach ($elements as $element) {
@@ -181,6 +210,9 @@ class Locator implements RegistryAware
         }
     }

+    /**
+     * @return array<Response>|null
+     */
     public function autodiscovery()
     {
         $done = [];
@@ -196,8 +228,15 @@ class Locator implements RegistryAware
         return null;
     }

-    protected function search_elements_by_tag($name, &$done, $feeds)
+    /**
+     * @param string[] $done
+     * @param array<string, Response> $feeds
+     * @return array<string, Response>
+     */
+    protected function search_elements_by_tag(string $name, array &$done, array $feeds)
     {
+        assert($this->registry !== null);
+
         if ($this->dom === null) {
             throw new \SimplePie\Exception('DOMDocument not found, unable to use locator');
         }
@@ -223,11 +262,17 @@ class Locator implements RegistryAware
                 if (!in_array($href, $done) && in_array('feed', $rel) || (in_array('alternate', $rel) && !in_array('stylesheet', $rel) && $link->hasAttribute('type') && in_array(strtolower($this->registry->call(Misc::class, 'parse_mime', [$link->getAttribute('type')])), ['text/html', 'application/rss+xml', 'application/atom+xml'])) && !isset($feeds[$href])) {
                     $this->checked_feeds++;
                     $headers = [
-                        'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1',
+                        'Accept' => SimplePie::DEFAULT_HTTP_ACCEPT_HEADER,
                     ];
-                    $feed = $this->registry->create(File::class, [$href, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options]);
-                    if ($feed->success && ($feed->method & \SimplePie\SimplePie::FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed, true)) {
-                        $feeds[$href] = $feed;
+
+                    try {
+                        $feed = $this->get_http_client()->request(Client::METHOD_GET, $href, $headers);
+
+                        if ((!Misc::is_remote_uri($feed->get_final_requested_uri()) || ($feed->get_status_code() === 200 || $feed->get_status_code() > 206 && $feed->get_status_code() < 300)) && $this->is_feed($feed, true)) {
+                            $feeds[$href] = $feed;
+                        }
+                    } catch (ClientException $th) {
+                        // Just mark it as done and continue.
                     }
                 }
                 $done[] = $href;
@@ -237,8 +282,13 @@ class Locator implements RegistryAware
         return $feeds;
     }

+    /**
+     * @return true|null
+     */
     public function get_links()
     {
+        assert($this->registry !== null);
+
         if ($this->dom === null) {
             throw new \SimplePie\Exception('DOMDocument not found, unable to use locator');
         }
@@ -258,7 +308,7 @@ class Locator implements RegistryAware
                         continue;
                     }

-                    $current = $this->registry->call(Misc::class, 'parse_url', [$this->file->url]);
+                    $current = $this->registry->call(Misc::class, 'parse_url', [$this->file->get_final_requested_uri()]);

                     if ($parsed['authority'] === '' || $parsed['authority'] === $current['authority']) {
                         $this->local[] = $href;
@@ -276,8 +326,15 @@ class Locator implements RegistryAware
         return null;
     }

-    public function get_rel_link($rel)
+    /**
+     * Extracts first `link` element with given `rel` attribute inside the `head` element.
+     *
+     * @return string|null
+     */
+    public function get_rel_link(string $rel)
     {
+        assert($this->registry !== null);
+
         if ($this->dom === null) {
             throw new \SimplePie\Exception('DOMDocument not found, unable to use '.
                                           'locator');
@@ -288,8 +345,10 @@ class Locator implements RegistryAware
         }

         $xpath = new \DOMXpath($this->dom);
-        $query = '//a[@rel and @href] | //link[@rel and @href]';
-        foreach ($xpath->query($query) as $link) {
+        $query = '(//head)[1]/link[@rel and @href]';
+        /** @var \DOMNodeList<\DOMElement> */
+        $queryResult = $xpath->query($query);
+        foreach ($queryResult as $link) {
             $href = trim($link->getAttribute('href'));
             $parsed = $this->registry->call(Misc::class, 'parse_url', [$href]);
             if ($parsed['scheme'] === '' ||
@@ -317,33 +376,49 @@ class Locator implements RegistryAware
                 }
             }
         }
+
         return null;
     }

-    public function extension(&$array)
+    /**
+     * @param string[] $array
+     * @return array<Response>|null
+     */
+    public function extension(array &$array)
     {
         foreach ($array as $key => $value) {
             if ($this->checked_feeds === $this->max_checked_feeds) {
                 break;
             }
-            if (in_array(strtolower(strrchr($value, '.')), ['.rss', '.rdf', '.atom', '.xml'])) {
+            $extension = strrchr($value, '.');
+            if ($extension !== false && in_array(strtolower($extension), ['.rss', '.rdf', '.atom', '.xml'])) {
                 $this->checked_feeds++;

                 $headers = [
-                    'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1',
+                    'Accept' => SimplePie::DEFAULT_HTTP_ACCEPT_HEADER,
                 ];
-                $feed = $this->registry->create(File::class, [$value, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options]);
-                if ($feed->success && ($feed->method & \SimplePie\SimplePie::FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed)) {
-                    return [$feed];
-                } else {
-                    unset($array[$key]);
+
+                try {
+                    $feed = $this->get_http_client()->request(Client::METHOD_GET, $value, $headers);
+
+                    if ((!Misc::is_remote_uri($feed->get_final_requested_uri()) || ($feed->get_status_code() === 200 || $feed->get_status_code() > 206 && $feed->get_status_code() < 300)) && $this->is_feed($feed)) {
+                        return [$feed];
+                    }
+                } catch (ClientException $th) {
+                    // Just unset and continue.
                 }
+
+                unset($array[$key]);
             }
         }
         return null;
     }

-    public function body(&$array)
+    /**
+     * @param string[] $array
+     * @return array<Response>|null
+     */
+    public function body(array &$array)
     {
         foreach ($array as $key => $value) {
             if ($this->checked_feeds === $this->max_checked_feeds) {
@@ -352,18 +427,52 @@ class Locator implements RegistryAware
             if (preg_match('/(feed|rss|rdf|atom|xml)/i', $value)) {
                 $this->checked_feeds++;
                 $headers = [
-                    'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1',
+                    'Accept' => SimplePie::DEFAULT_HTTP_ACCEPT_HEADER,
                 ];
-                $feed = $this->registry->create(File::class, [$value, $this->timeout, 5, null, $this->useragent, $this->force_fsockopen, $this->curl_options]);
-                if ($feed->success && ($feed->method & \SimplePie\SimplePie::FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed)) {
-                    return [$feed];
-                } else {
-                    unset($array[$key]);
+
+                try {
+                    $feed = $this->get_http_client()->request(Client::METHOD_GET, $value, $headers);
+
+                    if ((!Misc::is_remote_uri($feed->get_final_requested_uri()) || ($feed->get_status_code() === 200 || $feed->get_status_code() > 206 && $feed->get_status_code() < 300)) && $this->is_feed($feed)) {
+                        return [$feed];
+                    }
+                } catch (ClientException $th) {
+                    // Just unset and continue.
                 }
+
+                unset($array[$key]);
             }
         }
         return null;
     }
+
+    /**
+     * Get a HTTP client
+     */
+    private function get_http_client(): Client
+    {
+        assert($this->registry !== null);
+
+        if ($this->http_client === null) {
+            $options = [
+                'timeout' => $this->timeout,
+                'redirects' => 5,
+                'force_fsockopen' => $this->force_fsockopen,
+                'curl_options' => $this->curl_options,
+            ];
+
+            if ($this->useragent !== null) {
+                $options['useragent'] = $this->useragent;
+            }
+
+            return new FileClient(
+                $this->registry,
+                $options
+            );
+        }
+
+        return $this->http_client;
+    }
 }

 class_alias('SimplePie\Locator', 'SimplePie_Locator', false);
diff --git a/wp-includes/SimplePie/src/Misc.php b/wp-includes/SimplePie/src/Misc.php
index cc5db8aea3..6f9197202c 100644
--- a/wp-includes/SimplePie/src/Misc.php
+++ b/wp-includes/SimplePie/src/Misc.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie;

@@ -48,14 +11,16 @@ use SimplePie\XML\Declaration\Parser;

 /**
  * Miscellaneous utilities
- *
- * @package SimplePie
  */
 class Misc
 {
+    /** @var int|null */
     private static $SIMPLEPIE_BUILD = null;

-    public static function time_hms($seconds)
+    /**
+     * @return string
+     */
+    public static function time_hms(int $seconds)
     {
         $time = '';

@@ -80,7 +45,10 @@ class Misc
         return $time;
     }

-    public static function absolutize_url($relative, $base)
+    /**
+     * @return string|false
+     */
+    public static function absolutize_url(string $relative, string $base)
     {
         $iri = \SimplePie\IRI::absolutize(new \SimplePie\IRI($base), $relative);
         if ($iri === false) {
@@ -89,15 +57,23 @@ class Misc
         return $iri->get_uri();
     }

+    /**
+     * @internal
+     */
+    public static function is_remote_uri(string $uri): bool
+    {
+        return preg_match('/^https?:\/\//i', $uri) === 1;
+    }
+
     /**
      * Get a HTML/XML element from a HTML string
      *
      * @deprecated since SimplePie 1.3, use DOMDocument instead (parsing HTML with regex is bad!)
      * @param string $realname Element name (including namespace prefix if applicable)
      * @param string $string HTML document
-     * @return array
+     * @return array<array{tag: string, self_closing: bool, attribs: array<string, array{data: string}>, content?: string}>
      */
-    public static function get_element($realname, $string)
+    public static function get_element(string $realname, string $string)
     {
         // trigger_error(sprintf('Using method "' . __METHOD__ . '" is deprecated since SimplePie 1.3, use "DOMDocument" instead.'), \E_USER_DEPRECATED);

@@ -116,11 +92,11 @@ class Misc
                 }
                 $return[$i]['attribs'] = [];
                 if (isset($matches[$i][2][0]) && preg_match_all('/[\x09\x0A\x0B\x0C\x0D\x20]+([^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3D\x3E]*)(?:[\x09\x0A\x0B\x0C\x0D\x20]*=[\x09\x0A\x0B\x0C\x0D\x20]*(?:"([^"]*)"|\'([^\']*)\'|([^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?/', ' ' . $matches[$i][2][0] . ' ', $attribs, PREG_SET_ORDER)) {
-                    for ($j = 0, $total_attribs = count($attribs); $j < $total_attribs; $j++) {
-                        if (count($attribs[$j]) === 2) {
-                            $attribs[$j][2] = $attribs[$j][1];
+                    foreach ($attribs as $attrib) {
+                        if (count($attrib) === 2) {
+                            $attrib[2] = $attrib[1];
                         }
-                        $return[$i]['attribs'][strtolower($attribs[$j][1])]['data'] = Misc::entities_decode(end($attribs[$j]));
+                        $return[$i]['attribs'][strtolower($attrib[1])]['data'] = Misc::entities_decode(end($attrib));
                     }
                 }
             }
@@ -128,9 +104,16 @@ class Misc
         return $return;
     }

-    public static function element_implode($element)
+    /**
+     * @deprecated since SimplePie 1.9.0. If you need it, you can copy the function to your codebase. But you should consider using `DOMDocument` for any DOM wrangling.
+     * @param array{tag: string, self_closing: bool, attribs: array<string, array{data: string}>, content: string} $element
+     * @return string
+     */
+    public static function element_implode(array $element)
     {
-        $full = "<$element[tag]";
+        // trigger_error(sprintf('Using method "' . __METHOD__ . '" is deprecated since SimplePie 1.9.'), \E_USER_DEPRECATED);
+
+        $full = "<{$element['tag']}";
         foreach ($element['attribs'] as $key => $value) {
             $key = strtolower($key);
             $full .= " $key=\"" . htmlspecialchars($value['data'], ENT_COMPAT, 'UTF-8') . '"';
@@ -138,12 +121,19 @@ class Misc
         if ($element['self_closing']) {
             $full .= ' />';
         } else {
-            $full .= ">$element[content]</$element[tag]>";
+            $full .= ">{$element['content']}</{$element['tag']}>";
         }
         return $full;
     }

-    public static function error($message, $level, $file, $line)
+    /**
+     * @param string $message
+     * @param int $level
+     * @param string $file
+     * @param int $line
+     * @return string
+     */
+    public static function error(string $message, int $level, string $file, int $line)
     {
         if ((error_reporting() & $level) > 0) {
             switch ($level) {
@@ -179,7 +169,10 @@ class Misc
         return $message;
     }

-    public static function fix_protocol($url, $http = 1)
+    /**
+     * @return string
+     */
+    public static function fix_protocol(string $url, int $http = 1)
     {
         $url = Misc::normalize_url($url);
         $parsed = Misc::parse_url($url);
@@ -204,8 +197,11 @@ class Misc

     /**
      * @deprecated since SimplePie 1.8.0, use PHP native array_replace_recursive() instead.
+     * @param array<mixed> $array1
+     * @param array<mixed> $array2
+     * @return array<mixed>
      */
-    public static function array_merge_recursive($array1, $array2)
+    public static function array_merge_recursive(array $array1, array $array2)
     {
         foreach ($array2 as $key => $value) {
             if (is_array($value)) {
@@ -218,7 +214,10 @@ class Misc
         return $array1;
     }

-    public static function parse_url($url)
+    /**
+     * @return array<string, string>
+     */
+    public static function parse_url(string $url)
     {
         $iri = new \SimplePie\IRI($url);
         return [
@@ -230,7 +229,10 @@ class Misc
         ];
     }

-    public static function compress_parse_url($scheme = '', $authority = '', $path = '', $query = '', $fragment = '')
+    /**
+     * @return string
+     */
+    public static function compress_parse_url(string $scheme = '', string $authority = '', string $path = '', string $query = '', ?string $fragment = '')
     {
         $iri = new \SimplePie\IRI('');
         $iri->scheme = $scheme;
@@ -241,17 +243,26 @@ class Misc
         return $iri->get_uri();
     }

-    public static function normalize_url($url)
+    /**
+     * @return string
+     */
+    public static function normalize_url(string $url)
     {
         $iri = new \SimplePie\IRI($url);
         return $iri->get_uri();
     }

-    public static function percent_encoding_normalization($match)
+    /**
+     * @deprecated since SimplePie 1.9.0. This functionality is part of `IRI` – if you need it standalone, consider copying the function to your codebase.
+     * @param array<int, string> $match
+     * @return string
+     */
+    public static function percent_encoding_normalization(array $match)
     {
         $integer = hexdec($match[1]);
         if ($integer >= 0x41 && $integer <= 0x5A || $integer >= 0x61 && $integer <= 0x7A || $integer >= 0x30 && $integer <= 0x39 || $integer === 0x2D || $integer === 0x2E || $integer === 0x5F || $integer === 0x7E) {
-            return chr($integer);
+            // Cast for PHPStan, the value would only be float when above PHP_INT_MAX, which would not go in this branch.
+            return chr((int) $integer);
         }

         return strtoupper($match[0]);
@@ -264,7 +275,7 @@ class Misc
      * @param string $string Windows-1252 encoded string
      * @return string UTF-8 encoded string
      */
-    public static function windows_1252_to_utf8($string)
+    public static function windows_1252_to_utf8(string $string)
     {
         static $convert_table = ["\x80" => "\xE2\x82\xAC", "\x81" => "\xEF\xBF\xBD", "\x82" => "\xE2\x80\x9A", "\x83" => "\xC6\x92", "\x84" => "\xE2\x80\x9E", "\x85" => "\xE2\x80\xA6", "\x86" => "\xE2\x80\xA0", "\x87" => "\xE2\x80\xA1", "\x88" => "\xCB\x86", "\x89" => "\xE2\x80\xB0", "\x8A" => "\xC5\xA0", "\x8B" => "\xE2\x80\xB9", "\x8C" => "\xC5\x92", "\x8D" => "\xEF\xBF\xBD", "\x8E" => "\xC5\xBD", "\x8F" => "\xEF\xBF\xBD", "\x90" => "\xEF\xBF\xBD", "\x91" => "\xE2\x80\x98", "\x92" => "\xE2\x80\x99", "\x93" => "\xE2\x80\x9C", "\x94" => "\xE2\x80\x9D", "\x95" => "\xE2\x80\xA2", "\x96" => "\xE2\x80\x93", "\x97" => "\xE2\x80\x94", "\x98" => "\xCB\x9C", "\x99" => "\xE2\x84\xA2", "\x9A" => "\xC5\xA1", "\x9B" => "\xE2\x80\xBA", "\x9C" => "\xC5\x93", "\x9D" => "\xEF\xBF\xBD", "\x9E" => "\xC5\xBE", "\x9F" => "\xC5\xB8", "\xA0" => "\xC2\xA0", "\xA1" => "\xC2\xA1", "\xA2" => "\xC2\xA2", "\xA3" => "\xC2\xA3", "\xA4" => "\xC2\xA4", "\xA5" => "\xC2\xA5", "\xA6" => "\xC2\xA6", "\xA7" => "\xC2\xA7", "\xA8" => "\xC2\xA8", "\xA9" => "\xC2\xA9", "\xAA" => "\xC2\xAA", "\xAB" => "\xC2\xAB", "\xAC" => "\xC2\xAC", "\xAD" => "\xC2\xAD", "\xAE" => "\xC2\xAE", "\xAF" => "\xC2\xAF", "\xB0" => "\xC2\xB0", "\xB1" => "\xC2\xB1", "\xB2" => "\xC2\xB2", "\xB3" => "\xC2\xB3", "\xB4" => "\xC2\xB4", "\xB5" => "\xC2\xB5", "\xB6" => "\xC2\xB6", "\xB7" => "\xC2\xB7", "\xB8" => "\xC2\xB8", "\xB9" => "\xC2\xB9", "\xBA" => "\xC2\xBA", "\xBB" => "\xC2\xBB", "\xBC" => "\xC2\xBC", "\xBD" => "\xC2\xBD", "\xBE" => "\xC2\xBE", "\xBF" => "\xC2\xBF", "\xC0" => "\xC3\x80", "\xC1" => "\xC3\x81", "\xC2" => "\xC3\x82", "\xC3" => "\xC3\x83", "\xC4" => "\xC3\x84", "\xC5" => "\xC3\x85", "\xC6" => "\xC3\x86", "\xC7" => "\xC3\x87", "\xC8" => "\xC3\x88", "\xC9" => "\xC3\x89", "\xCA" => "\xC3\x8A", "\xCB" => "\xC3\x8B", "\xCC" => "\xC3\x8C", "\xCD" => "\xC3\x8D", "\xCE" => "\xC3\x8E", "\xCF" => "\xC3\x8F", "\xD0" => "\xC3\x90", "\xD1" => "\xC3\x91", "\xD2" => "\xC3\x92", "\xD3" => "\xC3\x93", "\xD4" => "\xC3\x94", "\xD5" => "\xC3\x95", "\xD6" => "\xC3\x96", "\xD7" => "\xC3\x97", "\xD8" => "\xC3\x98", "\xD9" => "\xC3\x99", "\xDA" => "\xC3\x9A", "\xDB" => "\xC3\x9B", "\xDC" => "\xC3\x9C", "\xDD" => "\xC3\x9D", "\xDE" => "\xC3\x9E", "\xDF" => "\xC3\x9F", "\xE0" => "\xC3\xA0", "\xE1" => "\xC3\xA1", "\xE2" => "\xC3\xA2", "\xE3" => "\xC3\xA3", "\xE4" => "\xC3\xA4", "\xE5" => "\xC3\xA5", "\xE6" => "\xC3\xA6", "\xE7" => "\xC3\xA7", "\xE8" => "\xC3\xA8", "\xE9" => "\xC3\xA9", "\xEA" => "\xC3\xAA", "\xEB" => "\xC3\xAB", "\xEC" => "\xC3\xAC", "\xED" => "\xC3\xAD", "\xEE" => "\xC3\xAE", "\xEF" => "\xC3\xAF", "\xF0" => "\xC3\xB0", "\xF1" => "\xC3\xB1", "\xF2" => "\xC3\xB2", "\xF3" => "\xC3\xB3", "\xF4" => "\xC3\xB4", "\xF5" => "\xC3\xB5", "\xF6" => "\xC3\xB6", "\xF7" => "\xC3\xB7", "\xF8" => "\xC3\xB8", "\xF9" => "\xC3\xB9", "\xFA" => "\xC3\xBA", "\xFB" => "\xC3\xBB", "\xFC" => "\xC3\xBC", "\xFD" => "\xC3\xBD", "\xFE" => "\xC3\xBE", "\xFF" => "\xC3\xBF"];

@@ -277,22 +288,22 @@ class Misc
      * @param string $data Raw data in $input encoding
      * @param string $input Encoding of $data
      * @param string $output Encoding you want
-     * @return string|boolean False if we can't convert it
+     * @return string|false False if we can't convert it
      */
-    public static function change_encoding($data, $input, $output)
+    public static function change_encoding(string $data, string $input, string $output)
     {
         $input = Misc::encoding($input);
         $output = Misc::encoding($output);

         // We fail to fail on non US-ASCII bytes
         if ($input === 'US-ASCII') {
-            static $non_ascii_octects = '';
-            if (!$non_ascii_octects) {
+            static $non_ascii_octets = '';
+            if (!$non_ascii_octets) {
                 for ($i = 0x80; $i <= 0xFF; $i++) {
-                    $non_ascii_octects .= chr($i);
+                    $non_ascii_octets .= chr($i);
                 }
             }
-            $data = substr($data, 0, strcspn($data, $non_ascii_octects));
+            $data = substr($data, 0, strcspn($data, $non_ascii_octets));
         }

         // This is first, as behaviour of this is completely predictable
@@ -316,7 +327,10 @@ class Misc
         return false;
     }

-    protected static function change_encoding_mbstring($data, $input, $output)
+    /**
+     * @return string|false
+     */
+    protected static function change_encoding_mbstring(string $data, string $input, string $output)
     {
         if ($input === 'windows-949') {
             $input = 'EUC-KR';
@@ -348,18 +362,18 @@ class Misc
         return false;
     }

-    protected static function change_encoding_iconv($data, $input, $output)
+    /**
+     * @return string|false
+     */
+    protected static function change_encoding_iconv(string $data, string $input, string $output)
     {
         return @iconv($input, $output, $data);
     }

     /**
-     * @param string $data
-     * @param string $input
-     * @param string $output
      * @return string|false
      */
-    protected static function change_encoding_uconverter($data, $input, $output)
+    protected static function change_encoding_uconverter(string $data, string $input, string $output)
     {
         return @\UConverter::transcode($data, $output, $input);
     }
@@ -375,10 +389,11 @@ class Misc
      * @param string $charset Character set to standardise
      * @return string Standardised name
      */
-    public static function encoding($charset)
+    public static function encoding(string $charset)
     {
         // Normalization from UTS #22
-        switch (strtolower(preg_replace('/(?:[^a-zA-Z0-9]+|([^0-9])0+)/', '\1', $charset))) {
+        // Cast for PHPStan, the regex should not fail.
+        switch (strtolower((string) preg_replace('/(?:[^a-zA-Z0-9]+|([^0-9])0+)/', '\1', $charset))) {
             case 'adobestandardencoding':
             case 'csadobestandardencoding':
                 return 'Adobe-Standard-Encoding';
@@ -1687,16 +1702,15 @@ class Misc
         }
     }

+    /**
+     * @return string
+     */
     public static function get_curl_version()
     {
         if (is_array($curl = curl_version())) {
             $curl = $curl['version'];
-        } elseif (substr($curl, 0, 5) === 'curl/') {
-            $curl = substr($curl, 5, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 5));
-        } elseif (substr($curl, 0, 8) === 'libcurl/') {
-            $curl = substr($curl, 8, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 8));
         } else {
-            $curl = 0;
+            $curl = '0';
         }
         return $curl;
     }
@@ -1704,11 +1718,14 @@ class Misc
     /**
      * Strip HTML comments
      *
+     * @deprecated since SimplePie 1.9.0. If you need it, you can copy the function to your codebase. But you should consider using `DOMDocument` for any DOM wrangling.
      * @param string $data Data to strip comments from
      * @return string Comment stripped string
      */
-    public static function strip_comments($data)
+    public static function strip_comments(string $data)
     {
+        // trigger_error(sprintf('Using method "' . __METHOD__ . '" is deprecated since SimplePie 1.9.'), \E_USER_DEPRECATED);
+
         $output = '';
         while (($start = strpos($data, '<!--')) !== false) {
             $output .= substr($data, 0, $start);
@@ -1721,7 +1738,10 @@ class Misc
         return $output . $data;
     }

-    public static function parse_date($dt)
+    /**
+     * @return int|false
+     */
+    public static function parse_date(string $dt)
     {
         $parser = \SimplePie\Parse\Date::get();
         return $parser->parse($dt);
@@ -1734,7 +1754,7 @@ class Misc
      * @param string $data Input data
      * @return string Output data
      */
-    public static function entities_decode($data)
+    public static function entities_decode(string $data)
     {
         // trigger_error(sprintf('Using method "' . __METHOD__ . '" is deprecated since SimplePie 1.3, use "DOMDocument" instead.'), \E_USER_DEPRECATED);

@@ -1745,12 +1765,14 @@ class Misc
     /**
      * Remove RFC822 comments
      *
-     * @param string $data Data to strip comments from
+     * @deprecated since SimplePie 1.9.0. If you need it, consider copying the function to your codebase.
+     * @param string $string Data to strip comments from
      * @return string Comment stripped string
      */
-    public static function uncomment_rfc822($string)
+    public static function uncomment_rfc822(string $string)
     {
-        $string = (string) $string;
+        // trigger_error(sprintf('Using method "' . __METHOD__ . '" is deprecated since SimplePie 1.9.'), \E_USER_DEPRECATED);
+
         $position = 0;
         $length = strlen($string);
         $depth = 0;
@@ -1791,7 +1813,10 @@ class Misc
         return $output;
     }

-    public static function parse_mime($mime)
+    /**
+     * @return string
+     */
+    public static function parse_mime(string $mime)
     {
         if (($pos = strpos($mime, ';')) === false) {
             return trim($mime);
@@ -1800,7 +1825,11 @@ class Misc
         return trim(substr($mime, 0, $pos));
     }

-    public static function atom_03_construct_type($attribs)
+    /**
+     * @param array<string, array<string, string>> $attribs
+     * @return int-mask-of<SimplePie::CONSTRUCT_*>
+     */
+    public static function atom_03_construct_type(array $attribs)
     {
         if (isset($attribs['']['mode']) && strtolower(trim($attribs['']['mode'])) === 'base64') {
             $mode = \SimplePie\SimplePie::CONSTRUCT_BASE64;
@@ -1829,7 +1858,11 @@ class Misc
         return \SimplePie\SimplePie::CONSTRUCT_TEXT | $mode;
     }

-    public static function atom_10_construct_type($attribs)
+    /**
+     * @param array<string, array<string, string>> $attribs
+     * @return int-mask-of<SimplePie::CONSTRUCT_*>
+     */
+    public static function atom_10_construct_type(array $attribs)
     {
         if (isset($attribs['']['type'])) {
             switch (strtolower(trim($attribs['']['type']))) {
@@ -1849,7 +1882,11 @@ class Misc
         return \SimplePie\SimplePie::CONSTRUCT_TEXT;
     }

-    public static function atom_10_content_construct_type($attribs)
+    /**
+     * @param array<string, array<string, string>> $attribs
+     * @return int-mask-of<SimplePie::CONSTRUCT_*>
+     */
+    public static function atom_10_content_construct_type(array $attribs)
     {
         if (isset($attribs['']['type'])) {
             $type = strtolower(trim($attribs['']['type']));
@@ -1873,12 +1910,18 @@ class Misc
         return \SimplePie\SimplePie::CONSTRUCT_TEXT;
     }

-    public static function is_isegment_nz_nc($string)
+    /**
+     * @return bool
+     */
+    public static function is_isegment_nz_nc(string $string)
     {
         return (bool) preg_match('/^([A-Za-z0-9\-._~\x{A0}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFEF}\x{10000}-\x{1FFFD}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}\x{40000}-\x{4FFFD}\x{50000}-\x{5FFFD}\x{60000}-\x{6FFFD}\x{70000}-\x{7FFFD}\x{80000}-\x{8FFFD}\x{90000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!$&\'()*+,;=@]|(%[0-9ABCDEF]{2}))+$/u', $string);
     }

-    public static function space_separated_tokens($string)
+    /**
+     * @return string[]
+     */
+    public static function space_separated_tokens(string $string)
     {
         $space_characters = "\x20\x09\x0A\x0B\x0C\x0D";
         $string_length = strlen($string);
@@ -1901,11 +1944,10 @@ class Misc
      *
      * @static
      * @param int $codepoint Unicode codepoint
-     * @return string UTF-8 character
+     * @return string|false UTF-8 character
      */
-    public static function codepoint_to_utf8($codepoint)
+    public static function codepoint_to_utf8(int $codepoint)
     {
-        $codepoint = (int) $codepoint;
         if ($codepoint < 0) {
             return false;
         } elseif ($codepoint <= 0x7f) {
@@ -1928,12 +1970,15 @@ class Misc
      * Returns an associative array of name/value pairs, where the value is an
      * array of values that have used the same name
      *
+     * @deprecated since SimplePie 1.9.0. If you need it, consider copying the function to your codebase.
      * @static
      * @param string $str The input string.
-     * @return array
+     * @return array<string, array<string|null>>
      */
-    public static function parse_str($str)
+    public static function parse_str(string $str)
     {
+        // trigger_error(sprintf('Using method "' . __METHOD__ . '" is deprecated since SimplePie 1.9.'), \E_USER_DEPRECATED);
+
         $return = [];
         $str = explode('&', $str);

@@ -1955,9 +2000,9 @@ class Misc
      * @todo Add support for EBCDIC
      * @param string $data XML data
      * @param \SimplePie\Registry $registry Class registry
-     * @return array Possible encodings
+     * @return array<string> Possible encodings
      */
-    public static function xml_encoding($data, $registry)
+    public static function xml_encoding(string $data, \SimplePie\Registry $registry)
     {
         // UTF-32 Big Endian BOM
         if (substr($data, 0, 4) === "\x00\x00\xFE\xFF") {
@@ -2036,6 +2081,9 @@ class Misc
         return $encoding;
     }

+    /**
+     * @return void
+     */
     public static function output_javascript()
     {
         if (function_exists('ob_gzhandler')) {
@@ -2045,7 +2093,7 @@ class Misc
         header('Cache-Control: must-revalidate');
         header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days

-        $body = <<<END
+        $body = <<<JS
 function embed_quicktime(type, bgcolor, width, height, link, placeholder, loop) {
 	if (placeholder != '') {
 		document.writeln('<embed type="'+type+'" style="cursor:hand; cursor:pointer;" href="'+link+'" src="'+placeholder+'" width="'+width+'" height="'+height+'" autoplay="false" target="myself" controller="false" loop="'+loop+'" scale="aspect" bgcolor="'+bgcolor+'" pluginspage="http://www.apple.com/quicktime/download/"></embed>');
@@ -2066,7 +2114,7 @@ function embed_flv(width, height, link, placeholder, loop, player) {
 function embed_wmedia(width, height, link) {
 	document.writeln('<embed type="application/x-mplayer2" src="'+link+'" autosize="1" width="'+width+'" height="'+height+'" showcontrols="1" showstatusbar="0" showdisplay="0" autostart="0"></embed>');
 }
-END;
+JS;
         echo $body;
     }

@@ -2075,37 +2123,36 @@ END;
      *
      * Uses the git index if it exists, otherwise uses the modification time
      * of the newest file.
+     *
+     * @return int
      */
     public static function get_build()
     {
-        if (static::$SIMPLEPIE_BUILD !== null) {
-            return static::$SIMPLEPIE_BUILD;
+        if (self::$SIMPLEPIE_BUILD !== null) {
+            return self::$SIMPLEPIE_BUILD;
         }

         $root = dirname(__FILE__, 2);
         if (file_exists($root . '/.git/index')) {
-            static::$SIMPLEPIE_BUILD = filemtime($root . '/.git/index');
+            self::$SIMPLEPIE_BUILD = (int) filemtime($root . '/.git/index');

-            return static::$SIMPLEPIE_BUILD;
-        } elseif (file_exists($root . '/SimplePie')) {
+            return self::$SIMPLEPIE_BUILD;
+        } elseif (file_exists($root . '/src')) {
             $time = 0;
-            foreach (glob($root . '/SimplePie/*.php') as $file) {
+            foreach (glob($root . '/src/*.php') ?: [] as $file) {
                 if (($mtime = filemtime($file)) > $time) {
                     $time = $mtime;
                 }
             }
-            static::$SIMPLEPIE_BUILD = $time;

-            return static::$SIMPLEPIE_BUILD;
-        } elseif (file_exists(dirname(__FILE__) . '/Core.php')) {
-            static::$SIMPLEPIE_BUILD = filemtime(dirname(__FILE__) . '/Core.php');
+            self::$SIMPLEPIE_BUILD = $time;

-            return static::$SIMPLEPIE_BUILD;
+            return self::$SIMPLEPIE_BUILD;
         }

-        static::$SIMPLEPIE_BUILD = filemtime(__FILE__);
+        self::$SIMPLEPIE_BUILD = (int) filemtime(__FILE__);

-        return static::$SIMPLEPIE_BUILD;
+        return self::$SIMPLEPIE_BUILD;
     }

     /**
@@ -2120,13 +2167,16 @@ END;

     /**
      * Format debugging information
+     *
+     * @return string
      */
-    public static function debug(&$sp)
+    public static function debug(SimplePie &$sp)
     {
         $info = 'SimplePie ' . \SimplePie\SimplePie::VERSION . ' Build ' . static::get_build() . "\n";
         $info .= 'PHP ' . PHP_VERSION . "\n";
         if ($sp->error() !== null) {
-            $info .= 'Error occurred: ' . $sp->error() . "\n";
+            // TODO: Remove cast with multifeeds.
+            $info .= 'Error occurred: ' . implode(', ', (array) $sp->error()) . "\n";
         } else {
             $info .= "No error found.\n";
         }
@@ -2140,12 +2190,9 @@ END;
                         $info .= '      Version ' . PCRE_VERSION . "\n";
                         break;
                     case 'curl':
-                        $version = curl_version();
+                        $version = (array) curl_version();
                         $info .= '      Version ' . $version['version'] . "\n";
                         break;
-                    case 'mbstring':
-                        $info .= '      Overloading: ' . mb_get_info('func_overload') . "\n";
-                        break;
                     case 'iconv':
                         $info .= '      Version ' . ICONV_VERSION . "\n";
                         break;
@@ -2160,9 +2207,13 @@ END;
         return $info;
     }

-    public static function silence_errors($num, $str)
+    /**
+     * @return bool
+     */
+    public static function silence_errors(int $num, string $str)
     {
         // No-op
+        return true;
     }

     /**
@@ -2170,9 +2221,12 @@ END;
      * @param string $url the URL to sanitize.
      * @return string the same URL without HTTP credentials.
      */
-    public static function url_remove_credentials($url)
+    public static function url_remove_credentials(string $url)
     {
-        return preg_replace('#^(https?://)[^/:@]+:[^/:@]+@#i', '$1', $url);
+        // Cast for PHPStan: I do not think this can fail.
+        // The regex is valid and there should be no backtracking.
+        // https://github.com/phpstan/phpstan/issues/11547
+        return (string) preg_replace('#^(https?://)[^/:@]+:[^/:@]+@#i', '$1', $url);
     }
 }

diff --git a/wp-includes/SimplePie/src/Net/IPv6.php b/wp-includes/SimplePie/src/Net/IPv6.php
index a68dc169a5..db931529f1 100644
--- a/wp-includes/SimplePie/src/Net/IPv6.php
+++ b/wp-includes/SimplePie/src/Net/IPv6.php
@@ -1,54 +1,15 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie\Net;

 /**
  * Class to validate and to work with IPv6 addresses.
  *
- * @package SimplePie
- * @subpackage HTTP
  * @copyright 2003-2005 The PHP Group
  * @license http://www.opensource.org/licenses/bsd-license.php
  * @link http://pear.php.net/package/Net_IPv6
@@ -62,7 +23,7 @@ class IPv6
     /**
      * Uncompresses an IPv6 address
      *
-     * RFC 4291 allows you to compress concecutive zero pieces in an address to
+     * RFC 4291 allows you to compress consecutive zero pieces in an address to
      * '::'. This method expects a valid IPv6 address and expands the '::' to
      * the required number of zero pieces.
      *
@@ -77,7 +38,7 @@ class IPv6
      * @param string $ip An IPv6 address
      * @return string The uncompressed IPv6 address
      */
-    public static function uncompress($ip)
+    public static function uncompress(string $ip)
     {
         $c1 = -1;
         $c2 = -1;
@@ -122,7 +83,7 @@ class IPv6
     /**
      * Compresses an IPv6 address
      *
-     * RFC 4291 allows you to compress concecutive zero pieces in an address to
+     * RFC 4291 allows you to compress consecutive zero pieces in an address to
      * '::'. This method expects a valid IPv6 address and compresses consecutive
      * zero pieces to '::'.
      *
@@ -133,14 +94,14 @@ class IPv6
      * @param string $ip An IPv6 address
      * @return string The compressed IPv6 address
      */
-    public static function compress($ip)
+    public static function compress(string $ip)
     {
         // Prepare the IP to be compressed
         $ip = self::uncompress($ip);
         $ip_parts = self::split_v6_v4($ip);

         // Replace all leading zeros
-        $ip_parts[0] = preg_replace('/(^|:)0+([0-9])/', '\1\2', $ip_parts[0]);
+        $ip_parts[0] = (string) preg_replace('/(^|:)0+([0-9])/', '\1\2', $ip_parts[0]);

         // Find bunches of zeros
         if (preg_match_all('/(?:^|:)(?:0(?::|$))+/', $ip_parts[0], $matches, PREG_OFFSET_CAPTURE)) {
@@ -153,6 +114,7 @@ class IPv6
                 }
             }

+            assert($pos !== null, 'For PHPStan: Since the regex matched, there is at least one match. And because the pattern is non-empty, the loop will always end with $pos ≥ 1.');
             $ip_parts[0] = substr_replace($ip_parts[0], '::', $pos, $max);
         }

@@ -173,12 +135,13 @@ class IPv6
      *           0:0:0:0:0:FFFF:129.144.52.38
      *
      * @param string $ip An IPv6 address
-     * @return array [0] contains the IPv6 represented part, and [1] the IPv4 represented part
+     * @return array{string, string} [0] contains the IPv6 represented part, and [1] the IPv4 represented part
      */
-    private static function split_v6_v4($ip)
+    private static function split_v6_v4(string $ip): array
     {
         if (strpos($ip, '.') !== false) {
             $pos = strrpos($ip, ':');
+            assert($pos !== false, 'For PHPStan: IPv6 address must contain colon, since split_v6_v4 is only ever called after uncompress.');
             $ipv6_part = substr($ip, 0, $pos);
             $ipv4_part = substr($ip, $pos + 1);
             return [$ipv6_part, $ipv4_part];
@@ -195,7 +158,7 @@ class IPv6
      * @param string $ip An IPv6 address
      * @return bool true if $ip is a valid IPv6 address
      */
-    public static function check_ipv6($ip)
+    public static function check_ipv6(string $ip)
     {
         $ip = self::uncompress($ip);
         [$ipv6, $ipv4] = self::split_v6_v4($ip);
@@ -221,7 +184,11 @@ class IPv6

                 // Check the value is valid
                 $value = hexdec($ipv6_part);
-                if (dechex($value) !== strtolower($ipv6_part) || $value < 0 || $value > 0xFFFF) {
+                if ($value < 0 || $value > 0xFFFF) {
+                    return false;
+                }
+                assert(is_int($value), 'For PHPStan: $value is only float when $ipv6_part > PHP_INT_MAX');
+                if (dechex($value) !== strtolower($ipv6_part)) {
                     return false;
                 }
             }
@@ -248,7 +215,7 @@ class IPv6
      * @param string $ip An IPv6 address
      * @return bool true if $ip is a valid IPv6 address
      */
-    public static function checkIPv6($ip)
+    public static function checkIPv6(string $ip)
     {
         return self::check_ipv6($ip);
     }
diff --git a/wp-includes/SimplePie/src/Parse/Date.php b/wp-includes/SimplePie/src/Parse/Date.php
index 3254cca3cb..57318e0b46 100644
--- a/wp-includes/SimplePie/src/Parse/Date.php
+++ b/wp-includes/SimplePie/src/Parse/Date.php
@@ -1,54 +1,14 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie\Parse;

 /**
  * Date Parser
- *
- * @package SimplePie
- * @subpackage Parsing
  */
 class Date
 {
@@ -64,7 +24,7 @@ class Date
      * List of days, calendar day name => ordinal day number in the week
      *
      * @access protected
-     * @var array
+     * @var array<string, int<1,7>>
      */
     public $day = [
         // English
@@ -169,7 +129,7 @@ class Date
      * List of months, calendar month name => calendar month number
      *
      * @access protected
-     * @var array
+     * @var array<string, int<1,12>>
      */
     public $month = [
         // English
@@ -201,15 +161,15 @@ class Date
         'januari' => 1,
         'februari' => 2,
         'maart' => 3,
-        'april' => 4,
+        // 'april' => 4,
         'mei' => 5,
         'juni' => 6,
         'juli' => 7,
         'augustus' => 8,
-        'september' => 9,
+        // 'september' => 9,
         'oktober' => 10,
-        'november' => 11,
-        'december' => 12,
+        // 'november' => 11,
+        // 'december' => 12,
         // French
         'janvier' => 1,
         'février' => 2,
@@ -225,26 +185,26 @@ class Date
         'décembre' => 12,
         // German
         'januar' => 1,
-        'jan' => 1,
+        // 'jan' => 1,
         'februar' => 2,
-        'feb' => 2,
+        // 'feb' => 2,
         'märz' => 3,
         'mär' => 3,
-        'april' => 4,
-        'apr' => 4,
-        'mai' => 5, // no short form for may
-        'juni' => 6,
-        'jun' => 6,
-        'juli' => 7,
-        'jul' => 7,
-        'august' => 8,
-        'aug' => 8,
-        'september' => 9,
-        'sep' => 9,
-        'oktober' => 10,
+        // 'april' => 4,
+        // 'apr' => 4,
+        // 'mai' => 5, // no short form for may
+        // 'juni' => 6,
+        // 'jun' => 6,
+        // 'juli' => 7,
+        // 'jul' => 7,
+        // 'august' => 8,
+        // 'aug' => 8,
+        // 'september' => 9,
+        // 'sep' => 9,
+        // 'oktober' => 10,
         'okt' => 10,
-        'november' => 11,
-        'nov' => 11,
+        // 'november' => 11,
+        // 'nov' => 11,
         'dezember' => 12,
         'dez' => 12,
         // Italian
@@ -258,17 +218,17 @@ class Date
         'agosto' => 8,
         'settembre' => 9,
         'ottobre' => 10,
-        'novembre' => 11,
+        // 'novembre' => 11,
         'dicembre' => 12,
         // Spanish
         'enero' => 1,
         'febrero' => 2,
-        'marzo' => 3,
+        // 'marzo' => 3,
         'abril' => 4,
         'mayo' => 5,
         'junio' => 6,
         'julio' => 7,
-        'agosto' => 8,
+        // 'agosto' => 8,
         'septiembre' => 9,
         'setiembre' => 9,
         'octubre' => 10,
@@ -298,8 +258,8 @@ class Date
         'augusztus' => 8,
         'szeptember' => 9,
         'október' => 10,
-        'november' => 11,
-        'december' => 12,
+        // 'november' => 11,
+        // 'december' => 12,
         // Greek
         'Ιαν' => 1,
         'Φεβ' => 2,
@@ -351,7 +311,7 @@ class Date
      * List of timezones, abbreviation => offset from UTC
      *
      * @access protected
-     * @var array
+     * @var array<string, int>
      */
     public $timezone = [
         'ACDT' => 37800,
@@ -422,7 +382,7 @@ class Date
         'GILT' => 43200,
         'GIT' => -32400,
         'GST' => 14400,
-        'GST' => -7200,
+        // 'GST' => -7200,
         'GYT' => -14400,
         'HAA' => -10800,
         'HAC' => -18000,
@@ -576,7 +536,7 @@ class Date
      * Array of user-added callback methods
      *
      * @access private
-     * @var array
+     * @var array<string>
      */
     public $built_in = [];

@@ -584,7 +544,7 @@ class Date
      * Array of user-added callback methods
      *
      * @access private
-     * @var array
+     * @var array<callable(string): (int|false)>
      */
     public $user = [];

@@ -619,6 +579,7 @@ class Date
      * Get the object
      *
      * @access public
+     * @return Date
      */
     public static function get()
     {
@@ -635,18 +596,21 @@ class Date
      * @final
      * @access public
      * @param string $date Date to parse
-     * @return int Timestamp corresponding to date string, or false on failure
+     * @return int|false Timestamp corresponding to date string, or false on failure
      */
-    public function parse($date)
+    public function parse(string $date)
     {
         foreach ($this->user as $method) {
             if (($returned = call_user_func($method, $date)) !== false) {
-                return $returned;
+                return (int) $returned;
             }
         }

         foreach ($this->built_in as $method) {
-            if (($returned = call_user_func([$this, $method], $date)) !== false) {
+            // TODO: we should really check this in constructor but that would require private properties.
+            /** @var callable(string): (int|false) */
+            $callable = [$this, $method];
+            if (($returned = call_user_func($callable, $date)) !== false) {
                 return $returned;
             }
         }
@@ -660,14 +624,11 @@ class Date
      * @final
      * @access public
      * @param callable $callback
+     * @return void
      */
-    public function add_callback($callback)
+    public function add_callback(callable $callback)
     {
-        if (is_callable($callback)) {
-            $this->user[] = $callback;
-        } else {
-            trigger_error('User-supplied function must be a valid callback', E_USER_WARNING);
-        }
+        $this->user[] = $callback;
     }

     /**
@@ -676,9 +637,10 @@ class Date
      * spaces to be used as the time separator (including more than one))
      *
      * @access protected
-     * @return int Timestamp
+     * @param string $date
+     * @return int|false Timestamp
      */
-    public function date_w3cdtf($date)
+    public function date_w3cdtf(string $date)
     {
         $pcre = <<<'PCRE'
             /
@@ -749,12 +711,11 @@ PCRE;
      * Remove RFC822 comments
      *
      * @access protected
-     * @param string $data Data to strip comments from
+     * @param string $string Data to strip comments from
      * @return string Comment stripped string
      */
-    public function remove_rfc2822_comments($string)
+    public function remove_rfc2822_comments(string $string)
     {
-        $string = (string) $string;
         $position = 0;
         $length = strlen($string);
         $depth = 0;
@@ -799,9 +760,10 @@ PCRE;
      * Parse RFC2822's date format
      *
      * @access protected
-     * @return int Timestamp
+     * @param string $date
+     * @return int|false Timestamp
      */
-    public function date_rfc2822($date)
+    public function date_rfc2822(string $date)
     {
         static $pcre;
         if (!$pcre) {
@@ -834,20 +796,31 @@ PCRE;
             11: Alphabetic timezone
             */

+            $day = (int) $match[2];
             // Find the month number
             $month = $this->month[strtolower($match[3])];
+            $year = (int) $match[4];
+            $hour = (int) $match[5];
+            $minute = (int) $match[6];
+            // Second is optional, if it is empty set it to zero
+            $second = (int) $match[7];
+
+            $tz_sign = $match[8];
+            $tz_hour = (int) $match[9];
+            $tz_minute = (int) $match[10];
+            $tz_code = isset($match[11]) ? strtoupper($match[11]) : '';

             // Numeric timezone
-            if ($match[8] !== '') {
-                $timezone = $match[9] * 3600;
-                $timezone += $match[10] * 60;
-                if ($match[8] === '-') {
+            if ($tz_sign !== '') {
+                $timezone = $tz_hour * 3600;
+                $timezone += $tz_minute * 60;
+                if ($tz_sign === '-') {
                     $timezone = 0 - $timezone;
                 }
             }
             // Character timezone
-            elseif (isset($this->timezone[strtoupper($match[11])])) {
-                $timezone = $this->timezone[strtoupper($match[11])];
+            elseif (isset($this->timezone[$tz_code])) {
+                $timezone = $this->timezone[$tz_code];
             }
             // Assume everything else to be -0000
             else {
@@ -855,20 +828,13 @@ PCRE;
             }

             // Deal with 2/3 digit years
-            if ($match[4] < 50) {
-                $match[4] += 2000;
-            } elseif ($match[4] < 1000) {
-                $match[4] += 1900;
-            }
-
-            // Second is optional, if it is empty set it to zero
-            if ($match[7] !== '') {
-                $second = $match[7];
-            } else {
-                $second = 0;
+            if ($year < 50) {
+                $year += 2000;
+            } elseif ($year < 1000) {
+                $year += 1900;
             }

-            return gmmktime(intval($match[5]), intval($match[6]), intval($second), intval($month), intval($match[2]), intval($match[4])) - $timezone;
+            return gmmktime($hour, $minute, $second, $month, $day, $year) - $timezone;
         }

         return false;
@@ -878,9 +844,10 @@ PCRE;
      * Parse RFC850's date format
      *
      * @access protected
-     * @return int Timestamp
+     * @param string $date
+     * @return int|false Timestamp
      */
-    public function date_rfc850($date)
+    public function date_rfc850(string $date)
     {
         static $pcre;
         if (!$pcre) {
@@ -905,12 +872,20 @@ PCRE;
             8: Timezone
             */

+            $day = (int) $match[2];
             // Month
             $month = $this->month[strtolower($match[3])];
+            $year = (int) $match[4];
+            $hour = (int) $match[5];
+            $minute = (int) $match[6];
+            // Second is optional, if it is empty set it to zero
+            $second = (int) $match[7];
+
+            $tz_code = strtoupper($match[8]);

             // Character timezone
-            if (isset($this->timezone[strtoupper($match[8])])) {
-                $timezone = $this->timezone[strtoupper($match[8])];
+            if (isset($this->timezone[$tz_code])) {
+                $timezone = $this->timezone[$tz_code];
             }
             // Assume everything else to be -0000
             else {
@@ -918,13 +893,13 @@ PCRE;
             }

             // Deal with 2 digit year
-            if ($match[4] < 50) {
-                $match[4] += 2000;
+            if ($year < 50) {
+                $year += 2000;
             } else {
-                $match[4] += 1900;
+                $year += 1900;
             }

-            return gmmktime($match[5], $match[6], $match[7], $month, $match[2], $match[4]) - $timezone;
+            return gmmktime($hour, $minute, $second, $month, $day, $year) - $timezone;
         }

         return false;
@@ -934,9 +909,10 @@ PCRE;
      * Parse C99's asctime()'s date format
      *
      * @access protected
-     * @return int Timestamp
+     * @param string $date
+     * @return int|false Timestamp
      */
-    public function date_asctime($date)
+    public function date_asctime(string $date)
     {
         static $pcre;
         if (!$pcre) {
@@ -972,9 +948,10 @@ PCRE;
      * Parse dates using strtotime()
      *
      * @access protected
-     * @return int Timestamp
+     * @param string $date
+     * @return int|false Timestamp
      */
-    public function date_strtotime($date)
+    public function date_strtotime(string $date)
     {
         $strtotime = strtotime($date);
         if ($strtotime === -1 || $strtotime === false) {
diff --git a/wp-includes/SimplePie/src/Parser.php b/wp-includes/SimplePie/src/Parser.php
index baf70d2bdb..fc93996eb7 100644
--- a/wp-includes/SimplePie/src/Parser.php
+++ b/wp-includes/SimplePie/src/Parser.php
@@ -1,85 +1,68 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie;

 use SimplePie\XML\Declaration\Parser as DeclarationParser;
+use XMLParser;

 /**
  * Parses XML into something sane
  *
  *
  * This class can be overloaded with {@see \SimplePie\SimplePie::set_parser_class()}
- *
- * @package SimplePie
- * @subpackage Parsing
  */
 class Parser implements RegistryAware
 {
+    /** @var int */
     public $error_code;
+    /** @var string */
     public $error_string;
+    /** @var int */
     public $current_line;
+    /** @var int */
     public $current_column;
+    /** @var int */
     public $current_byte;
+    /** @var string */
     public $separator = ' ';
+    /** @var string[] */
     public $namespace = [''];
+    /** @var string[] */
     public $element = [''];
+    /** @var string[] */
     public $xml_base = [''];
+    /** @var bool[] */
     public $xml_base_explicit = [false];
+    /** @var string[] */
     public $xml_lang = [''];
+    /** @var array<string, mixed> */
     public $data = [];
+    /** @var array<array<string, mixed>> */
     public $datas = [[]];
+    /** @var int */
     public $current_xhtml_construct = -1;
+    /** @var string */
     public $encoding;
+    /** @var Registry */
     protected $registry;

-    public function set_registry(\SimplePie\Registry $registry)/* : void */
+    /**
+     * @return void
+     */
+    public function set_registry(\SimplePie\Registry $registry)
     {
         $this->registry = $registry;
     }

-    public function parse(&$data, $encoding, $url = '')
+    /**
+     * @return bool
+     */
+    public function parse(string &$data, string $encoding, string $url = '')
     {
         if (class_exists('DOMXpath') && function_exists('Mf2\parse')) {
             $doc = new \DOMDocument();
@@ -89,6 +72,7 @@ class Parser implements RegistryAware
             // and a list of entries without an h-feed wrapper are both valid.
             $query = '//*[contains(concat(" ", @class, " "), " h-feed ") or '.
                 'contains(concat(" ", @class, " "), " h-entry ")]';
+            /** @var \DOMNodeList<\DOMElement> $result */
             $result = $xpath->query($query);
             if ($result->length !== 0) {
                 return $this->parse_microformats($data, $url);
@@ -128,11 +112,14 @@ class Parser implements RegistryAware
             $declaration = $this->registry->create(DeclarationParser::class, [substr($data, 5, $pos - 5)]);
             if ($declaration->parse()) {
                 $data = substr($data, $pos + 2);
-                $data = '<?xml version="' . $declaration->version . '" encoding="' . $encoding . '" standalone="' . (($declaration->standalone) ? 'yes' : 'no') . '"?>' ."\n". $this->declare_html_entities() . $data;
+                $data = '<?xml version="' . $declaration->version . '" encoding="' . $encoding . '" standalone="' . (($declaration->standalone) ? 'yes' : 'no') . '"?>' . "\n" .
+                    self::set_doctype($data);
             } else {
                 $this->error_string = 'SimplePie bug! Please report this!';
                 return false;
             }
+        } else {
+            $data = self::set_doctype($data);
         }

         $return = true;
@@ -141,7 +128,9 @@ class Parser implements RegistryAware
         if ($xml_is_sane === null) {
             $parser_check = xml_parser_create();
             xml_parse_into_struct($parser_check, '<foo>&amp;</foo>', $values);
-            xml_parser_free($parser_check);
+            if (\PHP_VERSION_ID < 80000) {
+                xml_parser_free($parser_check);
+            }
             $xml_is_sane = isset($values[0]['value']);
         }

@@ -160,10 +149,11 @@ class Parser implements RegistryAware
                 rewind($stream)) {
                 //Parse by chunks not to use too much memory
                 do {
-                    $stream_data = fread($stream, 1048576);
-                    if (!xml_parse($xml, $stream_data === false ? '' : $stream_data, feof($stream))) {
+                    $stream_data = (string) fread($stream, 1048576);
+
+                    if (!xml_parse($xml, $stream_data, feof($stream))) {
                         $this->error_code = xml_get_error_code($xml);
-                        $this->error_string = xml_error_string($this->error_code);
+                        $this->error_string = xml_error_string($this->error_code) ?: "Unknown";
                         $return = false;
                         break;
                     }
@@ -176,7 +166,9 @@ class Parser implements RegistryAware
             $this->current_line = xml_get_current_line_number($xml);
             $this->current_column = xml_get_current_column_number($xml);
             $this->current_byte = xml_get_current_byte_index($xml);
-            xml_parser_free($xml);
+            if (\PHP_VERSION_ID < 80000) {
+                xml_parser_free($xml);
+            }
             return $return;
         }

@@ -185,7 +177,7 @@ class Parser implements RegistryAware
         $xml->xml($data);
         while (@$xml->read()) {
             switch ($xml->nodeType) {
-                case constant('XMLReader::END_ELEMENT'):
+                case \XMLReader::END_ELEMENT:
                     if ($xml->namespaceURI !== '') {
                         $tagName = $xml->namespaceURI . $this->separator . $xml->localName;
                     } else {
@@ -193,7 +185,7 @@ class Parser implements RegistryAware
                     }
                     $this->tag_close(null, $tagName);
                     break;
-                case constant('XMLReader::ELEMENT'):
+                case \XMLReader::ELEMENT:
                     $empty = $xml->isEmptyElement;
                     if ($xml->namespaceURI !== '') {
                         $tagName = $xml->namespaceURI . $this->separator . $xml->localName;
@@ -214,9 +206,9 @@ class Parser implements RegistryAware
                         $this->tag_close(null, $tagName);
                     }
                     break;
-                case constant('XMLReader::TEXT'):
+                case \XMLReader::TEXT:

-                case constant('XMLReader::CDATA'):
+                case \XMLReader::CDATA:
                     $this->cdata(null, $xml->value);
                     break;
             }
@@ -232,37 +224,60 @@ class Parser implements RegistryAware
         return true;
     }

+    /**
+     * @return int
+     */
     public function get_error_code()
     {
         return $this->error_code;
     }

+    /**
+     * @return string
+     */
     public function get_error_string()
     {
         return $this->error_string;
     }

+    /**
+     * @return int
+     */
     public function get_current_line()
     {
         return $this->current_line;
     }

+    /**
+     * @return int
+     */
     public function get_current_column()
     {
         return $this->current_column;
     }

+    /**
+     * @return int
+     */
     public function get_current_byte()
     {
         return $this->current_byte;
     }

+    /**
+     * @return array<string, mixed>
+     */
     public function get_data()
     {
         return $this->data;
     }

-    public function tag_open($parser, $tag, $attributes)
+    /**
+     * @param XMLParser|resource|null $parser
+     * @param array<string, string> $attributes
+     * @return void
+     */
+    public function tag_open($parser, string $tag, array $attributes)
     {
         [$this->namespace[], $this->element[]] = $this->split_ns($tag);

@@ -279,14 +294,14 @@ class Parser implements RegistryAware
                 $this->xml_base_explicit[] = true;
             }
         } else {
-            $this->xml_base[] = end($this->xml_base);
+            $this->xml_base[] = end($this->xml_base) ?: '';
             $this->xml_base_explicit[] = end($this->xml_base_explicit);
         }

         if (isset($attribs[\SimplePie\SimplePie::NAMESPACE_XML]['lang'])) {
             $this->xml_lang[] = $attribs[\SimplePie\SimplePie::NAMESPACE_XML]['lang'];
         } else {
-            $this->xml_lang[] = end($this->xml_lang);
+            $this->xml_lang[] = end($this->xml_lang) ?: '';
         }

         if ($this->current_xhtml_construct >= 0) {
@@ -314,7 +329,11 @@ class Parser implements RegistryAware
         }
     }

-    public function cdata($parser, $cdata)
+    /**
+     * @param XMLParser|resource|null $parser
+     * @return void
+     */
+    public function cdata($parser, string $cdata)
     {
         if ($this->current_xhtml_construct >= 0) {
             $this->data['data'] .= htmlspecialchars($cdata, ENT_QUOTES, $this->encoding);
@@ -323,7 +342,11 @@ class Parser implements RegistryAware
         }
     }

-    public function tag_close($parser, $tag)
+    /**
+     * @param XMLParser|resource|null $parser
+     * @return void
+     */
+    public function tag_close($parser, string $tag)
     {
         if ($this->current_xhtml_construct >= 0) {
             $this->current_xhtml_construct--;
@@ -343,7 +366,10 @@ class Parser implements RegistryAware
         array_pop($this->xml_lang);
     }

-    public function split_ns($string)
+    /**
+     * @return array{string, string}
+     */
+    public function split_ns(string $string)
     {
         static $cache = [];
         if (!isset($cache[$string])) {
@@ -374,7 +400,10 @@ class Parser implements RegistryAware
         return $cache[$string];
     }

-    private function parse_hcard($data, $category = false)
+    /**
+     * @param array<string, mixed> $data
+     */
+    private function parse_hcard(array $data, bool $category = false): string
     {
         $name = '';
         $link = '';
@@ -398,8 +427,14 @@ class Parser implements RegistryAware
         return $data['value'] ?? '';
     }

-    private function parse_microformats(&$data, $url)
+    /**
+     * @return true
+     */
+    private function parse_microformats(string &$data, string $url): bool
     {
+        // For PHPStan, we already check that in call site.
+        \assert(function_exists('Mf2\parse'));
+        \assert(function_exists('Mf2\fetch'));
         $feed_title = '';
         $feed_author = null;
         $author_cache = [];
@@ -485,23 +520,24 @@ class Parser implements RegistryAware
                         if (isset($author_cache[$author])) {
                             $author = $author_cache[$author];
                         } else {
-                            $mf = \Mf2\fetch($author);
-                            foreach ($mf['items'] as $hcard) {
-                                // Only interested in an h-card by itself in this case.
-                                if (!in_array('h-card', $hcard['type'])) {
-                                    continue;
-                                }
-                                // It must have a url property matching what we fetched.
-                                if (!isset($hcard['properties']['url']) ||
-                                        !(in_array($author, $hcard['properties']['url']))) {
-                                    continue;
+                            if ($mf = \Mf2\fetch($author)) {
+                                foreach ($mf['items'] as $hcard) {
+                                    // Only interested in an h-card by itself in this case.
+                                    if (!in_array('h-card', $hcard['type'])) {
+                                        continue;
+                                    }
+                                    // It must have a url property matching what we fetched.
+                                    if (!isset($hcard['properties']['url']) ||
+                                            !(in_array($author, $hcard['properties']['url']))) {
+                                        continue;
+                                    }
+                                    // Save parse_hcard the trouble of finding the correct url.
+                                    $hcard['properties']['url'][0] = $author;
+                                    // Cache this h-card for the next h-entry to check.
+                                    $author_cache[$author] = $this->parse_hcard($hcard);
+                                    $author = $author_cache[$author];
+                                    break;
                                 }
-                                // Save parse_hcard the trouble of finding the correct url.
-                                $hcard['properties']['url'][0] = $author;
-                                // Cache this h-card for the next h-entry to check.
-                                $author_cache[$author] = $this->parse_hcard($hcard);
-                                $author = $author_cache[$author];
-                                break;
                             }
                         }
                     }
@@ -619,11 +655,20 @@ class Parser implements RegistryAware
         return true;
     }

-    private function declare_html_entities()
+    private static function set_doctype(string $data): string
+    {
+        // Strip DOCTYPE except if containing an [internal subset]
+        $data = preg_replace('/^\\s*<!DOCTYPE\\s[^>\\[\\]]*>\s*/', '', $data) ?? $data;
+        // Declare HTML entities only if no remaining DOCTYPE
+        $doctype = preg_match('/^\\s*<!DOCTYPE\\s/', $data) ? '' : self::declare_html_entities();
+        return $doctype . $data;
+    }
+
+    private static function declare_html_entities(): string
     {
         // This is required because the RSS specification says that entity-encoded
         // html is allowed, but the xml specification says they must be declared.
-        return '<!DOCTYPE html [ <!ENTITY nbsp "&#x00A0;"> <!ENTITY iexcl "&#x00A1;"> <!ENTITY cent "&#x00A2;"> <!ENTITY pound "&#x00A3;"> <!ENTITY curren "&#x00A4;"> <!ENTITY yen "&#x00A5;"> <!ENTITY brvbar "&#x00A6;"> <!ENTITY sect "&#x00A7;"> <!ENTITY uml "&#x00A8;"> <!ENTITY copy "&#x00A9;"> <!ENTITY ordf "&#x00AA;"> <!ENTITY laquo "&#x00AB;"> <!ENTITY not "&#x00AC;"> <!ENTITY shy "&#x00AD;"> <!ENTITY reg "&#x00AE;"> <!ENTITY macr "&#x00AF;"> <!ENTITY deg "&#x00B0;"> <!ENTITY plusmn "&#x00B1;"> <!ENTITY sup2 "&#x00B2;"> <!ENTITY sup3 "&#x00B3;"> <!ENTITY acute "&#x00B4;"> <!ENTITY micro "&#x00B5;"> <!ENTITY para "&#x00B6;"> <!ENTITY middot "&#x00B7;"> <!ENTITY cedil "&#x00B8;"> <!ENTITY sup1 "&#x00B9;"> <!ENTITY ordm "&#x00BA;"> <!ENTITY raquo "&#x00BB;"> <!ENTITY frac14 "&#x00BC;"> <!ENTITY frac12 "&#x00BD;"> <!ENTITY frac34 "&#x00BE;"> <!ENTITY iquest "&#x00BF;"> <!ENTITY Agrave "&#x00C0;"> <!ENTITY Aacute "&#x00C1;"> <!ENTITY Acirc "&#x00C2;"> <!ENTITY Atilde "&#x00C3;"> <!ENTITY Auml "&#x00C4;"> <!ENTITY Aring "&#x00C5;"> <!ENTITY AElig "&#x00C6;"> <!ENTITY Ccedil "&#x00C7;"> <!ENTITY Egrave "&#x00C8;"> <!ENTITY Eacute "&#x00C9;"> <!ENTITY Ecirc "&#x00CA;"> <!ENTITY Euml "&#x00CB;"> <!ENTITY Igrave "&#x00CC;"> <!ENTITY Iacute "&#x00CD;"> <!ENTITY Icirc "&#x00CE;"> <!ENTITY Iuml "&#x00CF;"> <!ENTITY ETH "&#x00D0;"> <!ENTITY Ntilde "&#x00D1;"> <!ENTITY Ograve "&#x00D2;"> <!ENTITY Oacute "&#x00D3;"> <!ENTITY Ocirc "&#x00D4;"> <!ENTITY Otilde "&#x00D5;"> <!ENTITY Ouml "&#x00D6;"> <!ENTITY times "&#x00D7;"> <!ENTITY Oslash "&#x00D8;"> <!ENTITY Ugrave "&#x00D9;"> <!ENTITY Uacute "&#x00DA;"> <!ENTITY Ucirc "&#x00DB;"> <!ENTITY Uuml "&#x00DC;"> <!ENTITY Yacute "&#x00DD;"> <!ENTITY THORN "&#x00DE;"> <!ENTITY szlig "&#x00DF;"> <!ENTITY agrave "&#x00E0;"> <!ENTITY aacute "&#x00E1;"> <!ENTITY acirc "&#x00E2;"> <!ENTITY atilde "&#x00E3;"> <!ENTITY auml "&#x00E4;"> <!ENTITY aring "&#x00E5;"> <!ENTITY aelig "&#x00E6;"> <!ENTITY ccedil "&#x00E7;"> <!ENTITY egrave "&#x00E8;"> <!ENTITY eacute "&#x00E9;"> <!ENTITY ecirc "&#x00EA;"> <!ENTITY euml "&#x00EB;"> <!ENTITY igrave "&#x00EC;"> <!ENTITY iacute "&#x00ED;"> <!ENTITY icirc "&#x00EE;"> <!ENTITY iuml "&#x00EF;"> <!ENTITY eth "&#x00F0;"> <!ENTITY ntilde "&#x00F1;"> <!ENTITY ograve "&#x00F2;"> <!ENTITY oacute "&#x00F3;"> <!ENTITY ocirc "&#x00F4;"> <!ENTITY otilde "&#x00F5;"> <!ENTITY ouml "&#x00F6;"> <!ENTITY divide "&#x00F7;"> <!ENTITY oslash "&#x00F8;"> <!ENTITY ugrave "&#x00F9;"> <!ENTITY uacute "&#x00FA;"> <!ENTITY ucirc "&#x00FB;"> <!ENTITY uuml "&#x00FC;"> <!ENTITY yacute "&#x00FD;"> <!ENTITY thorn "&#x00FE;"> <!ENTITY yuml "&#x00FF;"> <!ENTITY OElig "&#x0152;"> <!ENTITY oelig "&#x0153;"> <!ENTITY Scaron "&#x0160;"> <!ENTITY scaron "&#x0161;"> <!ENTITY Yuml "&#x0178;"> <!ENTITY fnof "&#x0192;"> <!ENTITY circ "&#x02C6;"> <!ENTITY tilde "&#x02DC;"> <!ENTITY Alpha "&#x0391;"> <!ENTITY Beta "&#x0392;"> <!ENTITY Gamma "&#x0393;"> <!ENTITY Epsilon "&#x0395;"> <!ENTITY Zeta "&#x0396;"> <!ENTITY Eta "&#x0397;"> <!ENTITY Theta "&#x0398;"> <!ENTITY Iota "&#x0399;"> <!ENTITY Kappa "&#x039A;"> <!ENTITY Lambda "&#x039B;"> <!ENTITY Mu "&#x039C;"> <!ENTITY Nu "&#x039D;"> <!ENTITY Xi "&#x039E;"> <!ENTITY Omicron "&#x039F;"> <!ENTITY Pi "&#x03A0;"> <!ENTITY Rho "&#x03A1;"> <!ENTITY Sigma "&#x03A3;"> <!ENTITY Tau "&#x03A4;"> <!ENTITY Upsilon "&#x03A5;"> <!ENTITY Phi "&#x03A6;"> <!ENTITY Chi "&#x03A7;"> <!ENTITY Psi "&#x03A8;"> <!ENTITY Omega "&#x03A9;"> <!ENTITY alpha "&#x03B1;"> <!ENTITY beta "&#x03B2;"> <!ENTITY gamma "&#x03B3;"> <!ENTITY delta "&#x03B4;"> <!ENTITY epsilon "&#x03B5;"> <!ENTITY zeta "&#x03B6;"> <!ENTITY eta "&#x03B7;"> <!ENTITY theta "&#x03B8;"> <!ENTITY iota "&#x03B9;"> <!ENTITY kappa "&#x03BA;"> <!ENTITY lambda "&#x03BB;"> <!ENTITY mu "&#x03BC;"> <!ENTITY nu "&#x03BD;"> <!ENTITY xi "&#x03BE;"> <!ENTITY omicron "&#x03BF;"> <!ENTITY pi "&#x03C0;"> <!ENTITY rho "&#x03C1;"> <!ENTITY sigmaf "&#x03C2;"> <!ENTITY sigma "&#x03C3;"> <!ENTITY tau "&#x03C4;"> <!ENTITY upsilon "&#x03C5;"> <!ENTITY phi "&#x03C6;"> <!ENTITY chi "&#x03C7;"> <!ENTITY psi "&#x03C8;"> <!ENTITY omega "&#x03C9;"> <!ENTITY thetasym "&#x03D1;"> <!ENTITY upsih "&#x03D2;"> <!ENTITY piv "&#x03D6;"> <!ENTITY ensp "&#x2002;"> <!ENTITY emsp "&#x2003;"> <!ENTITY thinsp "&#x2009;"> <!ENTITY zwnj "&#x200C;"> <!ENTITY zwj "&#x200D;"> <!ENTITY lrm "&#x200E;"> <!ENTITY rlm "&#x200F;"> <!ENTITY ndash "&#x2013;"> <!ENTITY mdash "&#x2014;"> <!ENTITY lsquo "&#x2018;"> <!ENTITY rsquo "&#x2019;"> <!ENTITY sbquo "&#x201A;"> <!ENTITY ldquo "&#x201C;"> <!ENTITY rdquo "&#x201D;"> <!ENTITY bdquo "&#x201E;"> <!ENTITY dagger "&#x2020;"> <!ENTITY Dagger "&#x2021;"> <!ENTITY bull "&#x2022;"> <!ENTITY hellip "&#x2026;"> <!ENTITY permil "&#x2030;"> <!ENTITY prime "&#x2032;"> <!ENTITY Prime "&#x2033;"> <!ENTITY lsaquo "&#x2039;"> <!ENTITY rsaquo "&#x203A;"> <!ENTITY oline "&#x203E;"> <!ENTITY frasl "&#x2044;"> <!ENTITY euro "&#x20AC;"> <!ENTITY image "&#x2111;"> <!ENTITY weierp "&#x2118;"> <!ENTITY real "&#x211C;"> <!ENTITY trade "&#x2122;"> <!ENTITY alefsym "&#x2135;"> <!ENTITY larr "&#x2190;"> <!ENTITY uarr "&#x2191;"> <!ENTITY rarr "&#x2192;"> <!ENTITY darr "&#x2193;"> <!ENTITY harr "&#x2194;"> <!ENTITY crarr "&#x21B5;"> <!ENTITY lArr "&#x21D0;"> <!ENTITY uArr "&#x21D1;"> <!ENTITY rArr "&#x21D2;"> <!ENTITY dArr "&#x21D3;"> <!ENTITY hArr "&#x21D4;"> <!ENTITY forall "&#x2200;"> <!ENTITY part "&#x2202;"> <!ENTITY exist "&#x2203;"> <!ENTITY empty "&#x2205;"> <!ENTITY nabla "&#x2207;"> <!ENTITY isin "&#x2208;"> <!ENTITY notin "&#x2209;"> <!ENTITY ni "&#x220B;"> <!ENTITY prod "&#x220F;"> <!ENTITY sum "&#x2211;"> <!ENTITY minus "&#x2212;"> <!ENTITY lowast "&#x2217;"> <!ENTITY radic "&#x221A;"> <!ENTITY prop "&#x221D;"> <!ENTITY infin "&#x221E;"> <!ENTITY ang "&#x2220;"> <!ENTITY and "&#x2227;"> <!ENTITY or "&#x2228;"> <!ENTITY cap "&#x2229;"> <!ENTITY cup "&#x222A;"> <!ENTITY int "&#x222B;"> <!ENTITY there4 "&#x2234;"> <!ENTITY sim "&#x223C;"> <!ENTITY cong "&#x2245;"> <!ENTITY asymp "&#x2248;"> <!ENTITY ne "&#x2260;"> <!ENTITY equiv "&#x2261;"> <!ENTITY le "&#x2264;"> <!ENTITY ge "&#x2265;"> <!ENTITY sub "&#x2282;"> <!ENTITY sup "&#x2283;"> <!ENTITY nsub "&#x2284;"> <!ENTITY sube "&#x2286;"> <!ENTITY supe "&#x2287;"> <!ENTITY oplus "&#x2295;"> <!ENTITY otimes "&#x2297;"> <!ENTITY perp "&#x22A5;"> <!ENTITY sdot "&#x22C5;"> <!ENTITY lceil "&#x2308;"> <!ENTITY rceil "&#x2309;"> <!ENTITY lfloor "&#x230A;"> <!ENTITY rfloor "&#x230B;"> <!ENTITY lang "&#x2329;"> <!ENTITY rang "&#x232A;"> <!ENTITY loz "&#x25CA;"> <!ENTITY spades "&#x2660;"> <!ENTITY clubs "&#x2663;"> <!ENTITY hearts "&#x2665;"> <!ENTITY diams "&#x2666;"> ]>';
+        return '<!DOCTYPE rss [ <!ENTITY nbsp "&#x00A0;"> <!ENTITY iexcl "&#x00A1;"> <!ENTITY cent "&#x00A2;"> <!ENTITY pound "&#x00A3;"> <!ENTITY curren "&#x00A4;"> <!ENTITY yen "&#x00A5;"> <!ENTITY brvbar "&#x00A6;"> <!ENTITY sect "&#x00A7;"> <!ENTITY uml "&#x00A8;"> <!ENTITY copy "&#x00A9;"> <!ENTITY ordf "&#x00AA;"> <!ENTITY laquo "&#x00AB;"> <!ENTITY not "&#x00AC;"> <!ENTITY shy "&#x00AD;"> <!ENTITY reg "&#x00AE;"> <!ENTITY macr "&#x00AF;"> <!ENTITY deg "&#x00B0;"> <!ENTITY plusmn "&#x00B1;"> <!ENTITY sup2 "&#x00B2;"> <!ENTITY sup3 "&#x00B3;"> <!ENTITY acute "&#x00B4;"> <!ENTITY micro "&#x00B5;"> <!ENTITY para "&#x00B6;"> <!ENTITY middot "&#x00B7;"> <!ENTITY cedil "&#x00B8;"> <!ENTITY sup1 "&#x00B9;"> <!ENTITY ordm "&#x00BA;"> <!ENTITY raquo "&#x00BB;"> <!ENTITY frac14 "&#x00BC;"> <!ENTITY frac12 "&#x00BD;"> <!ENTITY frac34 "&#x00BE;"> <!ENTITY iquest "&#x00BF;"> <!ENTITY Agrave "&#x00C0;"> <!ENTITY Aacute "&#x00C1;"> <!ENTITY Acirc "&#x00C2;"> <!ENTITY Atilde "&#x00C3;"> <!ENTITY Auml "&#x00C4;"> <!ENTITY Aring "&#x00C5;"> <!ENTITY AElig "&#x00C6;"> <!ENTITY Ccedil "&#x00C7;"> <!ENTITY Egrave "&#x00C8;"> <!ENTITY Eacute "&#x00C9;"> <!ENTITY Ecirc "&#x00CA;"> <!ENTITY Euml "&#x00CB;"> <!ENTITY Igrave "&#x00CC;"> <!ENTITY Iacute "&#x00CD;"> <!ENTITY Icirc "&#x00CE;"> <!ENTITY Iuml "&#x00CF;"> <!ENTITY ETH "&#x00D0;"> <!ENTITY Ntilde "&#x00D1;"> <!ENTITY Ograve "&#x00D2;"> <!ENTITY Oacute "&#x00D3;"> <!ENTITY Ocirc "&#x00D4;"> <!ENTITY Otilde "&#x00D5;"> <!ENTITY Ouml "&#x00D6;"> <!ENTITY times "&#x00D7;"> <!ENTITY Oslash "&#x00D8;"> <!ENTITY Ugrave "&#x00D9;"> <!ENTITY Uacute "&#x00DA;"> <!ENTITY Ucirc "&#x00DB;"> <!ENTITY Uuml "&#x00DC;"> <!ENTITY Yacute "&#x00DD;"> <!ENTITY THORN "&#x00DE;"> <!ENTITY szlig "&#x00DF;"> <!ENTITY agrave "&#x00E0;"> <!ENTITY aacute "&#x00E1;"> <!ENTITY acirc "&#x00E2;"> <!ENTITY atilde "&#x00E3;"> <!ENTITY auml "&#x00E4;"> <!ENTITY aring "&#x00E5;"> <!ENTITY aelig "&#x00E6;"> <!ENTITY ccedil "&#x00E7;"> <!ENTITY egrave "&#x00E8;"> <!ENTITY eacute "&#x00E9;"> <!ENTITY ecirc "&#x00EA;"> <!ENTITY euml "&#x00EB;"> <!ENTITY igrave "&#x00EC;"> <!ENTITY iacute "&#x00ED;"> <!ENTITY icirc "&#x00EE;"> <!ENTITY iuml "&#x00EF;"> <!ENTITY eth "&#x00F0;"> <!ENTITY ntilde "&#x00F1;"> <!ENTITY ograve "&#x00F2;"> <!ENTITY oacute "&#x00F3;"> <!ENTITY ocirc "&#x00F4;"> <!ENTITY otilde "&#x00F5;"> <!ENTITY ouml "&#x00F6;"> <!ENTITY divide "&#x00F7;"> <!ENTITY oslash "&#x00F8;"> <!ENTITY ugrave "&#x00F9;"> <!ENTITY uacute "&#x00FA;"> <!ENTITY ucirc "&#x00FB;"> <!ENTITY uuml "&#x00FC;"> <!ENTITY yacute "&#x00FD;"> <!ENTITY thorn "&#x00FE;"> <!ENTITY yuml "&#x00FF;"> <!ENTITY OElig "&#x0152;"> <!ENTITY oelig "&#x0153;"> <!ENTITY Scaron "&#x0160;"> <!ENTITY scaron "&#x0161;"> <!ENTITY Yuml "&#x0178;"> <!ENTITY fnof "&#x0192;"> <!ENTITY circ "&#x02C6;"> <!ENTITY tilde "&#x02DC;"> <!ENTITY Alpha "&#x0391;"> <!ENTITY Beta "&#x0392;"> <!ENTITY Gamma "&#x0393;"> <!ENTITY Epsilon "&#x0395;"> <!ENTITY Zeta "&#x0396;"> <!ENTITY Eta "&#x0397;"> <!ENTITY Theta "&#x0398;"> <!ENTITY Iota "&#x0399;"> <!ENTITY Kappa "&#x039A;"> <!ENTITY Lambda "&#x039B;"> <!ENTITY Mu "&#x039C;"> <!ENTITY Nu "&#x039D;"> <!ENTITY Xi "&#x039E;"> <!ENTITY Omicron "&#x039F;"> <!ENTITY Pi "&#x03A0;"> <!ENTITY Rho "&#x03A1;"> <!ENTITY Sigma "&#x03A3;"> <!ENTITY Tau "&#x03A4;"> <!ENTITY Upsilon "&#x03A5;"> <!ENTITY Phi "&#x03A6;"> <!ENTITY Chi "&#x03A7;"> <!ENTITY Psi "&#x03A8;"> <!ENTITY Omega "&#x03A9;"> <!ENTITY alpha "&#x03B1;"> <!ENTITY beta "&#x03B2;"> <!ENTITY gamma "&#x03B3;"> <!ENTITY delta "&#x03B4;"> <!ENTITY epsilon "&#x03B5;"> <!ENTITY zeta "&#x03B6;"> <!ENTITY eta "&#x03B7;"> <!ENTITY theta "&#x03B8;"> <!ENTITY iota "&#x03B9;"> <!ENTITY kappa "&#x03BA;"> <!ENTITY lambda "&#x03BB;"> <!ENTITY mu "&#x03BC;"> <!ENTITY nu "&#x03BD;"> <!ENTITY xi "&#x03BE;"> <!ENTITY omicron "&#x03BF;"> <!ENTITY pi "&#x03C0;"> <!ENTITY rho "&#x03C1;"> <!ENTITY sigmaf "&#x03C2;"> <!ENTITY sigma "&#x03C3;"> <!ENTITY tau "&#x03C4;"> <!ENTITY upsilon "&#x03C5;"> <!ENTITY phi "&#x03C6;"> <!ENTITY chi "&#x03C7;"> <!ENTITY psi "&#x03C8;"> <!ENTITY omega "&#x03C9;"> <!ENTITY thetasym "&#x03D1;"> <!ENTITY upsih "&#x03D2;"> <!ENTITY piv "&#x03D6;"> <!ENTITY ensp "&#x2002;"> <!ENTITY emsp "&#x2003;"> <!ENTITY thinsp "&#x2009;"> <!ENTITY zwnj "&#x200C;"> <!ENTITY zwj "&#x200D;"> <!ENTITY lrm "&#x200E;"> <!ENTITY rlm "&#x200F;"> <!ENTITY ndash "&#x2013;"> <!ENTITY mdash "&#x2014;"> <!ENTITY lsquo "&#x2018;"> <!ENTITY rsquo "&#x2019;"> <!ENTITY sbquo "&#x201A;"> <!ENTITY ldquo "&#x201C;"> <!ENTITY rdquo "&#x201D;"> <!ENTITY bdquo "&#x201E;"> <!ENTITY dagger "&#x2020;"> <!ENTITY Dagger "&#x2021;"> <!ENTITY bull "&#x2022;"> <!ENTITY hellip "&#x2026;"> <!ENTITY permil "&#x2030;"> <!ENTITY prime "&#x2032;"> <!ENTITY Prime "&#x2033;"> <!ENTITY lsaquo "&#x2039;"> <!ENTITY rsaquo "&#x203A;"> <!ENTITY oline "&#x203E;"> <!ENTITY frasl "&#x2044;"> <!ENTITY euro "&#x20AC;"> <!ENTITY image "&#x2111;"> <!ENTITY weierp "&#x2118;"> <!ENTITY real "&#x211C;"> <!ENTITY trade "&#x2122;"> <!ENTITY alefsym "&#x2135;"> <!ENTITY larr "&#x2190;"> <!ENTITY uarr "&#x2191;"> <!ENTITY rarr "&#x2192;"> <!ENTITY darr "&#x2193;"> <!ENTITY harr "&#x2194;"> <!ENTITY crarr "&#x21B5;"> <!ENTITY lArr "&#x21D0;"> <!ENTITY uArr "&#x21D1;"> <!ENTITY rArr "&#x21D2;"> <!ENTITY dArr "&#x21D3;"> <!ENTITY hArr "&#x21D4;"> <!ENTITY forall "&#x2200;"> <!ENTITY part "&#x2202;"> <!ENTITY exist "&#x2203;"> <!ENTITY empty "&#x2205;"> <!ENTITY nabla "&#x2207;"> <!ENTITY isin "&#x2208;"> <!ENTITY notin "&#x2209;"> <!ENTITY ni "&#x220B;"> <!ENTITY prod "&#x220F;"> <!ENTITY sum "&#x2211;"> <!ENTITY minus "&#x2212;"> <!ENTITY lowast "&#x2217;"> <!ENTITY radic "&#x221A;"> <!ENTITY prop "&#x221D;"> <!ENTITY infin "&#x221E;"> <!ENTITY ang "&#x2220;"> <!ENTITY and "&#x2227;"> <!ENTITY or "&#x2228;"> <!ENTITY cap "&#x2229;"> <!ENTITY cup "&#x222A;"> <!ENTITY int "&#x222B;"> <!ENTITY there4 "&#x2234;"> <!ENTITY sim "&#x223C;"> <!ENTITY cong "&#x2245;"> <!ENTITY asymp "&#x2248;"> <!ENTITY ne "&#x2260;"> <!ENTITY equiv "&#x2261;"> <!ENTITY le "&#x2264;"> <!ENTITY ge "&#x2265;"> <!ENTITY sub "&#x2282;"> <!ENTITY sup "&#x2283;"> <!ENTITY nsub "&#x2284;"> <!ENTITY sube "&#x2286;"> <!ENTITY supe "&#x2287;"> <!ENTITY oplus "&#x2295;"> <!ENTITY otimes "&#x2297;"> <!ENTITY perp "&#x22A5;"> <!ENTITY sdot "&#x22C5;"> <!ENTITY lceil "&#x2308;"> <!ENTITY rceil "&#x2309;"> <!ENTITY lfloor "&#x230A;"> <!ENTITY rfloor "&#x230B;"> <!ENTITY lang "&#x2329;"> <!ENTITY rang "&#x232A;"> <!ENTITY loz "&#x25CA;"> <!ENTITY spades "&#x2660;"> <!ENTITY clubs "&#x2663;"> <!ENTITY hearts "&#x2665;"> <!ENTITY diams "&#x2666;"> ]>';
     }
 }

diff --git a/wp-includes/SimplePie/src/Rating.php b/wp-includes/SimplePie/src/Rating.php
index 24c27337fb..ad1aaafa43 100644
--- a/wp-includes/SimplePie/src/Rating.php
+++ b/wp-includes/SimplePie/src/Rating.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie;

@@ -50,16 +13,13 @@ namespace SimplePie;
  * Used by {@see \SimplePie\Enclosure::get_rating()} and {@see \SimplePie\Enclosure::get_ratings()}
  *
  * This class can be overloaded with {@see \SimplePie\SimplePie::set_rating_class()}
- *
- * @package SimplePie
- * @subpackage API
  */
 class Rating
 {
     /**
      * Rating scheme
      *
-     * @var string
+     * @var ?string
      * @see get_scheme()
      */
     public $scheme;
@@ -67,7 +27,7 @@ class Rating
     /**
      * Rating value
      *
-     * @var string
+     * @var ?string
      * @see get_value()
      */
     public $value;
@@ -78,8 +38,10 @@ class Rating
      * For documentation on all the parameters, see the corresponding
      * properties and their accessors
      */
-    public function __construct($scheme = null, $value = null)
-    {
+    public function __construct(
+        ?string $scheme = null,
+        ?string $value = null
+    ) {
         $this->scheme = $scheme;
         $this->value = $value;
     }
diff --git a/wp-includes/SimplePie/src/Registry.php b/wp-includes/SimplePie/src/Registry.php
index 6040d8bf38..228f8c33cd 100644
--- a/wp-includes/SimplePie/src/Registry.php
+++ b/wp-includes/SimplePie/src/Registry.php
@@ -1,49 +1,13 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie;

+use InvalidArgumentException;
 use SimplePie\Content\Type\Sniffer;
 use SimplePie\Parse\Date;
 use SimplePie\XML\Declaration\Parser as DeclarationParser;
@@ -52,8 +16,6 @@ use SimplePie\XML\Declaration\Parser as DeclarationParser;
  * Handles creating objects and calling methods
  *
  * Access this via {@see \SimplePie\SimplePie::get_registry()}
- *
- * @package SimplePie
  */
 class Registry
 {
@@ -90,7 +52,7 @@ class Registry
      * Class mapping
      *
      * @see register()
-     * @var array
+     * @var array<string, class-string>
      */
     protected $classes = [];

@@ -147,7 +109,7 @@ class Registry
      * @param bool $legacy Whether to enable legacy support for this class
      * @return bool Successfulness
      */
-    public function register($type, $class, $legacy = false)
+    public function register(string $type, $class, bool $legacy = false)
     {
         if (array_key_exists($type, $this->legacyTypes)) {
             // trigger_error(sprintf('"%s"(): Using argument #1 ($type) with value "%s" is deprecated since SimplePie 1.8.0, use class-string "%s" instead.', __METHOD__, $type, $this->legacyTypes[$type]), \E_USER_DEPRECATED);
@@ -200,9 +162,13 @@ class Registry
             return null;
         }

+        // For PHPStan: values in $default should be subtypes of keys.
+        /** @var class-string<T> */
         $class = $this->default[$type];

         if (array_key_exists($type, $this->classes)) {
+            // For PHPStan: values in $classes should be subtypes of keys.
+            /** @var class-string<T> */
             $class = $this->classes[$type];
         }

@@ -214,17 +180,26 @@ class Registry
      *
      * @template T class-string $type
      * @param class-string<T> $type
-     * @param array $parameters Parameters to pass to the constructor
+     * @param array<mixed> $parameters Parameters to pass to the constructor
      * @return T Instance of class
      */
-    public function &create($type, $parameters = [])
+    public function &create($type, array $parameters = [])
     {
         $class = $this->get_class($type);
+        if ($class === null) {
+            throw new InvalidArgumentException(sprintf(
+                '%s(): Argument #1 ($type) "%s" not found in class list.',
+                __METHOD__,
+                $type
+            ), 1);
+        }

         if (!method_exists($class, '__construct')) {
             $instance = new $class();
         } else {
             $reflector = new \ReflectionClass($class);
+            // For PHPStan: $class is T.
+            /** @var T */
             $instance = $reflector->newInstanceArgs($parameters);
         }

@@ -234,6 +209,7 @@ class Registry
             trigger_error(sprintf('Using the method "set_registry()" without implementing "%s" is deprecated since SimplePie 1.8.0, implement "%s" in "%s".', RegistryAware::class, RegistryAware::class, $class), \E_USER_DEPRECATED);
             $instance->set_registry($this);
         }
+
         return $instance;
     }

@@ -242,12 +218,19 @@ class Registry
      *
      * @param class-string $type
      * @param string $method
-     * @param array $parameters
+     * @param array<mixed> $parameters
      * @return mixed
      */
-    public function &call($type, $method, $parameters = [])
+    public function &call($type, string $method, array $parameters = [])
     {
         $class = $this->get_class($type);
+        if ($class === null) {
+            throw new InvalidArgumentException(sprintf(
+                '%s(): Argument #1 ($type) "%s" not found in class list.',
+                __METHOD__,
+                $type
+            ), 1);
+        }

         if (in_array($class, $this->legacy)) {
             switch ($type) {
@@ -256,6 +239,8 @@ class Registry
                     // Cache::create() methods in PHP < 8.0.
                     // No longer supported as of PHP 8.0.
                     if ($method === 'get_handler') {
+                        // Fixing this PHPStan error breaks CacheTest::testDirectOverrideLegacy()
+                        /** @phpstan-ignore argument.type */
                         $result = @call_user_func_array([$class, 'create'], $parameters);
                         return $result;
                     }
@@ -263,7 +248,9 @@ class Registry
             }
         }

-        $result = call_user_func_array([$class, $method], $parameters);
+        $callable = [$class, $method];
+        assert(is_callable($callable), 'For PHPstan');
+        $result = call_user_func_array($callable, $parameters);
         return $result;
     }
 }
diff --git a/wp-includes/SimplePie/src/RegistryAware.php b/wp-includes/SimplePie/src/RegistryAware.php
index 525d93140a..a44845aea1 100644
--- a/wp-includes/SimplePie/src/RegistryAware.php
+++ b/wp-includes/SimplePie/src/RegistryAware.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2022 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie;

@@ -48,17 +11,13 @@ namespace SimplePie;
  * Handles the injection of Registry into other class
  *
  * {@see \SimplePie\SimplePie::get_registry()}
- *
- * @package SimplePie
  */
 interface RegistryAware
 {
     /**
      * Set the Registry into the class
      *
-     * @param Registry $registry
-     *
      * @return void
      */
-    public function set_registry(Registry $registry)/* : void */;
+    public function set_registry(Registry $registry);
 }
diff --git a/wp-includes/SimplePie/src/Restriction.php b/wp-includes/SimplePie/src/Restriction.php
index d3cae11f1f..b3cc51eb00 100644
--- a/wp-includes/SimplePie/src/Restriction.php
+++ b/wp-includes/SimplePie/src/Restriction.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie;

@@ -50,16 +13,16 @@ namespace SimplePie;
  * Used by {@see \SimplePie\Enclosure::get_restriction()} and {@see \SimplePie\Enclosure::get_restrictions()}
  *
  * This class can be overloaded with {@see \SimplePie\SimplePie::set_restriction_class()}
- *
- * @package SimplePie
- * @subpackage API
  */
 class Restriction
 {
+    public const RELATIONSHIP_ALLOW = 'allow';
+    public const RELATIONSHIP_DENY = 'deny';
+
     /**
      * Relationship ('allow'/'deny')
      *
-     * @var string
+     * @var self::RELATIONSHIP_*|null
      * @see get_relationship()
      */
     public $relationship;
@@ -67,7 +30,7 @@ class Restriction
     /**
      * Type of restriction
      *
-     * @var string
+     * @var string|null
      * @see get_type()
      */
     public $type;
@@ -75,7 +38,7 @@ class Restriction
     /**
      * Restricted values
      *
-     * @var string
+     * @var string|null
      * @see get_value()
      */
     public $value;
@@ -85,8 +48,10 @@ class Restriction
      *
      * For documentation on all the parameters, see the corresponding
      * properties and their accessors
+     *
+     * @param ?self::RELATIONSHIP_* $relationship
      */
-    public function __construct($relationship = null, $type = null, $value = null)
+    public function __construct(?string $relationship = null, ?string $type = null, ?string $value = null)
     {
         $this->relationship = $relationship;
         $this->type = $type;
@@ -107,7 +72,7 @@ class Restriction
     /**
      * Get the relationship
      *
-     * @return string|null Either 'allow' or 'deny'
+     * @return ?self::RELATIONSHIP_*
      */
     public function get_relationship()
     {
diff --git a/wp-includes/SimplePie/src/Sanitize.php b/wp-includes/SimplePie/src/Sanitize.php
index 5c22d9c6f8..c8aa2dce69 100644
--- a/wp-includes/SimplePie/src/Sanitize.php
+++ b/wp-includes/SimplePie/src/Sanitize.php
@@ -1,55 +1,27 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie;

+use DOMDocument;
+use DOMXPath;
 use InvalidArgumentException;
+use Psr\Http\Client\ClientInterface;
+use Psr\Http\Message\RequestFactoryInterface;
+use Psr\Http\Message\UriFactoryInterface;
 use SimplePie\Cache\Base;
 use SimplePie\Cache\BaseDataCache;
 use SimplePie\Cache\CallableNameFilter;
 use SimplePie\Cache\DataCache;
 use SimplePie\Cache\NameFilter;
+use SimplePie\HTTP\Client;
+use SimplePie\HTTP\ClientException;
+use SimplePie\HTTP\FileClient;
+use SimplePie\HTTP\Psr18Client;

 /**
  * Used for data cleanup and post-processing
@@ -57,36 +29,59 @@ use SimplePie\Cache\NameFilter;
  *
  * This class can be overloaded with {@see \SimplePie\SimplePie::set_sanitize_class()}
  *
- * @package SimplePie
  * @todo Move to using an actual HTML parser (this will allow tags to be properly stripped, and to switch between HTML and XHTML), this will also make it easier to shorten a string while preserving HTML tags
  */
 class Sanitize implements RegistryAware
 {
     // Private vars
-    public $base;
+    /** @var string */
+    public $base = '';

     // Options
+    /** @var bool */
     public $remove_div = true;
+    /** @var string */
     public $image_handler = '';
+    /** @var string[] */
     public $strip_htmltags = ['base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style'];
+    /** @var bool */
     public $encode_instead_of_strip = false;
+    /** @var string[] */
     public $strip_attributes = ['bgsound', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc'];
+    /** @var string[] */
     public $rename_attributes = [];
+    /** @var array<string, array<string, string>> */
     public $add_attributes = ['audio' => ['preload' => 'none'], 'iframe' => ['sandbox' => 'allow-scripts allow-same-origin'], 'video' => ['preload' => 'none']];
+    /** @var bool */
     public $strip_comments = false;
+    /** @var string */
     public $output_encoding = 'UTF-8';
+    /** @var bool */
     public $enable_cache = true;
+    /** @var string */
     public $cache_location = './cache';
+    /** @var string&(callable(string): string) */
     public $cache_name_function = 'md5';

     /**
      * @var NameFilter
      */
     private $cache_namefilter;
+    /** @var int */
     public $timeout = 10;
+    /** @var string */
     public $useragent = '';
+    /** @var bool */
     public $force_fsockopen = false;
-    public $replace_url_attributes = null;
+    /** @var array<string, string|string[]> */
+    public $replace_url_attributes = [];
+    /**
+     * @var array<int, mixed> Custom curl options
+     * @see SimplePie::set_curl_options()
+     */
+    private $curl_options = [];
+
+    /** @var Registry */
     public $registry;

     /**
@@ -104,45 +99,65 @@ class Sanitize implements RegistryAware
      * @see \SimplePie\Sanitize::set_https_domains()
      * Array is a tree split at DNS levels. Example:
      * array('biz' => true, 'com' => array('example' => true), 'net' => array('example' => array('www' => true)))
+     * @var true|array<string, true|array<string, true|array<string, array<string, true|array<string, true|array<string, true>>>>>>
      */
     public $https_domains = [];

+    /**
+     * @var Client|null
+     */
+    private $http_client = null;
+
     public function __construct()
     {
         // Set defaults
         $this->set_url_replacements(null);
     }

-    public function remove_div($enable = true)
+    /**
+     * @return void
+     */
+    public function remove_div(bool $enable = true)
     {
         $this->remove_div = (bool) $enable;
     }

+    /**
+     * @param string|false $page
+     * @return void
+     */
     public function set_image_handler($page = false)
     {
         if ($page) {
             $this->image_handler = (string) $page;
         } else {
-            $this->image_handler = false;
+            $this->image_handler = '';
         }
     }

-    public function set_registry(\SimplePie\Registry $registry)/* : void */
+    /**
+     * @return void
+     */
+    public function set_registry(\SimplePie\Registry $registry)
     {
         $this->registry = $registry;
     }

-    public function pass_cache_data($enable_cache = true, $cache_location = './cache', $cache_name_function = 'md5', $cache_class = 'SimplePie\Cache', ?DataCache $cache = null)
+    /**
+     * @param (string&(callable(string): string))|NameFilter $cache_name_function
+     * @param class-string<Cache> $cache_class
+     * @return void
+     */
+    public function pass_cache_data(bool $enable_cache = true, string $cache_location = './cache', $cache_name_function = 'md5', string $cache_class = Cache::class, ?DataCache $cache = null)
     {
-        if (isset($enable_cache)) {
-            $this->enable_cache = (bool) $enable_cache;
-        }
+        $this->enable_cache = $enable_cache;

         if ($cache_location) {
-            $this->cache_location = (string) $cache_location;
+            $this->cache_location = $cache_location;
         }

-        if (!is_string($cache_name_function) && !is_object($cache_name_function) && !$cache_name_function instanceof NameFilter) {
+        // @phpstan-ignore-next-line Enforce PHPDoc type.
+        if (!is_string($cache_name_function) && !$cache_name_function instanceof NameFilter) {
             throw new InvalidArgumentException(sprintf(
                 '%s(): Argument #3 ($cache_name_function) must be of type %s',
                 __METHOD__,
@@ -153,7 +168,7 @@ class Sanitize implements RegistryAware
         // BC: $cache_name_function could be a callable as string
         if (is_string($cache_name_function)) {
             // trigger_error(sprintf('Providing $cache_name_function as string in "%s()" is deprecated since SimplePie 1.8.0, provide as "%s" instead.', __METHOD__, NameFilter::class), \E_USER_DEPRECATED);
-            $this->cache_name_function = (string) $cache_name_function;
+            $this->cache_name_function = $cache_name_function;

             $cache_name_function = new CallableNameFilter($cache_name_function);
         }
@@ -165,21 +180,49 @@ class Sanitize implements RegistryAware
         }
     }

-    public function pass_file_data($file_class = 'SimplePie\File', $timeout = 10, $useragent = '', $force_fsockopen = false)
+    /**
+     * Set a PSR-18 client and PSR-17 factories
+     *
+     * Allows you to use your own HTTP client implementations.
+     */
+    final public function set_http_client(
+        ClientInterface $http_client,
+        RequestFactoryInterface $request_factory,
+        UriFactoryInterface $uri_factory
+    ): void {
+        $this->http_client = new Psr18Client($http_client, $request_factory, $uri_factory);
+    }
+
+    /**
+     * @deprecated since SimplePie 1.9.0, use \SimplePie\Sanitize::set_http_client() instead.
+     * @param class-string<File> $file_class
+     * @param array<int, mixed> $curl_options
+     * @return void
+     */
+    public function pass_file_data(string $file_class = File::class, int $timeout = 10, string $useragent = '', bool $force_fsockopen = false, array $curl_options = [])
     {
+        // trigger_error(sprintf('SimplePie\Sanitize::pass_file_data() is deprecated since SimplePie 1.9.0, please use "SimplePie\Sanitize::set_http_client()" instead.'), \E_USER_DEPRECATED);
         if ($timeout) {
-            $this->timeout = (string) $timeout;
+            $this->timeout = $timeout;
         }

         if ($useragent) {
-            $this->useragent = (string) $useragent;
+            $this->useragent = $useragent;
         }

         if ($force_fsockopen) {
-            $this->force_fsockopen = (string) $force_fsockopen;
+            $this->force_fsockopen = $force_fsockopen;
         }
+
+        $this->curl_options = $curl_options;
+        // Invalidate the registered client.
+        $this->http_client = null;
     }

+    /**
+     * @param string[]|string|false $tags Set a list of tags to strip, or set empty string to use default tags, or false to strip nothing.
+     * @return void
+     */
     public function strip_htmltags($tags = ['base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style'])
     {
         if ($tags) {
@@ -189,15 +232,22 @@ class Sanitize implements RegistryAware
                 $this->strip_htmltags = explode(',', $tags);
             }
         } else {
-            $this->strip_htmltags = false;
+            $this->strip_htmltags = [];
         }
     }

-    public function encode_instead_of_strip($encode = false)
+    /**
+     * @return void
+     */
+    public function encode_instead_of_strip(bool $encode = false)
     {
-        $this->encode_instead_of_strip = (bool) $encode;
+        $this->encode_instead_of_strip = $encode;
     }

+    /**
+     * @param string[]|string $attribs
+     * @return void
+     */
     public function rename_attributes($attribs = [])
     {
         if ($attribs) {
@@ -207,10 +257,14 @@ class Sanitize implements RegistryAware
                 $this->rename_attributes = explode(',', $attribs);
             }
         } else {
-            $this->rename_attributes = false;
+            $this->rename_attributes = [];
         }
     }

+    /**
+     * @param string[]|string $attribs
+     * @return void
+     */
     public function strip_attributes($attribs = ['bgsound', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc'])
     {
         if ($attribs) {
@@ -220,31 +274,33 @@ class Sanitize implements RegistryAware
                 $this->strip_attributes = explode(',', $attribs);
             }
         } else {
-            $this->strip_attributes = false;
+            $this->strip_attributes = [];
         }
     }

-    public function add_attributes($attribs = ['audio' => ['preload' => 'none'], 'iframe' => ['sandbox' => 'allow-scripts allow-same-origin'], 'video' => ['preload' => 'none']])
+    /**
+     * @param array<string, array<string, string>> $attribs
+     * @return void
+     */
+    public function add_attributes(array $attribs = ['audio' => ['preload' => 'none'], 'iframe' => ['sandbox' => 'allow-scripts allow-same-origin'], 'video' => ['preload' => 'none']])
     {
-        if ($attribs) {
-            if (is_array($attribs)) {
-                $this->add_attributes = $attribs;
-            } else {
-                $this->add_attributes = explode(',', $attribs);
-            }
-        } else {
-            $this->add_attributes = false;
-        }
+        $this->add_attributes = $attribs;
     }

-    public function strip_comments($strip = false)
+    /**
+     * @return void
+     */
+    public function strip_comments(bool $strip = false)
     {
-        $this->strip_comments = (bool) $strip;
+        $this->strip_comments = $strip;
     }

-    public function set_output_encoding($encoding = 'UTF-8')
+    /**
+     * @return void
+     */
+    public function set_output_encoding(string $encoding = 'UTF-8')
     {
-        $this->output_encoding = (string) $encoding;
+        $this->output_encoding = $encoding;
     }

     /**
@@ -256,9 +312,10 @@ class Sanitize implements RegistryAware
      * |ins|@cite, |q|@cite, |source|@src, |video|@src
      *
      * @since 1.0
-     * @param array|null $element_attribute Element/attribute key/value pairs, null for default
+     * @param array<string, string|string[]>|null $element_attribute Element/attribute key/value pairs, null for default
+     * @return void
      */
-    public function set_url_replacements($element_attribute = null)
+    public function set_url_replacements(?array $element_attribute = null)
     {
         if ($element_attribute === null) {
             $element_attribute = [
@@ -282,20 +339,25 @@ class Sanitize implements RegistryAware
                 ]
             ];
         }
-        $this->replace_url_attributes = (array) $element_attribute;
+        $this->replace_url_attributes = $element_attribute;
     }

     /**
      * Set the list of domains for which to force HTTPS.
      * @see \SimplePie\Misc::https_url()
      * Example array('biz', 'example.com', 'example.org', 'www.example.net');
+     *
+     * @param string[] $domains list of domain names ['biz', 'example.com', 'example.org', 'www.example.net']
+     *
+     * @return void
      */
-    public function set_https_domains($domains)
+    public function set_https_domains(array $domains)
     {
         $this->https_domains = [];
         foreach ($domains as $domain) {
             $domain = trim($domain, ". \t\n\r\0\x0B");
             $segments = array_reverse(explode('.', $domain));
+            /** @var true|array<string, true|array<string, true|array<string, array<string, true|array<string, true|array<string, true>>>>>> */ // Needed for PHPStan.
             $node = &$this->https_domains;
             foreach ($segments as $segment) {//Build a tree
                 if ($node === true) {
@@ -312,8 +374,10 @@ class Sanitize implements RegistryAware

     /**
      * Check if the domain is in the list of forced HTTPS.
+     *
+     * @return bool
      */
-    protected function is_https_domain($domain)
+    protected function is_https_domain(string $domain)
     {
         $domain = trim($domain, '. ');
         $segments = array_reverse(explode('.', $domain));
@@ -330,16 +394,26 @@ class Sanitize implements RegistryAware

     /**
      * Force HTTPS for selected Web sites.
+     *
+     * @return string
      */
-    public function https_url($url)
+    public function https_url(string $url)
     {
-        return (strtolower(substr($url, 0, 7)) === 'http://') &&
-            $this->is_https_domain(parse_url($url, PHP_URL_HOST)) ?
-            substr_replace($url, 's', 4, 0) : //Add the 's' to HTTPS
-            $url;
+        return (
+            strtolower(substr($url, 0, 7)) === 'http://'
+            && ($parsed = parse_url($url, PHP_URL_HOST)) !== false // Malformed URL
+            && $parsed !== null // Missing host
+            && $this->is_https_domain($parsed) // Should be forced?
+        ) ? substr_replace($url, 's', 4, 0) // Add the 's' to HTTPS
+        : $url;
     }

-    public function sanitize($data, $type, $base = '')
+    /**
+     * @param int-mask-of<SimplePie::CONSTRUCT_*> $type
+     * @param string $base
+     * @return string Sanitized data; false if output encoding is changed to something other than UTF-8 and conversion fails
+     */
+    public function sanitize(string $data, int $type, string $base = '')
     {
         $data = trim($data);
         if ($data !== '' || $type & \SimplePie\SimplePie::CONSTRUCT_IRI) {
@@ -362,9 +436,13 @@ class Sanitize implements RegistryAware
                 $document = new \DOMDocument();
                 $document->encoding = 'UTF-8';

+                // PHPStan seems to have trouble resolving int-mask because bitwise
+                // operators are used when operators are used when passing this parameter.
+                // https://github.com/phpstan/phpstan/issues/9384
+                /** @var int-mask-of<SimplePie::CONSTRUCT_*> $type */
                 $data = $this->preprocess($data, $type);

-                set_error_handler(['SimplePie\Misc', 'silence_errors']);
+                set_error_handler([Misc::class, 'silence_errors']);
                 $document->loadHTML($data);
                 restore_error_handler();

@@ -372,16 +450,19 @@ class Sanitize implements RegistryAware

                 // Strip comments
                 if ($this->strip_comments) {
+                    /** @var \DOMNodeList<\DOMComment> */
                     $comments = $xpath->query('//comment()');

                     foreach ($comments as $comment) {
-                        $comment->parentNode->removeChild($comment);
+                        $parentNode = $comment->parentNode;
+                        assert($parentNode !== null, 'For PHPStan, comment must have a parent');
+                        $parentNode->removeChild($comment);
                     }
                 }

                 // Strip out HTML tags and attributes that might cause various security problems.
                 // Based on recommendations by Mark Pilgrim at:
-                // http://diveintomark.org/archives/2003/06/12/how_to_consume_rss_safely
+                // https://web.archive.org/web/20110902041826/http://diveintomark.org:80/archives/2003/06/12/how_to_consume_rss_safely
                 if ($this->strip_htmltags) {
                     foreach ($this->strip_htmltags as $tag) {
                         $this->strip_tag($tag, $document, $xpath, $type);
@@ -413,7 +494,7 @@ class Sanitize implements RegistryAware
                 }

                 // If image handling (caching, etc.) is enabled, cache and rewrite all the image tags.
-                if (isset($this->image_handler) && ((string) $this->image_handler) !== '' && $this->enable_cache) {
+                if ($this->image_handler !== '' && $this->enable_cache) {
                     $images = $document->getElementsByTagName('img');

                     foreach ($images as $img) {
@@ -424,11 +505,18 @@ class Sanitize implements RegistryAware
                             if ($cache->get_data($image_url, false)) {
                                 $img->setAttribute('src', $this->image_handler . $image_url);
                             } else {
-                                $file = $this->registry->create(File::class, [$img->getAttribute('src'), $this->timeout, 5, ['X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']], $this->useragent, $this->force_fsockopen]);
-                                $headers = $file->headers;
+                                try {
+                                    $file = $this->get_http_client()->request(
+                                        Client::METHOD_GET,
+                                        $img->getAttribute('src'),
+                                        ['X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']]
+                                    );
+                                } catch (ClientException $th) {
+                                    continue;
+                                }

-                                if ($file->success && ($file->method & \SimplePie\SimplePie::FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300))) {
-                                    if ($cache->set_data($image_url, ['headers' => $file->headers, 'body' => $file->body], $this->cache_duration)) {
+                                if ((!Misc::is_remote_uri($file->get_final_requested_uri()) || ($file->get_status_code() === 200 || $file->get_status_code() > 206 && $file->get_status_code() < 300))) {
+                                    if ($cache->set_data($image_url, ['headers' => $file->get_headers(), 'body' => $file->get_body_content()], $this->cache_duration)) {
                                         $img->setAttribute('src', $this->image_handler . $image_url);
                                     } else {
                                         trigger_error("$this->cache_location is not writable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING);
@@ -440,18 +528,23 @@ class Sanitize implements RegistryAware
                 }

                 // Get content node
-                $div = $document->getElementsByTagName('body')->item(0)->firstChild;
+                $div = null;
+                if (($item = $document->getElementsByTagName('body')->item(0)) !== null) {
+                    $div = $item->firstChild;
+                }
                 // Finally, convert to a HTML string
-                $data = trim($document->saveHTML($div));
+                $data = trim((string) $document->saveHTML($div));

                 if ($this->remove_div) {
                     $data = preg_replace('/^<div' . \SimplePie\SimplePie::PCRE_XML_ATTRIBUTE . '>/', '', $data);
-                    $data = preg_replace('/<\/div>$/', '', $data);
+                    // Cast for PHPStan, it is unable to validate a non-literal regex above.
+                    $data = preg_replace('/<\/div>$/', '', (string) $data);
                 } else {
                     $data = preg_replace('/^<div' . \SimplePie\SimplePie::PCRE_XML_ATTRIBUTE . '>/', '<div>', $data);
                 }

-                $data = str_replace('</source>', '', $data);
+                // Cast for PHPStan, it is unable to validate a non-literal regex above.
+                $data = str_replace('</source>', '', (string) $data);
             }

             if ($type & \SimplePie\SimplePie::CONSTRUCT_IRI) {
@@ -466,13 +559,19 @@ class Sanitize implements RegistryAware
             }

             if ($this->output_encoding !== 'UTF-8') {
+                // This really returns string|false but changing encoding is uncommon and we are going to deprecate it, so let’s just lie to PHPStan in the interest of cleaner annotations.
+                /** @var string */
                 $data = $this->registry->call(Misc::class, 'change_encoding', [$data, 'UTF-8', $this->output_encoding]);
             }
         }
         return $data;
     }

-    protected function preprocess($html, $type)
+    /**
+     * @param int-mask-of<SimplePie::CONSTRUCT_*> $type
+     * @return string
+     */
+    protected function preprocess(string $html, int $type)
     {
         $ret = '';
         $html = preg_replace('%</?(?:html|body)[^>]*?'.'>%is', '', $html);
@@ -493,7 +592,11 @@ class Sanitize implements RegistryAware
         return $ret;
     }

-    public function replace_urls($document, $tag, $attributes)
+    /**
+     * @param array<string>|string $attributes
+     * @return void
+     */
+    public function replace_urls(DOMDocument $document, string $tag, $attributes)
     {
         if (!is_array($attributes)) {
             $attributes = [$attributes];
@@ -515,7 +618,11 @@ class Sanitize implements RegistryAware
         }
     }

-    public function do_strip_htmltags($match)
+    /**
+     * @param array<int, string> $match
+     * @return string
+     */
+    public function do_strip_htmltags(array $match)
     {
         if ($this->encode_instead_of_strip) {
             if (isset($match[4]) && !in_array(strtolower($match[1]), ['script', 'style'])) {
@@ -532,9 +639,21 @@ class Sanitize implements RegistryAware
         }
     }

-    protected function strip_tag($tag, $document, $xpath, $type)
+    /**
+     * @param int-mask-of<SimplePie::CONSTRUCT_*> $type
+     * @return void
+     */
+    protected function strip_tag(string $tag, DOMDocument $document, DOMXPath $xpath, int $type)
     {
         $elements = $xpath->query('body//' . $tag);
+
+        if ($elements === false) {
+            throw new \SimplePie\Exception(sprintf(
+                '%s(): Possibly malformed expression, check argument #1 ($tag)',
+                __METHOD__
+            ), 1);
+        }
+
         if ($this->encode_instead_of_strip) {
             foreach ($elements as $element) {
                 $fragment = $document->createDocumentFragment();
@@ -542,7 +661,7 @@ class Sanitize implements RegistryAware
                 // For elements which aren't script or style, include the tag itself
                 if (!in_array($tag, ['script', 'style'])) {
                     $text = '<' . $tag;
-                    if ($element->hasAttributes()) {
+                    if ($element->attributes !== null) {
                         $attrs = [];
                         foreach ($element->attributes as $name => $attr) {
                             $value = $attr->value;
@@ -568,21 +687,26 @@ class Sanitize implements RegistryAware

                 $number = $element->childNodes->length;
                 for ($i = $number; $i > 0; $i--) {
-                    $child = $element->childNodes->item(0);
-                    $fragment->appendChild($child);
+                    if (($child = $element->childNodes->item(0)) !== null) {
+                        $fragment->appendChild($child);
+                    }
                 }

                 if (!in_array($tag, ['script', 'style'])) {
                     $fragment->appendChild(new \DOMText('</' . $tag . '>'));
                 }

-                $element->parentNode->replaceChild($fragment, $element);
+                if (($parentNode = $element->parentNode) !== null) {
+                    $parentNode->replaceChild($fragment, $element);
+                }
             }

             return;
         } elseif (in_array($tag, ['script', 'style'])) {
             foreach ($elements as $element) {
-                $element->parentNode->removeChild($element);
+                if (($parentNode = $element->parentNode) !== null) {
+                    $parentNode->removeChild($element);
+                }
             }

             return;
@@ -591,37 +715,67 @@ class Sanitize implements RegistryAware
                 $fragment = $document->createDocumentFragment();
                 $number = $element->childNodes->length;
                 for ($i = $number; $i > 0; $i--) {
-                    $child = $element->childNodes->item(0);
-                    $fragment->appendChild($child);
+                    if (($child = $element->childNodes->item(0)) !== null) {
+                        $fragment->appendChild($child);
+                    }
                 }

-                $element->parentNode->replaceChild($fragment, $element);
+                if (($parentNode = $element->parentNode) !== null) {
+                    $parentNode->replaceChild($fragment, $element);
+                }
             }
         }
     }

-    protected function strip_attr($attrib, $xpath)
+    /**
+     * @return void
+     */
+    protected function strip_attr(string $attrib, DOMXPath $xpath)
     {
         $elements = $xpath->query('//*[@' . $attrib . ']');

+        if ($elements === false) {
+            throw new \SimplePie\Exception(sprintf(
+                '%s(): Possibly malformed expression, check argument #1 ($attrib)',
+                __METHOD__
+            ), 1);
+        }
+
+        /** @var \DOMElement $element */
         foreach ($elements as $element) {
             $element->removeAttribute($attrib);
         }
     }

-    protected function rename_attr($attrib, $xpath)
+    /**
+     * @return void
+     */
+    protected function rename_attr(string $attrib, DOMXPath $xpath)
     {
         $elements = $xpath->query('//*[@' . $attrib . ']');

+        if ($elements === false) {
+            throw new \SimplePie\Exception(sprintf(
+                '%s(): Possibly malformed expression, check argument #1 ($attrib)',
+                __METHOD__
+            ), 1);
+        }
+
+        /** @var \DOMElement $element */
         foreach ($elements as $element) {
             $element->setAttribute('data-sanitized-' . $attrib, $element->getAttribute($attrib));
             $element->removeAttribute($attrib);
         }
     }

-    protected function add_attr($tag, $valuePairs, $document)
+    /**
+     * @param array<string, string> $valuePairs
+     * @return void
+     */
+    protected function add_attr(string $tag, array $valuePairs, DOMDocument $document)
     {
         $elements = $document->getElementsByTagName($tag);
+        /** @var \DOMElement $element */
         foreach ($elements as $element) {
             foreach ($valuePairs as $attrib => $value) {
                 $element->setAttribute($attrib, $value);
@@ -636,7 +790,7 @@ class Sanitize implements RegistryAware
      *
      * @return DataCache
      */
-    private function get_cache($image_url = '')
+    private function get_cache(string $image_url = ''): DataCache
     {
         if ($this->cache === null) {
             // @trigger_error(sprintf('Not providing as PSR-16 cache implementation is deprecated since SimplePie 1.8.0, please use "SimplePie\SimplePie::set_cache()".'), \E_USER_DEPRECATED);
@@ -651,6 +805,27 @@ class Sanitize implements RegistryAware

         return $this->cache;
     }
+
+    /**
+     * Get a HTTP client
+     */
+    private function get_http_client(): Client
+    {
+        if ($this->http_client === null) {
+            $this->http_client = new FileClient(
+                $this->registry,
+                [
+                    'timeout' => $this->timeout,
+                    'redirects' => 5,
+                    'useragent' => $this->useragent,
+                    'force_fsockopen' => $this->force_fsockopen,
+                    'curl_options' => $this->curl_options,
+                ]
+            );
+        }
+
+        return $this->http_client;
+    }
 }

 class_alias('SimplePie\Sanitize', 'SimplePie_Sanitize');
diff --git a/wp-includes/SimplePie/src/SimplePie.php b/wp-includes/SimplePie/src/SimplePie.php
index e5fd32d382..25049b0f12 100644
--- a/wp-includes/SimplePie/src/SimplePie.php
+++ b/wp-includes/SimplePie/src/SimplePie.php
@@ -1,50 +1,16 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie;

 use InvalidArgumentException;
+use Psr\Http\Client\ClientInterface;
+use Psr\Http\Message\RequestFactoryInterface;
+use Psr\Http\Message\UriFactoryInterface;
 use Psr\SimpleCache\CacheInterface;
 use SimplePie\Cache\Base;
 use SimplePie\Cache\BaseDataCache;
@@ -53,12 +19,15 @@ use SimplePie\Cache\DataCache;
 use SimplePie\Cache\NameFilter;
 use SimplePie\Cache\Psr16;
 use SimplePie\Content\Type\Sniffer;
+use SimplePie\Exception as SimplePieException;
+use SimplePie\HTTP\Client;
+use SimplePie\HTTP\ClientException;
+use SimplePie\HTTP\FileClient;
+use SimplePie\HTTP\Psr18Client;
+use SimplePie\HTTP\Response;

 /**
  * SimplePie
- *
- * @package SimplePie
- * @subpackage API
  */
 class SimplePie
 {
@@ -70,7 +39,7 @@ class SimplePie
     /**
      * SimplePie Version
      */
-    public const VERSION = '1.8.1';
+    public const VERSION = '1.9.0';

     /**
      * SimplePie Website URL
@@ -411,16 +380,21 @@ class SimplePie
     public const FILE_SOURCE_FILE_GET_CONTENTS = 16;

     /**
-     * @var array Raw data
+     * @internal Default value of the HTTP Accept header when fetching/locating feeds
+     */
+    public const DEFAULT_HTTP_ACCEPT_HEADER = 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1';
+
+    /**
+     * @var array<string, mixed> Raw data
      * @access private
      */
     public $data = [];

     /**
-     * @var mixed Error string
+     * @var string|string[]|null Error string (or array when multiple feeds are initialized)
      * @access private
      */
-    public $error;
+    public $error = null;

     /**
      * @var int HTTP status code
@@ -430,7 +404,7 @@ class SimplePie
     public $status_code = 0;

     /**
-     * @var object Instance of \SimplePie\Sanitize (or other class)
+     * @var Sanitize instance of Sanitize class
      * @see SimplePie::set_sanitize_class()
      * @access private
      */
@@ -451,21 +425,20 @@ class SimplePie
     public $feed_url;

     /**
-     * @var string Original feed URL, or new feed URL iff HTTP 301 Moved Permanently
+     * @var ?string Original feed URL, or new feed URL iff HTTP 301 Moved Permanently
      * @see SimplePie::subscribe_url()
      * @access private
      */
     public $permanent_url = null;

     /**
-     * @var object Instance of \SimplePie\File to use as a feed
+     * @var File Instance of File class to use as a feed
      * @see SimplePie::set_file()
-     * @access private
      */
-    public $file;
+    private $file;

     /**
-     * @var string Raw feed data
+     * @var string|false Raw feed data
      * @see SimplePie::set_raw_data()
      * @access private
      */
@@ -479,7 +452,7 @@ class SimplePie
     public $timeout = 10;

     /**
-     * @var array Custom curl options
+     * @var array<int, mixed> Custom curl options
      * @see SimplePie::set_curl_options()
      * @access private
      */
@@ -550,7 +523,7 @@ class SimplePie
     public $cache_location = './cache';

     /**
-     * @var string Function that creates the cache filename
+     * @var string&(callable(string): string) Function that creates the cache filename
      * @see SimplePie::set_cache_name_function()
      * @access private
      */
@@ -572,7 +545,7 @@ class SimplePie
     public $input_encoding = false;

     /**
-     * @var int Feed Autodiscovery Level
+     * @var self::LOCATOR_* Feed Autodiscovery Level
      * @see SimplePie::set_autodiscovery_level()
      * @access private
      */
@@ -581,7 +554,7 @@ class SimplePie
     /**
      * Class registry object
      *
-     * @var \SimplePie\Registry
+     * @var Registry
      */
     public $registry;

@@ -593,7 +566,7 @@ class SimplePie
     public $max_checked_feeds = 10;

     /**
-     * @var array All the feeds found during the autodiscovery process
+     * @var array<Response>|null All the feeds found during the autodiscovery process
      * @see SimplePie::get_all_discovered_feeds()
      * @access private
      */
@@ -607,27 +580,27 @@ class SimplePie
     public $image_handler = '';

     /**
-     * @var array Stores the URLs when multiple feeds are being initialized.
+     * @var array<string> Stores the URLs when multiple feeds are being initialized.
      * @see SimplePie::set_feed_url()
      * @access private
      */
     public $multifeed_url = [];

     /**
-     * @var array Stores SimplePie objects when multiple feeds initialized.
+     * @var array<int, static> Stores SimplePie objects when multiple feeds initialized.
      * @access private
      */
     public $multifeed_objects = [];

     /**
-     * @var array Stores the get_object_vars() array for use with multifeeds.
+     * @var array<mixed> Stores the get_object_vars() array for use with multifeeds.
      * @see SimplePie::set_feed_url()
      * @access private
      */
     public $config_settings = null;

     /**
-     * @var integer Stores the number of items to return per-feed with multifeeds.
+     * @var int Stores the number of items to return per-feed with multifeeds.
      * @see SimplePie::set_item_limit()
      * @access private
      */
@@ -640,28 +613,28 @@ class SimplePie
     public $check_modified = false;

     /**
-     * @var array Stores the default attributes to be stripped by strip_attributes().
+     * @var array<string> Stores the default attributes to be stripped by strip_attributes().
      * @see SimplePie::strip_attributes()
      * @access private
      */
     public $strip_attributes = ['bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc'];

     /**
-     * @var array Stores the default attributes to add to different tags by add_attributes().
+     * @var array<string, array<string, string>> Stores the default attributes to add to different tags by add_attributes().
      * @see SimplePie::add_attributes()
      * @access private
      */
     public $add_attributes = ['audio' => ['preload' => 'none'], 'iframe' => ['sandbox' => 'allow-scripts allow-same-origin'], 'video' => ['preload' => 'none']];

     /**
-     * @var array Stores the default tags to be stripped by strip_htmltags().
+     * @var array<string> Stores the default tags to be stripped by strip_htmltags().
      * @see SimplePie::strip_htmltags()
      * @access private
      */
     public $strip_htmltags = ['base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style'];

     /**
-     * @var array Stores the default attributes to be renamed by rename_attributes().
+     * @var string[]|string Stores the default attributes to be renamed by rename_attributes().
      * @see SimplePie::rename_attributes()
      * @access private
      */
@@ -673,6 +646,14 @@ class SimplePie
      */
     public $enable_exceptions = false;

+    /**
+     * @var Client|null
+     */
+    private $http_client = null;
+
+    /** @var bool Whether HTTP client has been injected */
+    private $http_client_injected = false;
+
     /**
      * The SimplePie class contains feed level data and options
      *
@@ -698,8 +679,8 @@ class SimplePie
         $this->set_cache_namefilter(new CallableNameFilter($this->cache_name_function));

         // Other objects, instances created here so we can set options on them
-        $this->sanitize = new \SimplePie\Sanitize();
-        $this->registry = new \SimplePie\Registry();
+        $this->sanitize = new Sanitize();
+        $this->registry = new Registry();

         if (func_num_args() > 0) {
             trigger_error('Passing parameters to the constructor is no longer supported. Please use set_feed_url(), set_cache_location(), and set_cache_duration() directly.', \E_USER_DEPRECATED);
@@ -721,6 +702,7 @@ class SimplePie

     /**
      * Used for converting object to a string
+     * @return string
      */
     public function __toString()
     {
@@ -729,6 +711,7 @@ class SimplePie

     /**
      * Remove items that link back to this before destroying this object
+     * @return void
      */
     public function __destruct()
     {
@@ -756,10 +739,11 @@ class SimplePie
      *
      * @since 1.1
      * @param bool $enable Force the given data/URL to be treated as a feed
+     * @return void
      */
-    public function force_feed($enable = false)
+    public function force_feed(bool $enable = false)
     {
-        $this->force_feed = (bool) $enable;
+        $this->force_feed = $enable;
     }

     /**
@@ -769,18 +753,20 @@ class SimplePie
      * website you want to try to use auto-discovery on. This takes priority
      * over any set raw data.
      *
-     * You can set multiple feeds to mash together by passing an array instead
+     * Deprecated since 1.9.0: You can set multiple feeds to mash together by passing an array instead
      * of a string for the $url. Remember that with each additional feed comes
      * additional processing and resources.
      *
      * @since 1.0 Preview Release
      * @see set_raw_data()
-     * @param string|array $url This is the URL (or array of URLs) that you want to parse.
+     * @param string|string[] $url This is the URL (or (deprecated) array of URLs) that you want to parse.
+     * @return void
      */
     public function set_feed_url($url)
     {
         $this->multifeed_url = [];
         if (is_array($url)) {
+            trigger_error('Fetching multiple feeds with single SimplePie instance is deprecated since SimplePie 1.9.0, create one SimplePie instance per feed and use SimplePie::merge_items to get a single list of items.', \E_USER_DEPRECATED);
             foreach ($url as $value) {
                 $this->multifeed_url[] = $this->registry->call(Misc::class, 'fix_protocol', [$value, 1]);
             }
@@ -791,20 +777,22 @@ class SimplePie
     }

     /**
-     * Set an instance of {@see \SimplePie\File} to use as a feed
+     * Set an instance of {@see File} to use as a feed
+     *
+     * @deprecated since SimplePie 1.9.0, use \SimplePie\SimplePie::set_http_client() or \SimplePie\SimplePie::set_raw_data() instead.
      *
-     * @param \SimplePie\File &$file
+     * @param File &$file
      * @return bool True on success, false on failure
      */
-    public function set_file(&$file)
+    public function set_file(File &$file)
     {
-        if ($file instanceof \SimplePie\File) {
-            $this->feed_url = $file->url;
-            $this->permanent_url = $this->feed_url;
-            $this->file = &$file;
-            return true;
-        }
-        return false;
+        // trigger_error(sprintf('SimplePie\SimplePie::set_file() is deprecated since SimplePie 1.9.0, please use "SimplePie\SimplePie::set_http_client()" or "SimplePie\SimplePie::set_raw_data()" instead.'), \E_USER_DEPRECATED);
+
+        $this->feed_url = $file->get_final_requested_uri();
+        $this->permanent_url = $this->feed_url;
+        $this->file = &$file;
+
+        return true;
     }

     /**
@@ -819,12 +807,27 @@ class SimplePie
      * @since 1.0 Beta 3
      * @param string $data RSS or Atom data as a string.
      * @see set_feed_url()
+     * @return void
      */
-    public function set_raw_data($data)
+    public function set_raw_data(string $data)
     {
         $this->raw_data = $data;
     }

+    /**
+     * Set a PSR-18 client and PSR-17 factories
+     *
+     * Allows you to use your own HTTP client implementations.
+     * This will become required with SimplePie 2.0.0.
+     */
+    final public function set_http_client(
+        ClientInterface $http_client,
+        RequestFactoryInterface $request_factory,
+        UriFactoryInterface $uri_factory
+    ): void {
+        $this->http_client = new Psr18Client($http_client, $request_factory, $uri_factory);
+    }
+
     /**
      * Set the default timeout for fetching remote feeds
      *
@@ -833,10 +836,32 @@ class SimplePie
      *
      * @since 1.0 Beta 3
      * @param int $timeout The maximum number of seconds to spend waiting to retrieve a feed.
+     * @return void
      */
-    public function set_timeout($timeout = 10)
+    public function set_timeout(int $timeout = 10)
     {
+        if ($this->http_client_injected) {
+            throw new SimplePieException(sprintf(
+                'Using "%s()" has no effect, because you already provided a HTTP client with "%s::set_http_client()". Configure timeout in your HTTP client instead.',
+                __METHOD__,
+                self::class
+            ));
+        }
+
         $this->timeout = (int) $timeout;
+
+        // Reset a possible existing FileClient,
+        // so a new client with the changed value will be created
+        if (is_object($this->http_client) && $this->http_client instanceof FileClient) {
+            $this->http_client = null;
+        } elseif (is_object($this->http_client)) {
+            // Trigger notice if a PSR-18 client was set
+            trigger_error(sprintf(
+                'Using "%s()" has no effect, because you already provided a HTTP client with "%s::set_http_client()". Configure the timeout in your HTTP client instead.',
+                __METHOD__,
+                get_class($this)
+            ), \E_USER_NOTICE);
+        }
     }

     /**
@@ -845,11 +870,33 @@ class SimplePie
      * This allows you to change default curl options
      *
      * @since 1.0 Beta 3
-     * @param array $curl_options Curl options to add to default settings
+     * @param array<int, mixed> $curl_options Curl options to add to default settings
+     * @return void
      */
     public function set_curl_options(array $curl_options = [])
     {
+        if ($this->http_client_injected) {
+            throw new SimplePieException(sprintf(
+                'Using "%s()" has no effect, because you already provided a HTTP client with "%s::set_http_client()". Configure custom curl options in your HTTP client instead.',
+                __METHOD__,
+                self::class
+            ));
+        }
+
         $this->curl_options = $curl_options;
+
+        // Reset a possible existing FileClient,
+        // so a new client with the changed value will be created
+        if (is_object($this->http_client) && $this->http_client instanceof FileClient) {
+            $this->http_client = null;
+        } elseif (is_object($this->http_client)) {
+            // Trigger notice if a PSR-18 client was set
+            trigger_error(sprintf(
+                'Using "%s()" has no effect, because you already provided a HTTP client with "%s::set_http_client()". Configure the curl options in your HTTP client instead.',
+                __METHOD__,
+                get_class($this)
+            ), \E_USER_NOTICE);
+        }
     }

     /**
@@ -857,10 +904,32 @@ class SimplePie
      *
      * @since 1.0 Beta 3
      * @param bool $enable Force fsockopen() to be used
+     * @return void
      */
-    public function force_fsockopen($enable = false)
+    public function force_fsockopen(bool $enable = false)
     {
-        $this->force_fsockopen = (bool) $enable;
+        if ($this->http_client_injected) {
+            throw new SimplePieException(sprintf(
+                'Using "%s()" has no effect, because you already provided a HTTP client with "%s::set_http_client()". Configure fsockopen in your HTTP client instead.',
+                __METHOD__,
+                self::class
+            ));
+        }
+
+        $this->force_fsockopen = $enable;
+
+        // Reset a possible existing FileClient,
+        // so a new client with the changed value will be created
+        if (is_object($this->http_client) && $this->http_client instanceof FileClient) {
+            $this->http_client = null;
+        } elseif (is_object($this->http_client)) {
+            // Trigger notice if a PSR-18 client was set
+            trigger_error(sprintf(
+                'Using "%s()" has no effect, because you already provided a HTTP client with "%s::set_http_client()". Configure fsockopen in your HTTP client instead.',
+                __METHOD__,
+                get_class($this)
+            ), \E_USER_NOTICE);
+        }
     }

     /**
@@ -871,16 +940,17 @@ class SimplePie
      *
      * @since 1.0 Preview Release
      * @param bool $enable Enable caching
+     * @return void
      */
-    public function enable_cache($enable = true)
+    public function enable_cache(bool $enable = true)
     {
-        $this->enable_cache = (bool) $enable;
+        $this->enable_cache = $enable;
     }

     /**
      * Set a PSR-16 implementation as cache
      *
-     * @param CacheInterface $psr16cache The PSR-16 cache implementation
+     * @param CacheInterface $cache The PSR-16 cache implementation
      *
      * @return void
      */
@@ -900,11 +970,12 @@ class SimplePie
      * @deprecated since SimplePie 1.8.0, expired cache will not be used anymore.
      *
      * @param bool $enable Force use of cache on fail.
+     * @return void
      */
-    public function force_cache_fallback($enable = false)
+    public function force_cache_fallback(bool $enable = false)
     {
         // @trigger_error(sprintf('SimplePie\SimplePie::force_cache_fallback() is deprecated since SimplePie 1.8.0, expired cache will not be used anymore.'), \E_USER_DEPRECATED);
-        $this->force_cache_fallback = (bool) $enable;
+        $this->force_cache_fallback = $enable;
     }

     /**
@@ -912,10 +983,11 @@ class SimplePie
      * cached
      *
      * @param int $seconds The feed content cache duration
+     * @return void
      */
-    public function set_cache_duration($seconds = 3600)
+    public function set_cache_duration(int $seconds = 3600)
     {
-        $this->cache_duration = (int) $seconds;
+        $this->cache_duration = $seconds;
     }

     /**
@@ -923,23 +995,25 @@ class SimplePie
      * be cached
      *
      * @param int $seconds The autodiscovered feed URL cache duration.
+     * @return void
      */
-    public function set_autodiscovery_cache_duration($seconds = 604800)
+    public function set_autodiscovery_cache_duration(int $seconds = 604800)
     {
-        $this->autodiscovery_cache_duration = (int) $seconds;
+        $this->autodiscovery_cache_duration = $seconds;
     }

     /**
      * Set the file system location where the cached files should be stored
      *
-     * @deprecated since SimplePie 1.8.0, use \SimplePie\SimplePie::set_cache() instead.
+     * @deprecated since SimplePie 1.8.0, use SimplePie::set_cache() instead.
      *
      * @param string $location The file system location.
+     * @return void
      */
-    public function set_cache_location($location = './cache')
+    public function set_cache_location(string $location = './cache')
     {
         // @trigger_error(sprintf('SimplePie\SimplePie::set_cache_location() is deprecated since SimplePie 1.8.0, please use "SimplePie\SimplePie::set_cache()" instead.'), \E_USER_DEPRECATED);
-        $this->cache_location = (string) $location;
+        $this->cache_location = $location;
     }

     /**
@@ -948,7 +1022,7 @@ class SimplePie
      * @param string $url The URL of the feed to be cached.
      * @return string A filename (i.e. hash, without path and without extension).
      */
-    public function get_cache_filename($url)
+    public function get_cache_filename(string $url)
     {
         // Append custom parameters to the URL to avoid cache pollution in case of multiple calls with different parameters.
         $url .= $this->force_feed ? '#force_feed' : '';
@@ -956,7 +1030,7 @@ class SimplePie
         if ($this->timeout != 10) {
             $options[CURLOPT_TIMEOUT] = $this->timeout;
         }
-        if ($this->useragent !== \SimplePie\Misc::get_default_useragent()) {
+        if ($this->useragent !== Misc::get_default_useragent()) {
             $options[CURLOPT_USERAGENT] = $this->useragent;
         }
         if (!empty($this->curl_options)) {
@@ -976,10 +1050,11 @@ class SimplePie
      * Set whether feed items should be sorted into reverse chronological order
      *
      * @param bool $enable Sort as reverse chronological order.
+     * @return void
      */
-    public function enable_order_by_date($enable = true)
+    public function enable_order_by_date(bool $enable = true)
     {
-        $this->order_by_date = (bool) $enable;
+        $this->order_by_date = $enable;
     }

     /**
@@ -988,7 +1063,8 @@ class SimplePie
      * This overrides the encoding reported by the feed, however it will fall
      * back to the normal encoding detection if the override fails
      *
-     * @param string $encoding Character encoding
+     * @param string|false $encoding Character encoding
+     * @return void
      */
     public function set_input_encoding($encoding = false)
     {
@@ -1002,25 +1078,25 @@ class SimplePie
     /**
      * Set how much feed autodiscovery to do
      *
-     * @see \SimplePie\SimplePie::LOCATOR_NONE
-     * @see \SimplePie\SimplePie::LOCATOR_AUTODISCOVERY
-     * @see \SimplePie\SimplePie::LOCATOR_LOCAL_EXTENSION
-     * @see \SimplePie\SimplePie::LOCATOR_LOCAL_BODY
-     * @see \SimplePie\SimplePie::LOCATOR_REMOTE_EXTENSION
-     * @see \SimplePie\SimplePie::LOCATOR_REMOTE_BODY
-     * @see \SimplePie\SimplePie::LOCATOR_ALL
-     * @param int $level Feed Autodiscovery Level (level can be a combination of the above constants, see bitwise OR operator)
+     * @see self::LOCATOR_NONE
+     * @see self::LOCATOR_AUTODISCOVERY
+     * @see self::LOCATOR_LOCAL_EXTENSION
+     * @see self::LOCATOR_LOCAL_BODY
+     * @see self::LOCATOR_REMOTE_EXTENSION
+     * @see self::LOCATOR_REMOTE_BODY
+     * @see self::LOCATOR_ALL
+     * @param self::LOCATOR_* $level Feed Autodiscovery Level (level can be a combination of the above constants, see bitwise OR operator)
+     * @return void
      */
-    public function set_autodiscovery_level($level = self::LOCATOR_ALL)
+    public function set_autodiscovery_level(int $level = self::LOCATOR_ALL)
     {
-        $this->autodiscovery = (int) $level;
+        $this->autodiscovery = $level;
     }

     /**
      * Get the class registry
      *
      * Use this to override SimplePie's default classes
-     * @see \SimplePie\Registry
      *
      * @return Registry
      */
@@ -1034,13 +1110,13 @@ class SimplePie
      *
      * @deprecated since SimplePie 1.3, use {@see set_cache()} instead
      *
-     * @param string $class Name of custom class
+     * @param class-string<Cache> $class Name of custom class
      *
-     * @return boolean True on success, false otherwise
+     * @return bool True on success, false otherwise
      */
-    public function set_cache_class($class = Cache::class)
+    public function set_cache_class(string $class = Cache::class)
     {
-        // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::set_cache()" instead.', __METHOD__), \E_USER_DEPRECATED);
+        trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::set_cache()" instead.', __METHOD__), \E_USER_DEPRECATED);

         return $this->registry->register(Cache::class, $class, true);
     }
@@ -1050,13 +1126,13 @@ class SimplePie
      *
      * @deprecated since SimplePie 1.3, use {@see get_registry()} instead
      *
-     * @param string $class Name of custom class
+     * @param class-string<Locator> $class Name of custom class
      *
-     * @return boolean True on success, false otherwise
+     * @return bool True on success, false otherwise
      */
-    public function set_locator_class($class = Locator::class)
+    public function set_locator_class(string $class = Locator::class)
     {
-        // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
+        trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);

         return $this->registry->register(Locator::class, $class, true);
     }
@@ -1066,13 +1142,13 @@ class SimplePie
      *
      * @deprecated since SimplePie 1.3, use {@see get_registry()} instead
      *
-     * @param string $class Name of custom class
+     * @param class-string<Parser> $class Name of custom class
      *
-     * @return boolean True on success, false otherwise
+     * @return bool True on success, false otherwise
      */
-    public function set_parser_class($class = Parser::class)
+    public function set_parser_class(string $class = Parser::class)
     {
-        // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
+        trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);

         return $this->registry->register(Parser::class, $class, true);
     }
@@ -1082,13 +1158,13 @@ class SimplePie
      *
      * @deprecated since SimplePie 1.3, use {@see get_registry()} instead
      *
-     * @param string $class Name of custom class
+     * @param class-string<File> $class Name of custom class
      *
-     * @return boolean True on success, false otherwise
+     * @return bool True on success, false otherwise
      */
-    public function set_file_class($class = File::class)
+    public function set_file_class(string $class = File::class)
     {
-        // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
+        trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);

         return $this->registry->register(File::class, $class, true);
     }
@@ -1098,13 +1174,13 @@ class SimplePie
      *
      * @deprecated since SimplePie 1.3, use {@see get_registry()} instead
      *
-     * @param string $class Name of custom class
+     * @param class-string<Sanitize> $class Name of custom class
      *
-     * @return boolean True on success, false otherwise
+     * @return bool True on success, false otherwise
      */
-    public function set_sanitize_class($class = Sanitize::class)
+    public function set_sanitize_class(string $class = Sanitize::class)
     {
-        // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
+        trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);

         return $this->registry->register(Sanitize::class, $class, true);
     }
@@ -1114,13 +1190,13 @@ class SimplePie
      *
      * @deprecated since SimplePie 1.3, use {@see get_registry()} instead
      *
-     * @param string $class Name of custom class
+     * @param class-string<Item> $class Name of custom class
      *
-     * @return boolean True on success, false otherwise
+     * @return bool True on success, false otherwise
      */
-    public function set_item_class($class = Item::class)
+    public function set_item_class(string $class = Item::class)
     {
-        // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
+        trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);

         return $this->registry->register(Item::class, $class, true);
     }
@@ -1130,13 +1206,13 @@ class SimplePie
      *
      * @deprecated since SimplePie 1.3, use {@see get_registry()} instead
      *
-     * @param string $class Name of custom class
+     * @param class-string<Author> $class Name of custom class
      *
-     * @return boolean True on success, false otherwise
+     * @return bool True on success, false otherwise
      */
-    public function set_author_class($class = Author::class)
+    public function set_author_class(string $class = Author::class)
     {
-        // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
+        trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);

         return $this->registry->register(Author::class, $class, true);
     }
@@ -1146,13 +1222,13 @@ class SimplePie
      *
      * @deprecated since SimplePie 1.3, use {@see get_registry()} instead
      *
-     * @param string $class Name of custom class
+     * @param class-string<Category> $class Name of custom class
      *
-     * @return boolean True on success, false otherwise
+     * @return bool True on success, false otherwise
      */
-    public function set_category_class($class = Category::class)
+    public function set_category_class(string $class = Category::class)
     {
-        // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
+        trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);

         return $this->registry->register(Category::class, $class, true);
     }
@@ -1162,13 +1238,13 @@ class SimplePie
      *
      * @deprecated since SimplePie 1.3, use {@see get_registry()} instead
      *
-     * @param string $class Name of custom class
+     * @param class-string<Enclosure> $class Name of custom class
      *
-     * @return boolean True on success, false otherwise
+     * @return bool True on success, false otherwise
      */
-    public function set_enclosure_class($class = Enclosure::class)
+    public function set_enclosure_class(string $class = Enclosure::class)
     {
-        // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
+        trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);

         return $this->registry->register(Enclosure::class, $class, true);
     }
@@ -1178,13 +1254,13 @@ class SimplePie
      *
      * @deprecated since SimplePie 1.3, use {@see get_registry()} instead
      *
-     * @param string $class Name of custom class
+     * @param class-string<Caption> $class Name of custom class
      *
-     * @return boolean True on success, false otherwise
+     * @return bool True on success, false otherwise
      */
-    public function set_caption_class($class = Caption::class)
+    public function set_caption_class(string $class = Caption::class)
     {
-        // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
+        trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);

         return $this->registry->register(Caption::class, $class, true);
     }
@@ -1194,13 +1270,13 @@ class SimplePie
      *
      * @deprecated since SimplePie 1.3, use {@see get_registry()} instead
      *
-     * @param string $class Name of custom class
+     * @param class-string<Copyright> $class Name of custom class
      *
-     * @return boolean True on success, false otherwise
+     * @return bool True on success, false otherwise
      */
-    public function set_copyright_class($class = Copyright::class)
+    public function set_copyright_class(string $class = Copyright::class)
     {
-        // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
+        trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);

         return $this->registry->register(Copyright::class, $class, true);
     }
@@ -1210,13 +1286,13 @@ class SimplePie
      *
      * @deprecated since SimplePie 1.3, use {@see get_registry()} instead
      *
-     * @param string $class Name of custom class
+     * @param class-string<Credit> $class Name of custom class
      *
-     * @return boolean True on success, false otherwise
+     * @return bool True on success, false otherwise
      */
-    public function set_credit_class($class = Credit::class)
+    public function set_credit_class(string $class = Credit::class)
     {
-        // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
+        trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);

         return $this->registry->register(Credit::class, $class, true);
     }
@@ -1226,13 +1302,13 @@ class SimplePie
      *
      * @deprecated since SimplePie 1.3, use {@see get_registry()} instead
      *
-     * @param string $class Name of custom class
+     * @param class-string<Rating> $class Name of custom class
      *
-     * @return boolean True on success, false otherwise
+     * @return bool True on success, false otherwise
      */
-    public function set_rating_class($class = Rating::class)
+    public function set_rating_class(string $class = Rating::class)
     {
-        // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
+        trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);

         return $this->registry->register(Rating::class, $class, true);
     }
@@ -1242,13 +1318,13 @@ class SimplePie
      *
      * @deprecated since SimplePie 1.3, use {@see get_registry()} instead
      *
-     * @param string $class Name of custom class
+     * @param class-string<Restriction> $class Name of custom class
      *
-     * @return boolean True on success, false otherwise
+     * @return bool True on success, false otherwise
      */
-    public function set_restriction_class($class = Restriction::class)
+    public function set_restriction_class(string $class = Restriction::class)
     {
-        // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
+        trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);

         return $this->registry->register(Restriction::class, $class, true);
     }
@@ -1258,13 +1334,13 @@ class SimplePie
      *
      * @deprecated since SimplePie 1.3, use {@see get_registry()} instead
      *
-     * @param string $class Name of custom class
+     * @param class-string<Sniffer> $class Name of custom class
      *
-     * @return boolean True on success, false otherwise
+     * @return bool True on success, false otherwise
      */
-    public function set_content_type_sniffer_class($class = Sniffer::class)
+    public function set_content_type_sniffer_class(string $class = Sniffer::class)
     {
-        // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
+        trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);

         return $this->registry->register(Sniffer::class, $class, true);
     }
@@ -1274,13 +1350,13 @@ class SimplePie
      *
      * @deprecated since SimplePie 1.3, use {@see get_registry()} instead
      *
-     * @param string $class Name of custom class
+     * @param class-string<Source> $class Name of custom class
      *
-     * @return boolean True on success, false otherwise
+     * @return bool True on success, false otherwise
      */
-    public function set_source_class($class = Source::class)
+    public function set_source_class(string $class = Source::class)
     {
-        // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
+        trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);

         return $this->registry->register(Source::class, $class, true);
     }
@@ -1289,14 +1365,36 @@ class SimplePie
      * Set the user agent string
      *
      * @param string $ua New user agent string.
+     * @return void
      */
-    public function set_useragent($ua = null)
+    public function set_useragent(?string $ua = null)
     {
+        if ($this->http_client_injected) {
+            throw new SimplePieException(sprintf(
+                'Using "%s()" has no effect, because you already provided a HTTP client with "%s::set_http_client()". Configure user agent string in your HTTP client instead.',
+                __METHOD__,
+                self::class
+            ));
+        }
+
         if ($ua === null) {
-            $ua = \SimplePie\Misc::get_default_useragent();
+            $ua = Misc::get_default_useragent();
         }

         $this->useragent = (string) $ua;
+
+        // Reset a possible existing FileClient,
+        // so a new client with the changed value will be created
+        if (is_object($this->http_client) && $this->http_client instanceof FileClient) {
+            $this->http_client = null;
+        } elseif (is_object($this->http_client)) {
+            // Trigger notice if a PSR-18 client was set
+            trigger_error(sprintf(
+                'Using "%s()" has no effect, because you already provided a HTTP client with "%s::set_http_client()". Configure the useragent in your HTTP client instead.',
+                __METHOD__,
+                get_class($this)
+            ), \E_USER_NOTICE);
+        }
     }

     /**
@@ -1316,17 +1414,20 @@ class SimplePie
      *
      * @deprecated since SimplePie 1.8.0, use {@see set_cache_namefilter()} instead
      *
-     * @param mixed $function Callback function
+     * @param (string&(callable(string): string))|null $function Callback function
+     * @return void
      */
-    public function set_cache_name_function($function = 'md5')
+    public function set_cache_name_function(?string $function = null)
     {
         // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.8.0, please use "SimplePie\SimplePie::set_cache_namefilter()" instead.', __METHOD__), \E_USER_DEPRECATED);

-        if (is_callable($function)) {
-            $this->cache_name_function = $function;
-
-            $this->set_cache_namefilter(new CallableNameFilter($this->cache_name_function));
+        if ($function === null) {
+            $function = 'md5';
         }
+
+        $this->cache_name_function = $function;
+
+        $this->set_cache_namefilter(new CallableNameFilter($this->cache_name_function));
     }

     /**
@@ -1336,16 +1437,17 @@ class SimplePie
      * turns SimplePie into a dumb parser of feeds.
      *
      * @param bool $set Whether to set them or not
+     * @return void
      */
-    public function set_stupidly_fast($set = false)
+    public function set_stupidly_fast(bool $set = false)
     {
         if ($set) {
             $this->enable_order_by_date(false);
             $this->remove_div(false);
             $this->strip_comments(false);
-            $this->strip_htmltags(false);
-            $this->strip_attributes(false);
-            $this->add_attributes(false);
+            $this->strip_htmltags([]);
+            $this->strip_attributes([]);
+            $this->add_attributes([]);
             $this->set_image_handler(false);
             $this->set_https_domains([]);
         }
@@ -1355,18 +1457,26 @@ class SimplePie
      * Set maximum number of feeds to check with autodiscovery
      *
      * @param int $max Maximum number of feeds to check
+     * @return void
      */
-    public function set_max_checked_feeds($max = 10)
+    public function set_max_checked_feeds(int $max = 10)
     {
-        $this->max_checked_feeds = (int) $max;
+        $this->max_checked_feeds = $max;
     }

-    public function remove_div($enable = true)
+    /**
+     * @return void
+     */
+    public function remove_div(bool $enable = true)
     {
         $this->sanitize->remove_div($enable);
     }

-    public function strip_htmltags($tags = '', $encode = null)
+    /**
+     * @param string[]|string|false $tags Set a list of tags to strip, or set empty string to use default tags, or false to strip nothing.
+     * @return void
+     */
+    public function strip_htmltags($tags = '', ?bool $encode = null)
     {
         if ($tags === '') {
             $tags = $this->strip_htmltags;
@@ -1377,11 +1487,18 @@ class SimplePie
         }
     }

-    public function encode_instead_of_strip($enable = true)
+    /**
+     * @return void
+     */
+    public function encode_instead_of_strip(bool $enable = true)
     {
         $this->sanitize->encode_instead_of_strip($enable);
     }

+    /**
+     * @param string[]|string $attribs
+     * @return void
+     */
     public function rename_attributes($attribs = '')
     {
         if ($attribs === '') {
@@ -1390,6 +1507,10 @@ class SimplePie
         $this->sanitize->rename_attributes($attribs);
     }

+    /**
+     * @param string[]|string $attribs
+     * @return void
+     */
     public function strip_attributes($attribs = '')
     {
         if ($attribs === '') {
@@ -1398,6 +1519,10 @@ class SimplePie
         $this->sanitize->strip_attributes($attribs);
     }

+    /**
+     * @param array<string, array<string, string>>|'' $attribs
+     * @return void
+     */
     public function add_attributes($attribs = '')
     {
         if ($attribs === '') {
@@ -1427,13 +1552,17 @@ class SimplePie
      * more information.
      *
      * @param string $encoding
+     * @return void
      */
-    public function set_output_encoding($encoding = 'UTF-8')
+    public function set_output_encoding(string $encoding = 'UTF-8')
     {
         $this->sanitize->set_output_encoding($encoding);
     }

-    public function strip_comments($strip = false)
+    /**
+     * @return void
+     */
+    public function strip_comments(bool $strip = false)
     {
         $this->sanitize->strip_comments($strip);
     }
@@ -1447,32 +1576,33 @@ class SimplePie
      * |q|@cite
      *
      * @since 1.0
-     * @param array|null $element_attribute Element/attribute key/value pairs, null for default
+     * @param array<string, string|string[]>|null $element_attribute Element/attribute key/value pairs, null for default
+     * @return void
      */
-    public function set_url_replacements($element_attribute = null)
+    public function set_url_replacements(?array $element_attribute = null)
     {
         $this->sanitize->set_url_replacements($element_attribute);
     }

     /**
      * Set the list of domains for which to force HTTPS.
-     * @see \SimplePie\Sanitize::set_https_domains()
-     * @param array List of HTTPS domains. Example array('biz', 'example.com', 'example.org', 'www.example.net').
+     * @see Sanitize::set_https_domains()
+     * @param array<string> $domains List of HTTPS domains. Example array('biz', 'example.com', 'example.org', 'www.example.net').
+     * @return void
      */
-    public function set_https_domains($domains = [])
+    public function set_https_domains(array $domains = [])
     {
-        if (is_array($domains)) {
-            $this->sanitize->set_https_domains($domains);
-        }
+        $this->sanitize->set_https_domains($domains);
     }

     /**
      * Set the handler to enable the display of cached images.
      *
-     * @param string $page Web-accessible path to the handler_image.php file.
+     * @param string|false $page Web-accessible path to the handler_image.php file.
      * @param string $qs The query string that the value should be passed to.
+     * @return void
      */
-    public function set_image_handler($page = false, $qs = 'i')
+    public function set_image_handler($page = false, string $qs = 'i')
     {
         if ($page !== false) {
             $this->sanitize->set_image_handler($page . '?' . $qs . '=');
@@ -1484,19 +1614,21 @@ class SimplePie
     /**
      * Set the limit for items returned per-feed with multifeeds
      *
-     * @param integer $limit The maximum number of items to return.
+     * @param int $limit The maximum number of items to return.
+     * @return void
      */
-    public function set_item_limit($limit = 0)
+    public function set_item_limit(int $limit = 0)
     {
-        $this->item_limit = (int) $limit;
+        $this->item_limit = $limit;
     }

     /**
      * Enable throwing exceptions
      *
-     * @param boolean $enable Should we throw exceptions, or use the old-style error property?
+     * @param bool $enable Should we throw exceptions, or use the old-style error property?
+     * @return void
      */
-    public function enable_exceptions($enable = true)
+    public function enable_exceptions(bool $enable = true)
     {
         $this->enable_exceptions = $enable;
     }
@@ -1508,7 +1640,7 @@ class SimplePie
      * configuration options get processed, feeds are fetched, cached, and
      * parsed, and all of that other good stuff.
      *
-     * @return boolean True if successful, false otherwise
+     * @return bool True if successful, false otherwise
      */
     public function init()
     {
@@ -1523,7 +1655,9 @@ class SimplePie
             if ($xml_is_sane === null) {
                 $parser_check = xml_parser_create();
                 xml_parse_into_struct($parser_check, '<foo>&amp;</foo>', $values);
-                xml_parser_free($parser_check);
+                if (\PHP_VERSION_ID < 80000) {
+                    xml_parser_free($parser_check);
+                }
                 $xml_is_sane = isset($values[0]['value']);
             }
             if (!$xml_is_sane) {
@@ -1533,7 +1667,7 @@ class SimplePie

         // The default sanitize class gets set in the constructor, check if it has
         // changed.
-        if ($this->registry->get_class(Sanitize::class) !== 'SimplePie\Sanitize') {
+        if ($this->registry->get_class(Sanitize::class) !== Sanitize::class) {
             $this->sanitize = $this->registry->create(Sanitize::class);
         }
         if (method_exists($this->sanitize, 'set_registry')) {
@@ -1542,14 +1676,25 @@ class SimplePie

         // Pass whatever was set with config options over to the sanitizer.
         // Pass the classes in for legacy support; new classes should use the registry instead
+        $cache = $this->registry->get_class(Cache::class);
+        \assert($cache !== null, 'Cache must be defined');
         $this->sanitize->pass_cache_data(
             $this->enable_cache,
             $this->cache_location,
             $this->cache_namefilter,
-            $this->registry->get_class(Cache::class),
+            $cache,
             $this->cache
         );
-        $this->sanitize->pass_file_data($this->registry->get_class(File::class), $this->timeout, $this->useragent, $this->force_fsockopen, $this->curl_options);
+
+        $http_client = $this->get_http_client();
+
+        if ($http_client instanceof Psr18Client) {
+            $this->sanitize->set_http_client(
+                $http_client->getHttpClient(),
+                $http_client->getRequestFactory(),
+                $http_client->getUriFactory()
+            );
+        }

         if (!empty($this->multifeed_url)) {
             $i = 0;
@@ -1585,7 +1730,7 @@ class SimplePie
                 $cache = $this->get_cache($this->feed_url);
             }

-            // Fetch the data via \SimplePie\File into $this->raw_data
+            // Fetch the data into $this->raw_data
             if (($fetched = $this->fetch_data($cache)) === true) {
                 return true;
             } elseif ($fetched === false) {
@@ -1649,7 +1794,7 @@ class SimplePie
                 $parser = $this->registry->create(Parser::class);

                 // If it's parsed fine
-                if ($parser->parse($utf8_data, 'UTF-8', $this->permanent_url)) {
+                if ($parser->parse($utf8_data, 'UTF-8', $this->permanent_url ?? '')) {
                     $this->data = $parser->get_data();
                     if (!($this->get_type() & ~self::TYPE_NONE)) {
                         $this->error = "A feed could not be found at `$this->feed_url`. This does not appear to be a valid RSS or Atom feed.";
@@ -1660,10 +1805,11 @@ class SimplePie
                     if (isset($headers)) {
                         $this->data['headers'] = $headers;
                     }
-                    $this->data['build'] = \SimplePie\Misc::get_build();
+                    $this->data['build'] = Misc::get_build();

                     // Cache the file if caching is enabled
                     $this->data['cache_expiration_time'] = $this->cache_duration + time();
+
                     if ($cache && !$cache->set_data($this->get_cache_filename($this->feed_url), $this->data, $this->cache_duration)) {
                         trigger_error("$this->cache_location is not writable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING);
                     }
@@ -1673,7 +1819,7 @@ class SimplePie
         }

         if (isset($parser)) {
-            // We have an error, just set \SimplePie\Misc::error to it and quit
+            // We have an error, just set Misc::error to it and quit
             $this->error = $this->feed_url;
             $this->error .= sprintf(' is invalid XML, likely due to invalid characters. XML error: %s at line %d, column %d', $parser->get_error_string(), $parser->get_current_line(), $parser->get_current_column());
         } else {
@@ -1701,19 +1847,21 @@ class SimplePie
     }

     /**
-     * Fetch the data via \SimplePie\File
+     * Fetch the data
      *
      * If the data is already cached, attempt to fetch it from there instead
+     *
      * @param Base|DataCache|false $cache Cache handler, or false to not load from the cache
-     * @return array|true Returns true if the data was loaded from the cache, or an array of HTTP headers and sniffed type
+     * @return array{array<string, string>, string}|bool Returns true if the data was loaded from the cache, or an array of HTTP headers and sniffed type
      */
     protected function fetch_data(&$cache)
     {
-        if (is_object($cache) && $cache instanceof Base) {
+        if ($cache instanceof Base) {
             // @trigger_error(sprintf('Providing $cache as "\SimplePie\Cache\Base" in %s() is deprecated since SimplePie 1.8.0, please provide "\SimplePie\Cache\DataCache" implementation instead.', __METHOD__), \E_USER_DEPRECATED);
             $cache = new BaseDataCache($cache);
         }

+        // @phpstan-ignore-next-line Enforce PHPDoc type.
         if ($cache !== false && !$cache instanceof DataCache) {
             throw new InvalidArgumentException(sprintf(
                 '%s(): Argument #1 ($cache) must be of type %s|false',
@@ -1731,7 +1879,7 @@ class SimplePie

             if (!empty($this->data)) {
                 // If the cache is for an outdated build of SimplePie
-                if (!isset($this->data['build']) || $this->data['build'] !== \SimplePie\Misc::get_build()) {
+                if (!isset($this->data['build']) || $this->data['build'] !== Misc::get_build()) {
                     $cache->delete_data($cacheKey);
                     $this->data = [];
                 }
@@ -1763,7 +1911,7 @@ class SimplePie
                     $this->check_modified = true;
                     if (isset($this->data['headers']['last-modified']) || isset($this->data['headers']['etag'])) {
                         $headers = [
-                            'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1',
+                            'Accept' => SimplePie::DEFAULT_HTTP_ACCEPT_HEADER,
                         ];
                         if (isset($this->data['headers']['last-modified'])) {
                             $headers['if-modified-since'] = $this->data['headers']['last-modified'];
@@ -1772,25 +1920,31 @@ class SimplePie
                             $headers['if-none-match'] = $this->data['headers']['etag'];
                         }

-                        $file = $this->registry->create(File::class, [$this->feed_url, $this->timeout / 10, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options]);
-                        $this->status_code = $file->status_code;
-
-                        if ($file->success) {
-                            if ($file->status_code === 304) {
-                                // Set raw_data to false here too, to signify that the cache
-                                // is still valid.
-                                $this->raw_data = false;
-                                $cache->set_data($cacheKey, $this->data, $this->cache_duration);
-                                return true;
-                            }
-                        } else {
+                        try {
+                            $file = $this->get_http_client()->request(Client::METHOD_GET, $this->feed_url, $headers);
+                            $this->status_code = $file->get_status_code();
+                        } catch (ClientException $th) {
                             $this->check_modified = false;
+                            $this->status_code = 0;
+
                             if ($this->force_cache_fallback) {
+                                $this->data['cache_expiration_time'] = $this->cache_duration + time();
                                 $cache->set_data($cacheKey, $this->data, $this->cache_duration);
+
                                 return true;
                             }

-                            unset($file);
+                            $failedFileReason = $th->getMessage();
+                        }
+
+                        if ($this->status_code === 304) {
+                            // Set raw_data to false here too, to signify that the cache
+                            // is still valid.
+                            $this->raw_data = false;
+                            $this->data['cache_expiration_time'] = $this->cache_duration + time();
+                            $cache->set_data($cacheKey, $this->data, $this->cache_duration);
+
+                            return true;
                         }
                     }
                 }
@@ -1808,40 +1962,72 @@ class SimplePie

         // If we don't already have the file (it'll only exist if we've opened it to check if the cache has been modified), open it.
         if (!isset($file)) {
-            if ($this->file instanceof \SimplePie\File && $this->file->url === $this->feed_url) {
+            if ($this->file instanceof File && $this->file->get_final_requested_uri() === $this->feed_url) {
                 $file = &$this->file;
+            } elseif (isset($failedFileReason)) {
+                // Do not try to fetch again if we already failed once.
+                // If the file connection had an error, set SimplePie::error to that and quit
+                $this->error = $failedFileReason;
+
+                return !empty($this->data);
             } else {
                 $headers = [
-                    'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1',
+                    'Accept' => SimplePie::DEFAULT_HTTP_ACCEPT_HEADER,
                 ];
-                $file = $this->registry->create(File::class, [$this->feed_url, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options]);
+                try {
+                    $file = $this->get_http_client()->request(Client::METHOD_GET, $this->feed_url, $headers);
+                } catch (ClientException $th) {
+                    // If the file connection has an error, set SimplePie::error to that and quit
+                    $this->error = $th->getMessage();
+
+                    return !empty($this->data);
+                }
             }
         }
-        $this->status_code = $file->status_code;
+        $this->status_code = $file->get_status_code();

         // If the file connection has an error, set SimplePie::error to that and quit
-        if (!$file->success && !($file->method & self::FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300))) {
-            $this->error = $file->error;
+        if (!(!Misc::is_remote_uri($file->get_final_requested_uri()) || ($file->get_status_code() === 200 || $file->get_status_code() > 206 && $file->get_status_code() < 300))) {
+            $this->error = 'Retrieved unsupported status code "' . $this->status_code . '"';
             return !empty($this->data);
         }

         if (!$this->force_feed) {
             // Check if the supplied URL is a feed, if it isn't, look for it.
-            $locate = $this->registry->create(Locator::class, [&$file, $this->timeout, $this->useragent, $this->max_checked_feeds, $this->force_fsockopen, $this->curl_options]);
+            $locate = $this->registry->create(Locator::class, [
+                (!$file instanceof File) ? File::fromResponse($file) : $file,
+                $this->timeout,
+                $this->useragent,
+                $this->max_checked_feeds,
+                $this->force_fsockopen,
+                $this->curl_options
+            ]);
+
+            $http_client = $this->get_http_client();
+
+            if ($http_client instanceof Psr18Client) {
+                $locate->set_http_client(
+                    $http_client->getHttpClient(),
+                    $http_client->getRequestFactory(),
+                    $http_client->getUriFactory()
+                );
+            }

             if (!$locate->is_feed($file)) {
-                $copyStatusCode = $file->status_code;
-                $copyContentType = $file->headers['content-type'] ?? '';
+                $copyStatusCode = $file->get_status_code();
+                $copyContentType = $file->get_header_line('content-type');
                 try {
                     $microformats = false;
                     if (class_exists('DOMXpath') && function_exists('Mf2\parse')) {
                         $doc = new \DOMDocument();
-                        @$doc->loadHTML($file->body);
+                        @$doc->loadHTML($file->get_body_content());
                         $xpath = new \DOMXpath($doc);
                         // Check for both h-feed and h-entry, as both a feed with no entries
                         // and a list of entries without an h-feed wrapper are both valid.
                         $query = '//*[contains(concat(" ", @class, " "), " h-feed ") or '.
                             'contains(concat(" ", @class, " "), " h-entry ")]';
+
+                        /** @var \DOMNodeList<\DOMElement> $result */
                         $result = $xpath->query($query);
                         $microformats = $result->length !== 0;
                     }
@@ -1852,13 +2038,14 @@ class SimplePie
                         $this->all_discovered_feeds
                     );
                     if ($microformats) {
-                        if ($hub = $locate->get_rel_link('hub')) {
-                            $self = $locate->get_rel_link('self');
-                            $this->store_links($file, $hub, $self);
+                        $hub = $locate->get_rel_link('hub');
+                        $self = $locate->get_rel_link('self');
+                        if ($hub || $self) {
+                            $file = $this->store_links($file, $hub, $self);
                         }
                         // Push the current file onto all_discovered feeds so the user can
                         // be shown this as one of the options.
-                        if (isset($this->all_discovered_feeds)) {
+                        if ($this->all_discovered_feeds !== null) {
                             $this->all_discovered_feeds[] = $file;
                         }
                     } else {
@@ -1873,7 +2060,7 @@ class SimplePie
                             return false;
                         }
                     }
-                } catch (\SimplePie\Exception $e) {
+                } catch (SimplePieException $e) {
                     // We need to unset this so that if SimplePie::set_file() has been called that object is untouched
                     unset($file);
                     // This is usually because DOMDocument doesn't exist
@@ -1885,8 +2072,8 @@ class SimplePie
                 if ($cache) {
                     $this->data = [
                         'url' => $this->feed_url,
-                        'feed_url' => $file->url,
-                        'build' => \SimplePie\Misc::get_build(),
+                        'feed_url' => $file->get_final_requested_uri(),
+                        'build' => Misc::get_build(),
                         'cache_expiration_time' => $this->cache_duration + time(),
                     ];

@@ -1895,13 +2082,18 @@ class SimplePie
                     }
                 }
             }
-            $this->feed_url = $file->url;
+            $this->feed_url = $file->get_final_requested_uri();
             $locate = null;
         }

-        $this->raw_data = $file->body;
-        $this->permanent_url = $file->permanent_url;
-        $headers = $file->headers;
+        $this->raw_data = $file->get_body_content();
+        $this->permanent_url = $file->get_permanent_uri();
+
+        $headers = [];
+        foreach ($file->get_headers() as $key => $values) {
+            $headers[$key] = implode(', ', $values);
+        }
+
         $sniffer = $this->registry->create(Sniffer::class, [&$file]);
         $sniffed = $sniffer->get_type();

@@ -1911,7 +2103,7 @@ class SimplePie
     /**
      * Get the error message for the occurred error
      *
-     * @return string|array Error message, or array of messages for multifeeds
+     * @return string|string[]|null Error message, or array of messages for multifeeds
      */
     public function error()
     {
@@ -1934,7 +2126,7 @@ class SimplePie
      * This is the same as the old `$feed->enable_xml_dump(true)`, but returns
      * the data instead of printing it.
      *
-     * @return string|boolean Raw XML data, false if the cache is used
+     * @return string|false Raw XML data, false if the cache is used
      */
     public function get_raw_data()
     {
@@ -1970,8 +2162,9 @@ class SimplePie
      * top).
      *
      * @param string $mime MIME type to serve the page as
+     * @return void
      */
-    public function handle_content_type($mime = 'text/html')
+    public function handle_content_type(string $mime = 'text/html')
     {
         if (!headers_sent()) {
             $header = "Content-type: $mime;";
@@ -1987,28 +2180,28 @@ class SimplePie
     /**
      * Get the type of the feed
      *
-     * This returns a \SimplePie\SimplePie::TYPE_* constant, which can be tested against
+     * This returns a self::TYPE_* constant, which can be tested against
      * using {@link http://php.net/language.operators.bitwise bitwise operators}
      *
      * @since 0.8 (usage changed to using constants in 1.0)
-     * @see \SimplePie\SimplePie::TYPE_NONE Unknown.
-     * @see \SimplePie\SimplePie::TYPE_RSS_090 RSS 0.90.
-     * @see \SimplePie\SimplePie::TYPE_RSS_091_NETSCAPE RSS 0.91 (Netscape).
-     * @see \SimplePie\SimplePie::TYPE_RSS_091_USERLAND RSS 0.91 (Userland).
-     * @see \SimplePie\SimplePie::TYPE_RSS_091 RSS 0.91.
-     * @see \SimplePie\SimplePie::TYPE_RSS_092 RSS 0.92.
-     * @see \SimplePie\SimplePie::TYPE_RSS_093 RSS 0.93.
-     * @see \SimplePie\SimplePie::TYPE_RSS_094 RSS 0.94.
-     * @see \SimplePie\SimplePie::TYPE_RSS_10 RSS 1.0.
-     * @see \SimplePie\SimplePie::TYPE_RSS_20 RSS 2.0.x.
-     * @see \SimplePie\SimplePie::TYPE_RSS_RDF RDF-based RSS.
-     * @see \SimplePie\SimplePie::TYPE_RSS_SYNDICATION Non-RDF-based RSS (truly intended as syndication format).
-     * @see \SimplePie\SimplePie::TYPE_RSS_ALL Any version of RSS.
-     * @see \SimplePie\SimplePie::TYPE_ATOM_03 Atom 0.3.
-     * @see \SimplePie\SimplePie::TYPE_ATOM_10 Atom 1.0.
-     * @see \SimplePie\SimplePie::TYPE_ATOM_ALL Any version of Atom.
-     * @see \SimplePie\SimplePie::TYPE_ALL Any known/supported feed type.
-     * @return int \SimplePie\SimplePie::TYPE_* constant
+     * @see self::TYPE_NONE Unknown.
+     * @see self::TYPE_RSS_090 RSS 0.90.
+     * @see self::TYPE_RSS_091_NETSCAPE RSS 0.91 (Netscape).
+     * @see self::TYPE_RSS_091_USERLAND RSS 0.91 (Userland).
+     * @see self::TYPE_RSS_091 RSS 0.91.
+     * @see self::TYPE_RSS_092 RSS 0.92.
+     * @see self::TYPE_RSS_093 RSS 0.93.
+     * @see self::TYPE_RSS_094 RSS 0.94.
+     * @see self::TYPE_RSS_10 RSS 1.0.
+     * @see self::TYPE_RSS_20 RSS 2.0.x.
+     * @see self::TYPE_RSS_RDF RDF-based RSS.
+     * @see self::TYPE_RSS_SYNDICATION Non-RDF-based RSS (truly intended as syndication format).
+     * @see self::TYPE_RSS_ALL Any version of RSS.
+     * @see self::TYPE_ATOM_03 Atom 0.3.
+     * @see self::TYPE_ATOM_10 Atom 1.0.
+     * @see self::TYPE_ATOM_ALL Any version of Atom.
+     * @see self::TYPE_ALL Any known/supported feed type.
+     * @return int-mask-of<self::TYPE_*> constant
      */
     public function get_type()
     {
@@ -2093,7 +2286,7 @@ class SimplePie
      * iff it is a 301 redirection
      * @return string|null
      */
-    public function subscribe_url($permanent = false)
+    public function subscribe_url(bool $permanent = false)
     {
         if ($permanent) {
             if ($this->permanent_url !== null) {
@@ -2151,9 +2344,9 @@ class SimplePie
      * @see http://simplepie.org/wiki/faq/supported_xml_namespaces
      * @param string $namespace The URL of the XML namespace of the elements you're trying to access
      * @param string $tag Tag name
-     * @return array
+     * @return array<array<string, mixed>>|null
      */
-    public function get_feed_tags($namespace, $tag)
+    public function get_feed_tags(string $namespace, string $tag)
     {
         $type = $this->get_type();
         if ($type & self::TYPE_ATOM_10) {
@@ -2191,9 +2384,9 @@ class SimplePie
      * @see http://simplepie.org/wiki/faq/supported_xml_namespaces
      * @param string $namespace The URL of the XML namespace of the elements you're trying to access
      * @param string $tag Tag name
-     * @return array
+     * @return array<array<string, mixed>>|null
      */
-    public function get_channel_tags($namespace, $tag)
+    public function get_channel_tags(string $namespace, string $tag)
     {
         $type = $this->get_type();
         if ($type & self::TYPE_ATOM_ALL) {
@@ -2237,9 +2430,9 @@ class SimplePie
      * @see http://simplepie.org/wiki/faq/supported_xml_namespaces
      * @param string $namespace The URL of the XML namespace of the elements you're trying to access
      * @param string $tag Tag name
-     * @return array
+     * @return array<array<string, mixed>>|null
      */
-    public function get_image_tags($namespace, $tag)
+    public function get_image_tags(string $namespace, string $tag)
     {
         $type = $this->get_type();
         if ($type & self::TYPE_RSS_10) {
@@ -2269,41 +2462,47 @@ class SimplePie
     /**
      * Get the base URL value from the feed
      *
-     * Uses `<xml:base>` if available, otherwise uses the first link in the
-     * feed, or failing that, the URL of the feed itself.
+     * Uses `<xml:base>` if available,
+     * otherwise uses the first 'self' link or the first 'alternate' link of the feed,
+     * or failing that, the URL of the feed itself.
      *
      * @see get_link
      * @see subscribe_url
      *
-     * @param array $element
+     * @param array<string, mixed> $element
      * @return string
      */
-    public function get_base($element = [])
+    public function get_base(array $element = [])
     {
         if (!empty($element['xml_base_explicit']) && isset($element['xml_base'])) {
             return $element['xml_base'];
-        } elseif ($this->get_link() !== null) {
-            return $this->get_link();
+        }
+        if (($link = $this->get_link(0, 'alternate')) !== null) {
+            return $link;
+        }
+        if (($link = $this->get_link(0, 'self')) !== null) {
+            return $link;
         }

-        return $this->subscribe_url();
+        return $this->subscribe_url() ?? '';
     }

     /**
      * Sanitize feed data
      *
      * @access private
-     * @see \SimplePie\Sanitize::sanitize()
+     * @see Sanitize::sanitize()
      * @param string $data Data to sanitize
-     * @param int $type One of the \SimplePie\SimplePie::CONSTRUCT_* constants
+     * @param int-mask-of<SimplePie::CONSTRUCT_*> $type
      * @param string $base Base URL to resolve URLs against
      * @return string Sanitized data
      */
-    public function sanitize($data, $type, $base = '')
+    public function sanitize(string $data, int $type, string $base = '')
     {
         try {
+            // This really returns string|false but changing encoding is uncommon and we are going to deprecate it, so let’s just lie to PHPStan in the interest of cleaner annotations.
             return $this->sanitize->sanitize($data, $type, $base);
-        } catch (\SimplePie\Exception $e) {
+        } catch (SimplePieException $e) {
             if (!$this->enable_exceptions) {
                 $this->error = $e->getMessage();
                 $this->registry->call(Misc::class, 'error', [$this->error, E_USER_WARNING, $e->getFile(), $e->getLine()]);
@@ -2348,9 +2547,9 @@ class SimplePie
      *
      * @since Unknown
      * @param int $key The category that you want to return. Remember that arrays begin with 0, not 1
-     * @return \SimplePie\Category|null
+     * @return Category|null
      */
-    public function get_category($key = 0)
+    public function get_category(int $key = 0)
     {
         $categories = $this->get_categories();
         if (isset($categories[$key])) {
@@ -2366,7 +2565,7 @@ class SimplePie
      * Uses `<atom:category>`, `<category>` or `<dc:subject>`
      *
      * @since Unknown
-     * @return array|null List of {@see \SimplePie\Category} objects
+     * @return array<Category>|null List of {@see Category} objects
      */
     public function get_categories()
     {
@@ -2417,9 +2616,9 @@ class SimplePie
      *
      * @since 1.1
      * @param int $key The author that you want to return. Remember that arrays begin with 0, not 1
-     * @return \SimplePie\Author|null
+     * @return Author|null
      */
-    public function get_author($key = 0)
+    public function get_author(int $key = 0)
     {
         $authors = $this->get_authors();
         if (isset($authors[$key])) {
@@ -2435,7 +2634,7 @@ class SimplePie
      * Uses `<atom:author>`, `<author>`, `<dc:creator>` or `<itunes:author>`
      *
      * @since 1.1
-     * @return array|null List of {@see \SimplePie\Author} objects
+     * @return array<Author>|null List of {@see Author} objects
      */
     public function get_authors()
     {
@@ -2448,7 +2647,8 @@ class SimplePie
                 $name = $this->sanitize($author['child'][self::NAMESPACE_ATOM_10]['name'][0]['data'], self::CONSTRUCT_TEXT);
             }
             if (isset($author['child'][self::NAMESPACE_ATOM_10]['uri'][0]['data'])) {
-                $uri = $this->sanitize($author['child'][self::NAMESPACE_ATOM_10]['uri'][0]['data'], self::CONSTRUCT_IRI, $this->get_base($author['child'][self::NAMESPACE_ATOM_10]['uri'][0]));
+                $uri = $author['child'][self::NAMESPACE_ATOM_10]['uri'][0];
+                $uri = $this->sanitize($uri['data'], self::CONSTRUCT_IRI, $this->get_base($uri));
             }
             if (isset($author['child'][self::NAMESPACE_ATOM_10]['email'][0]['data'])) {
                 $email = $this->sanitize($author['child'][self::NAMESPACE_ATOM_10]['email'][0]['data'], self::CONSTRUCT_TEXT);
@@ -2465,7 +2665,8 @@ class SimplePie
                 $name = $this->sanitize($author[0]['child'][self::NAMESPACE_ATOM_03]['name'][0]['data'], self::CONSTRUCT_TEXT);
             }
             if (isset($author[0]['child'][self::NAMESPACE_ATOM_03]['url'][0]['data'])) {
-                $url = $this->sanitize($author[0]['child'][self::NAMESPACE_ATOM_03]['url'][0]['data'], self::CONSTRUCT_IRI, $this->get_base($author[0]['child'][self::NAMESPACE_ATOM_03]['url'][0]));
+                $url = $author[0]['child'][self::NAMESPACE_ATOM_03]['url'][0];
+                $url = $this->sanitize($url['data'], self::CONSTRUCT_IRI, $this->get_base($url));
             }
             if (isset($author[0]['child'][self::NAMESPACE_ATOM_03]['email'][0]['data'])) {
                 $email = $this->sanitize($author[0]['child'][self::NAMESPACE_ATOM_03]['email'][0]['data'], self::CONSTRUCT_TEXT);
@@ -2496,9 +2697,9 @@ class SimplePie
      *
      * @since 1.1
      * @param int $key The contrbutor that you want to return. Remember that arrays begin with 0, not 1
-     * @return \SimplePie\Author|null
+     * @return Author|null
      */
-    public function get_contributor($key = 0)
+    public function get_contributor(int $key = 0)
     {
         $contributors = $this->get_contributors();
         if (isset($contributors[$key])) {
@@ -2514,7 +2715,7 @@ class SimplePie
      * Uses `<atom:contributor>`
      *
      * @since 1.1
-     * @return array|null List of {@see \SimplePie\Author} objects
+     * @return array<Author>|null List of {@see Author} objects
      */
     public function get_contributors()
     {
@@ -2527,7 +2728,8 @@ class SimplePie
                 $name = $this->sanitize($contributor['child'][self::NAMESPACE_ATOM_10]['name'][0]['data'], self::CONSTRUCT_TEXT);
             }
             if (isset($contributor['child'][self::NAMESPACE_ATOM_10]['uri'][0]['data'])) {
-                $uri = $this->sanitize($contributor['child'][self::NAMESPACE_ATOM_10]['uri'][0]['data'], self::CONSTRUCT_IRI, $this->get_base($contributor['child'][self::NAMESPACE_ATOM_10]['uri'][0]));
+                $uri = $contributor['child'][self::NAMESPACE_ATOM_10]['uri'][0];
+                $uri = $this->sanitize($uri['data'], self::CONSTRUCT_IRI, $this->get_base($uri));
             }
             if (isset($contributor['child'][self::NAMESPACE_ATOM_10]['email'][0]['data'])) {
                 $email = $this->sanitize($contributor['child'][self::NAMESPACE_ATOM_10]['email'][0]['data'], self::CONSTRUCT_TEXT);
@@ -2544,7 +2746,8 @@ class SimplePie
                 $name = $this->sanitize($contributor['child'][self::NAMESPACE_ATOM_03]['name'][0]['data'], self::CONSTRUCT_TEXT);
             }
             if (isset($contributor['child'][self::NAMESPACE_ATOM_03]['url'][0]['data'])) {
-                $url = $this->sanitize($contributor['child'][self::NAMESPACE_ATOM_03]['url'][0]['data'], self::CONSTRUCT_IRI, $this->get_base($contributor['child'][self::NAMESPACE_ATOM_03]['url'][0]));
+                $url = $contributor['child'][self::NAMESPACE_ATOM_03]['url'][0];
+                $url = $this->sanitize($url['data'], self::CONSTRUCT_IRI, $this->get_base($url));
             }
             if (isset($contributor['child'][self::NAMESPACE_ATOM_03]['email'][0]['data'])) {
                 $email = $this->sanitize($contributor['child'][self::NAMESPACE_ATOM_03]['email'][0]['data'], self::CONSTRUCT_TEXT);
@@ -2569,7 +2772,7 @@ class SimplePie
      * @param string $rel The relationship of the link to return
      * @return string|null Link URL
      */
-    public function get_link($key = 0, $rel = 'alternate')
+    public function get_link(int $key = 0, string $rel = 'alternate')
     {
         $links = $this->get_links($rel);
         if (isset($links[$key])) {
@@ -2602,9 +2805,9 @@ class SimplePie
      *
      * @since Beta 2
      * @param string $rel The relationship of links to return
-     * @return array|null Links found for the feed (strings)
+     * @return array<string>|null Links found for the feed (strings)
      */
-    public function get_links($rel = 'alternate')
+    public function get_links(string $rel = 'alternate')
     {
         if (!isset($this->data['links'])) {
             $this->data['links'] = [];
@@ -2669,6 +2872,9 @@ class SimplePie
         return null;
     }

+    /**
+     * @return ?array<Response>
+     */
     public function get_all_discovered_feeds()
     {
         return $this->all_discovered_feeds;
@@ -2772,7 +2978,7 @@ class SimplePie
      * @since 1.0
      * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo
      * @link http://www.georss.org/ GeoRSS
-     * @return string|null
+     * @return float|null
      */
     public function get_latitude()
     {
@@ -2795,7 +3001,7 @@ class SimplePie
      * @since 1.0
      * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo
      * @link http://www.georss.org/ GeoRSS
-     * @return string|null
+     * @return float|null
      */
     public function get_longitude()
     {
@@ -2942,15 +3148,14 @@ class SimplePie
      * @param int $max Maximum value to return. 0 for no limit
      * @return int Number of items in the feed
      */
-    public function get_item_quantity($max = 0)
+    public function get_item_quantity(int $max = 0)
     {
-        $max = (int) $max;
         $qty = count($this->get_items());
         if ($max === 0) {
             return $qty;
         }

-        return ($qty > $max) ? $max : $qty;
+        return min($qty, $max);
     }

     /**
@@ -2963,9 +3168,9 @@ class SimplePie
      * @see get_item_quantity()
      * @since Beta 2
      * @param int $key The item that you want to return. Remember that arrays begin with 0, not 1
-     * @return \SimplePie\Item|null
+     * @return Item|null
      */
-    public function get_item($key = 0)
+    public function get_item(int $key = 0)
     {
         $items = $this->get_items();
         if (isset($items[$key])) {
@@ -2986,9 +3191,9 @@ class SimplePie
      * @since Beta 2
      * @param int $start Index to start at
      * @param int $end Number of items to return. 0 for all items after `$start`
-     * @return \SimplePie\Item[]|null List of {@see \SimplePie\Item} objects
+     * @return Item[] List of {@see Item} objects
      */
-    public function get_items($start = 0, $end = 0)
+    public function get_items(int $start = 0, int $end = 0)
     {
         if (!isset($this->data['items'])) {
             if (!empty($this->multifeed_objects)) {
@@ -3002,31 +3207,31 @@ class SimplePie
             if ($items = $this->get_feed_tags(self::NAMESPACE_ATOM_10, 'entry')) {
                 $keys = array_keys($items);
                 foreach ($keys as $key) {
-                    $this->data['items'][] = $this->registry->create(Item::class, [$this, $items[$key]]);
+                    $this->data['items'][] = $this->make_item($items[$key]);
                 }
             }
             if ($items = $this->get_feed_tags(self::NAMESPACE_ATOM_03, 'entry')) {
                 $keys = array_keys($items);
                 foreach ($keys as $key) {
-                    $this->data['items'][] = $this->registry->create(Item::class, [$this, $items[$key]]);
+                    $this->data['items'][] = $this->make_item($items[$key]);
                 }
             }
             if ($items = $this->get_feed_tags(self::NAMESPACE_RSS_10, 'item')) {
                 $keys = array_keys($items);
                 foreach ($keys as $key) {
-                    $this->data['items'][] = $this->registry->create(Item::class, [$this, $items[$key]]);
+                    $this->data['items'][] = $this->make_item($items[$key]);
                 }
             }
             if ($items = $this->get_feed_tags(self::NAMESPACE_RSS_090, 'item')) {
                 $keys = array_keys($items);
                 foreach ($keys as $key) {
-                    $this->data['items'][] = $this->registry->create(Item::class, [$this, $items[$key]]);
+                    $this->data['items'][] = $this->make_item($items[$key]);
                 }
             }
             if ($items = $this->get_channel_tags(self::NAMESPACE_RSS_20, 'item')) {
                 $keys = array_keys($items);
                 foreach ($keys as $key) {
-                    $this->data['items'][] = $this->registry->create(Item::class, [$this, $items[$key]]);
+                    $this->data['items'][] = $this->make_item($items[$key]);
                 }
             }
         }
@@ -3056,10 +3261,12 @@ class SimplePie
      * Set the favicon handler
      *
      * @deprecated Use your own favicon handling instead
+     * @param string|false $page
+     * @return bool
      */
-    public function set_favicon_handler($page = false, $qs = 'i')
+    public function set_favicon_handler($page = false, string $qs = 'i')
     {
-        trigger_error('Favicon handling has been removed, please use your own handling', \E_USER_DEPRECATED);
+        trigger_error('Favicon handling has been removed since SimplePie 1.3, please use your own handling', \E_USER_DEPRECATED);
         return false;
     }

@@ -3067,10 +3274,11 @@ class SimplePie
      * Get the favicon for the current feed
      *
      * @deprecated Use your own favicon handling instead
+     * @return string|bool
      */
     public function get_favicon()
     {
-        trigger_error('Favicon handling has been removed, please use your own handling', \E_USER_DEPRECATED);
+        trigger_error('Favicon handling has been removed since SimplePie 1.3, please use your own handling', \E_USER_DEPRECATED);

         if (($url = $this->get_link()) !== null) {
             return 'https://www.google.com/s2/favicons?domain=' . urlencode($url);
@@ -3083,36 +3291,49 @@ class SimplePie
      * Magic method handler
      *
      * @param string $method Method name
-     * @param array $args Arguments to the method
+     * @param array<mixed> $args Arguments to the method
      * @return mixed
      */
-    public function __call($method, $args)
+    public function __call(string $method, array $args)
     {
         if (strpos($method, 'subscribe_') === 0) {
-            trigger_error('subscribe_*() has been deprecated, implement the callback yourself', \E_USER_DEPRECATED);
+            trigger_error('subscribe_*() has been deprecated since SimplePie 1.3, implement the callback yourself', \E_USER_DEPRECATED);
             return '';
         }
         if ($method === 'enable_xml_dump') {
-            trigger_error('enable_xml_dump() has been deprecated, use get_raw_data() instead', \E_USER_DEPRECATED);
+            trigger_error('enable_xml_dump() has been deprecated since SimplePie 1.3, use get_raw_data() instead', \E_USER_DEPRECATED);
             return false;
         }

         $class = get_class($this);
         $trace = debug_backtrace(); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection
-        $file = $trace[0]['file'];
-        $line = $trace[0]['line'];
+        $file = $trace[0]['file'] ?? '';
+        $line = $trace[0]['line'] ?? '';
         throw new SimplePieException("Call to undefined method $class::$method() in $file on line $line");
     }

+    /**
+     * Item factory
+     *
+     * @param array<string, mixed> $data
+     */
+    private function make_item(array $data): Item
+    {
+        $item = $this->registry->create(Item::class, [$this, $data]);
+        $item->set_sanitize($this->sanitize);
+
+        return $item;
+    }
+
     /**
      * Sorting callback for items
      *
      * @access private
-     * @param SimplePie $a
-     * @param SimplePie $b
-     * @return boolean
+     * @param Item $a
+     * @param Item $b
+     * @return -1|0|1
      */
-    public static function sort_items($a, $b)
+    public static function sort_items(Item $a, Item $b)
     {
         $a_date = $a->get_date('U');
         $b_date = $b->get_date('U');
@@ -3136,19 +3357,21 @@ class SimplePie
      * for the items or else SimplePie will refuse to sort them.
      *
      * @link http://simplepie.org/wiki/tutorial/sort_multiple_feeds_by_time_and_date#if_feeds_require_separate_per-feed_settings
-     * @param array $urls List of SimplePie feed objects to merge
+     * @param array<SimplePie> $urls List of SimplePie feed objects to merge
      * @param int $start Starting item
      * @param int $end Number of items to return
      * @param int $limit Maximum number of items per feed
-     * @return array
+     * @return array<Item>
      */
-    public static function merge_items($urls, $start = 0, $end = 0, $limit = 0)
+    public static function merge_items(array $urls, int $start = 0, int $end = 0, int $limit = 0)
     {
-        if (is_array($urls) && sizeof($urls) > 0) {
+        if (count($urls) > 0) {
             $items = [];
             foreach ($urls as $arg) {
                 if ($arg instanceof SimplePie) {
                     $items = array_merge($items, $arg->get_items(0, $limit));
+
+                    // @phpstan-ignore-next-line Enforce PHPDoc type.
                 } else {
                     trigger_error('Arguments must be SimplePie objects', E_USER_WARNING);
                 }
@@ -3172,31 +3395,25 @@ class SimplePie
      *
      * There is no way to find PuSH links in the body of a microformats feed,
      * so they are added to the headers when found, to be used later by get_links.
-     * @param \SimplePie\File $file
-     * @param string $hub
-     * @param string $self
      */
-    private function store_links(&$file, $hub, $self)
+    private function store_links(Response $file, ?string $hub, ?string $self): Response
     {
-        if (isset($file->headers['link']['hub']) ||
-              (isset($file->headers['link']) &&
-               preg_match('/rel=hub/', $file->headers['link']))) {
-            return;
+        $linkHeaderLine = $file->get_header_line('link');
+        $linkHeader = $file->get_header('link');
+
+        if ($hub && !preg_match('/rel=hub/', $linkHeaderLine)) {
+            $linkHeader[] = '<'.$hub.'>; rel=hub';
         }

-        if ($hub) {
-            if (isset($file->headers['link'])) {
-                if ($file->headers['link'] !== '') {
-                    $file->headers['link'] = ', ';
-                }
-            } else {
-                $file->headers['link'] = '';
-            }
-            $file->headers['link'] .= '<'.$hub.'>; rel=hub';
-            if ($self) {
-                $file->headers['link'] .= ', <'.$self.'>; rel=self';
-            }
+        if ($self && !preg_match('/rel=self/', $linkHeaderLine)) {
+            $linkHeader[] = '<'.$self.'>; rel=self';
         }
+
+        if (count($linkHeader) > 0) {
+            $file = $file->with_header('link', $linkHeader);
+        }
+
+        return $file;
     }

     /**
@@ -3206,7 +3423,7 @@ class SimplePie
      *
      * @return DataCache
      */
-    private function get_cache($feed_url = '')
+    private function get_cache(string $feed_url = ''): DataCache
     {
         if ($this->cache === null) {
             // @trigger_error(sprintf('Not providing as PSR-16 cache implementation is deprecated since SimplePie 1.8.0, please use "SimplePie\SimplePie::set_cache()".'), \E_USER_DEPRECATED);
@@ -3221,6 +3438,28 @@ class SimplePie

         return $this->cache;
     }
+
+    /**
+     * Get a HTTP client
+     */
+    private function get_http_client(): Client
+    {
+        if ($this->http_client === null) {
+            $this->http_client = new FileClient(
+                $this->get_registry(),
+                [
+                    'timeout' => $this->timeout,
+                    'redirects' => 5,
+                    'useragent' => $this->useragent,
+                    'force_fsockopen' => $this->force_fsockopen,
+                    'curl_options' => $this->curl_options,
+                ]
+            );
+            $this->http_client_injected = true;
+        }
+
+        return $this->http_client;
+    }
 }

 class_alias('SimplePie\SimplePie', 'SimplePie');
diff --git a/wp-includes/SimplePie/src/Source.php b/wp-includes/SimplePie/src/Source.php
index 5a8f86de9f..932fb84d96 100644
--- a/wp-includes/SimplePie/src/Source.php
+++ b/wp-includes/SimplePie/src/Source.php
@@ -1,46 +1,9 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie;

@@ -50,33 +13,47 @@ namespace SimplePie;
  * Used by {@see \SimplePie\Item::get_source()}
  *
  * This class can be overloaded with {@see \SimplePie::set_source_class()}
- *
- * @package SimplePie
- * @subpackage API
  */
 class Source implements RegistryAware
 {
+    /** @var Item */
     public $item;
+    /** @var array<string, mixed> */
     public $data = [];
+    /** @var Registry */
     protected $registry;

-    public function __construct($item, $data)
+    /**
+     * @param array<string, mixed> $data
+     */
+    public function __construct(Item $item, array $data)
     {
         $this->item = $item;
         $this->data = $data;
     }

-    public function set_registry(\SimplePie\Registry $registry)/* : void */
+    /**
+     * @return void
+     */
+    public function set_registry(\SimplePie\Registry $registry)
     {
         $this->registry = $registry;
     }

+    /**
+     * @return string
+     */
     public function __toString()
     {
         return md5(serialize($this->data));
     }

-    public function get_source_tags($namespace, $tag)
+    /**
+     * @param string $namespace
+     * @param string $tag
+     * @return array<array<string, mixed>>|null
+     */
+    public function get_source_tags(string $namespace, string $tag)
     {
         if (isset($this->data['child'][$namespace][$tag])) {
             return $this->data['child'][$namespace][$tag];
@@ -85,21 +62,37 @@ class Source implements RegistryAware
         return null;
     }

-    public function get_base($element = [])
+    /**
+     * @param array<string, mixed> $element
+     * @return string
+     */
+    public function get_base(array $element = [])
     {
         return $this->item->get_base($element);
     }

-    public function sanitize($data, $type, $base = '')
+    /**
+     * @param string $data
+     * @param int-mask-of<SimplePie::CONSTRUCT_*> $type
+     * @param string $base
+     * @return string
+     */
+    public function sanitize(string $data, $type, string $base = '')
     {
         return $this->item->sanitize($data, $type, $base);
     }

+    /**
+     * @return Item
+     */
     public function get_item()
     {
         return $this->item;
     }

+    /**
+     * @return string|null
+     */
     public function get_title()
     {
         if ($return = $this->get_source_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_10, 'title')) {
@@ -121,7 +114,11 @@ class Source implements RegistryAware
         return null;
     }

-    public function get_category($key = 0)
+    /**
+     * @param int $key
+     * @return Category|null
+     */
+    public function get_category(int $key = 0)
     {
         $categories = $this->get_categories();
         if (isset($categories[$key])) {
@@ -131,6 +128,9 @@ class Source implements RegistryAware
         return null;
     }

+    /**
+     * @return array<Category>|null
+     */
     public function get_categories()
     {
         $categories = [];
@@ -175,7 +175,11 @@ class Source implements RegistryAware
         return null;
     }

-    public function get_author($key = 0)
+    /**
+     * @param int $key
+     * @return Author|null
+     */
+    public function get_author(int $key = 0)
     {
         $authors = $this->get_authors();
         if (isset($authors[$key])) {
@@ -185,6 +189,9 @@ class Source implements RegistryAware
         return null;
     }

+    /**
+     * @return array<Author>|null
+     */
     public function get_authors()
     {
         $authors = [];
@@ -196,7 +203,8 @@ class Source implements RegistryAware
                 $name = $this->sanitize($author['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['name'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
             }
             if (isset($author['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['uri'][0]['data'])) {
-                $uri = $this->sanitize($author['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['uri'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($author['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['uri'][0]));
+                $uri = $author['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['uri'][0];
+                $uri = $this->sanitize($uri['data'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($uri));
             }
             if (isset($author['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['email'][0]['data'])) {
                 $email = $this->sanitize($author['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['email'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
@@ -213,7 +221,8 @@ class Source implements RegistryAware
                 $name = $this->sanitize($author[0]['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['name'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
             }
             if (isset($author[0]['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['url'][0]['data'])) {
-                $url = $this->sanitize($author[0]['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['url'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($author[0]['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['url'][0]));
+                $url = $author[0]['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['url'][0];
+                $url = $this->sanitize($url['data'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($url));
             }
             if (isset($author[0]['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['email'][0]['data'])) {
                 $email = $this->sanitize($author[0]['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['email'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
@@ -239,7 +248,11 @@ class Source implements RegistryAware
         return null;
     }

-    public function get_contributor($key = 0)
+    /**
+     * @param int $key
+     * @return Author|null
+     */
+    public function get_contributor(int $key = 0)
     {
         $contributors = $this->get_contributors();
         if (isset($contributors[$key])) {
@@ -249,6 +262,9 @@ class Source implements RegistryAware
         return null;
     }

+    /**
+     * @return array<Author>|null
+     */
     public function get_contributors()
     {
         $contributors = [];
@@ -260,7 +276,8 @@ class Source implements RegistryAware
                 $name = $this->sanitize($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['name'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
             }
             if (isset($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['uri'][0]['data'])) {
-                $uri = $this->sanitize($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['uri'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['uri'][0]));
+                $uri = $contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['uri'][0];
+                $uri = $this->sanitize($uri['data'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($uri));
             }
             if (isset($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['email'][0]['data'])) {
                 $email = $this->sanitize($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['email'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
@@ -277,7 +294,8 @@ class Source implements RegistryAware
                 $name = $this->sanitize($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['name'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
             }
             if (isset($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['url'][0]['data'])) {
-                $url = $this->sanitize($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['url'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['url'][0]));
+                $url = $contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['url'][0];
+                $url = $this->sanitize($url['data'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($url));
             }
             if (isset($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['email'][0]['data'])) {
                 $email = $this->sanitize($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['email'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT);
@@ -294,7 +312,12 @@ class Source implements RegistryAware
         return null;
     }

-    public function get_link($key = 0, $rel = 'alternate')
+    /**
+     * @param int $key
+     * @param string $rel
+     * @return string|null
+     */
+    public function get_link(int $key = 0, string $rel = 'alternate')
     {
         $links = $this->get_links($rel);
         if (isset($links[$key])) {
@@ -306,13 +329,19 @@ class Source implements RegistryAware

     /**
      * Added for parity between the parent-level and the item/entry-level.
+     *
+     * @return string|null
      */
     public function get_permalink()
     {
         return $this->get_link(0);
     }

-    public function get_links($rel = 'alternate')
+    /**
+     * @param string $rel
+     * @return array<string>|null
+     */
+    public function get_links(string $rel = 'alternate')
     {
         if (!isset($this->data['links'])) {
             $this->data['links'] = [];
@@ -344,6 +373,8 @@ class Source implements RegistryAware

             $keys = array_keys($this->data['links']);
             foreach ($keys as $key) {
+                $key = (string) $key;
+
                 if ($this->registry->call(Misc::class, 'is_isegment_nz_nc', [$key])) {
                     if (isset($this->data['links'][\SimplePie\SimplePie::IANA_LINK_RELATIONS_REGISTRY . $key])) {
                         $this->data['links'][\SimplePie\SimplePie::IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][\SimplePie\SimplePie::IANA_LINK_RELATIONS_REGISTRY . $key]);
@@ -365,6 +396,9 @@ class Source implements RegistryAware
         return null;
     }

+    /**
+     * @return string|null
+     */
     public function get_description()
     {
         if ($return = $this->get_source_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_10, 'subtitle')) {
@@ -390,6 +424,9 @@ class Source implements RegistryAware
         return null;
     }

+    /**
+     * @return string|null
+     */
     public function get_copyright()
     {
         if ($return = $this->get_source_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_10, 'rights')) {
@@ -407,6 +444,9 @@ class Source implements RegistryAware
         return null;
     }

+    /**
+     * @return string|null
+     */
     public function get_language()
     {
         if ($return = $this->get_source_tags(\SimplePie\SimplePie::NAMESPACE_RSS_20, 'language')) {
@@ -422,6 +462,9 @@ class Source implements RegistryAware
         return null;
     }

+    /**
+     * @return float|null
+     */
     public function get_latitude()
     {
         if ($return = $this->get_source_tags(\SimplePie\SimplePie::NAMESPACE_W3C_BASIC_GEO, 'lat')) {
@@ -433,6 +476,9 @@ class Source implements RegistryAware
         return null;
     }

+    /**
+     * @return float|null
+     */
     public function get_longitude()
     {
         if ($return = $this->get_source_tags(\SimplePie\SimplePie::NAMESPACE_W3C_BASIC_GEO, 'long')) {
@@ -446,6 +492,9 @@ class Source implements RegistryAware
         return null;
     }

+    /**
+     * @return string|null
+     */
     public function get_image_url()
     {
         if ($return = $this->get_source_tags(\SimplePie\SimplePie::NAMESPACE_ITUNES, 'image')) {
diff --git a/wp-includes/SimplePie/src/XML/Declaration/Parser.php b/wp-includes/SimplePie/src/XML/Declaration/Parser.php
index 59a0d83eea..1fcd22b9f0 100644
--- a/wp-includes/SimplePie/src/XML/Declaration/Parser.php
+++ b/wp-includes/SimplePie/src/XML/Declaration/Parser.php
@@ -1,54 +1,14 @@
 <?php

-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 	* Redistributions of source code must retain the above copyright notice, this list of
- * 	  conditions and the following disclaimer.
- *
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
- * 	  provided with the distribution.
- *
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Sam Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- */
+// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
+// SPDX-License-Identifier: BSD-3-Clause
+
+declare(strict_types=1);

 namespace SimplePie\XML\Declaration;

 /**
  * Parses the XML Declaration
- *
- * @package SimplePie
- * @subpackage Parsing
  */
 class Parser
 {
@@ -138,7 +98,7 @@ class Parser
      * @access public
      * @param string $data Input data
      */
-    public function __construct($data)
+    public function __construct(string $data)
     {
         $this->data = $data;
         $this->data_length = strlen($this->data);
@@ -150,7 +110,7 @@ class Parser
      * @access public
      * @return bool true on success, false on failure
      */
-    public function parse()
+    public function parse(): bool
     {
         while ($this->state && $this->state !== self::STATE_EMIT && $this->has_data()) {
             $state = $this->state;
@@ -161,9 +121,10 @@ class Parser
             return true;
         }

-        $this->version = '';
-        $this->encoding = '';
-        $this->standalone = '';
+        // Reset the parser state.
+        $this->version = '1.0';
+        $this->encoding = 'UTF-8';
+        $this->standalone = false;
         return false;
     }

@@ -173,7 +134,7 @@ class Parser
      * @access private
      * @return bool true if there is further data, false if not
      */
-    public function has_data()
+    public function has_data(): bool
     {
         return (bool) ($this->position < $this->data_length);
     }
@@ -192,6 +153,8 @@ class Parser

     /**
      * Read value
+     *
+     * @return string|false
      */
     public function get_value()
     {
@@ -208,7 +171,7 @@ class Parser
         return false;
     }

-    public function before_version_name()
+    public function before_version_name(): void
     {
         if ($this->skip_whitespace()) {
             $this->state = self::STATE_VERSION_NAME;
@@ -217,7 +180,7 @@ class Parser
         }
     }

-    public function version_name()
+    public function version_name(): void
     {
         if (substr($this->data, $this->position, 7) === 'version') {
             $this->position += 7;
@@ -228,7 +191,7 @@ class Parser
         }
     }

-    public function version_equals()
+    public function version_equals(): void
     {
         if (substr($this->data, $this->position, 1) === '=') {
             $this->position++;
@@ -239,9 +202,10 @@ class Parser
         }
     }

-    public function version_value()
+    public function version_value(): void
     {
-        if ($this->version = $this->get_value()) {
+        if ($version = $this->get_value()) {
+            $this->version = $version;
             $this->skip_whitespace();
             if ($this->has_data()) {
                 $this->state = self::STATE_ENCODING_NAME;
@@ -253,7 +217,7 @@ class Parser
         }
     }

-    public function encoding_name()
+    public function encoding_name(): void
     {
         if (substr($this->data, $this->position, 8) === 'encoding') {
             $this->position += 8;
@@ -264,7 +228,7 @@ class Parser
         }
     }

-    public function encoding_equals()
+    public function encoding_equals(): void
     {
         if (substr($this->data, $this->position, 1) === '=') {
             $this->position++;
@@ -275,9 +239,10 @@ class Parser
         }
     }

-    public function encoding_value()
+    public function encoding_value(): void
     {
-        if ($this->encoding = $this->get_value()) {
+        if ($encoding = $this->get_value()) {
+            $this->encoding = $encoding;
             $this->skip_whitespace();
             if ($this->has_data()) {
                 $this->state = self::STATE_STANDALONE_NAME;
@@ -289,7 +254,7 @@ class Parser
         }
     }

-    public function standalone_name()
+    public function standalone_name(): void
     {
         if (substr($this->data, $this->position, 10) === 'standalone') {
             $this->position += 10;
@@ -300,7 +265,7 @@ class Parser
         }
     }

-    public function standalone_equals()
+    public function standalone_equals(): void
     {
         if (substr($this->data, $this->position, 1) === '=') {
             $this->position++;
@@ -311,7 +276,7 @@ class Parser
         }
     }

-    public function standalone_value()
+    public function standalone_value(): void
     {
         if ($standalone = $this->get_value()) {
             switch ($standalone) {
diff --git a/wp-includes/class-wp-simplepie-file.php b/wp-includes/class-wp-simplepie-file.php
index dcec8f95bc..5326e2db7c 100644
--- a/wp-includes/class-wp-simplepie-file.php
+++ b/wp-includes/class-wp-simplepie-file.php
@@ -75,6 +75,10 @@ class WP_SimplePie_File extends SimplePie\File {
 			} else {
 				$this->headers = wp_remote_retrieve_headers( $res );

+				if ( $this->headers instanceof \WpOrg\Requests\Utility\CaseInsensitiveDictionary ) {
+					$this->headers = $this->headers->getAll();
+				}
+
 				/*
 				 * SimplePie expects multiple headers to be stored as a comma-separated string,
 				 * but `wp_remote_retrieve_headers()` returns them as an array, so they need
diff --git a/wp-includes/feed.php b/wp-includes/feed.php
index 2c5446345e..421bee7173 100644
--- a/wp-includes/feed.php
+++ b/wp-includes/feed.php
@@ -812,7 +812,8 @@ function fetch_feed( $url ) {

 	$feed = new SimplePie\SimplePie();

-	$feed->set_sanitize_class( 'WP_SimplePie_Sanitize_KSES' );
+	$feed->get_registry()->register( SimplePie\Sanitize::class, 'WP_SimplePie_Sanitize_KSES', true );
+
 	/*
 	 * We must manually overwrite $feed->sanitize because SimplePie's constructor
 	 * sets it before we have a chance to set the sanitization class.
@@ -829,7 +830,7 @@ function fetch_feed( $url ) {
 		$feed->set_cache_class( 'WP_Feed_Cache' );
 	}

-	$feed->set_file_class( 'WP_SimplePie_File' );
+	$feed->get_registry()->register( SimplePie\File::class, 'WP_SimplePie_File', true );

 	$feed->set_feed_url( $url );
 	/** This filter is documented in wp-includes/class-wp-feed-cache-transient.php */
diff --git a/wp-includes/version.php b/wp-includes/version.php
index c6d73bebb6..3da4ecb5dd 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '6.9-alpha-60770';
+$wp_version = '6.9-alpha-60771';

 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.