Widgets: Use `isset()` in `WP_Widget:: display_callback()` to support `ArrayIterator` and `ArrayObject`.
[33696] introduced support returning `ArrayIterator` and `ArrayObject` objects from `WP_Widget::get_settings()`. Per the PHP manual, `array_key_exists()` stopped supporting this in PHP 8.0.0 and deprecated in PHP 7.4.0. >For backward compatibility reasons, array_key_exists() will also return true if key is a property defined within an object given as array. This behaviour is deprecated as of PHP 7.4.0, and removed as of PHP 8.0.0. This commit uses `isset()` instead of `array_key_exists()` which is supported on all current versions of PHP. Includes unit tests. Ref: * https://www.php.net/manual/en/function.array-key-exists.php#refsect1-function.array-key-exists-notes Follow-up to [32602], [33696]. Props dlh, hellofromTonya, jrf, sergeybiryukov. Fixes #52728. Built from https://develop.svn.wordpress.org/trunk@52173 git-svn-id: http://core.svn.wordpress.org/trunk@51765 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9cb60e437f
commit
df4834caea
|
@ -365,7 +365,7 @@ class WP_Widget {
|
|||
$this->_set( $widget_args['number'] );
|
||||
$instances = $this->get_settings();
|
||||
|
||||
if ( array_key_exists( $this->number, $instances ) ) {
|
||||
if ( isset( $instances[ $this->number ] ) ) {
|
||||
$instance = $instances[ $this->number ];
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.9-alpha-52172';
|
||||
$wp_version = '5.9-alpha-52173';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue