Closed dougaxe1 closed 2 months ago
Seems to be a php 8+ bug
7.4 warnings:
PHP Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in /Users/jerryprice/Sites/bn/wp-content/plugins/stream/classes/class-cli.php on line 137
This should be fixed by #1437 in the 4.0.1 release.
Bug Report
The issue is inside
\WP_Stream\CLI->query()
:wp_stream_get_instance()->db->query()
calls\WP_Stream\Query->query()
:Results from
$wpdb->get_results( $query )
default to$output
ofOBJECT
. Line 137 of class-cli.php then callsarray_key_exists( $field, $record )
where $record is an object instead of an array.Possible Fixes
$wpdb->get_results( $query, ARRAY_A )
in\WP_Stream\Query->query()
property_exists( $record, $field )
instead of array_key_exists in\WP_Stream\CLI->query()
Expected Behavior
Run the
query
WP-CLI stream command:Actual Behavior
Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, stdClass given
.../wp-content/plugins/stream/classes/class-cli.php(137): array_key_exists()
Steps to Reproduce the Problem
wp stream query
via WP-CLISystem Information