Problem with "PHP Warning: Trying to access array offset on value of type int in"
one text
I am getting this problem in my php 8.0 log file in wordpress:
PHP Warning: Trying to access array offset on value of type int in /home/(the domain)/public_html/wp-includes/class-wp-list-util.php on line 170
When I check that file in that line, this is what i see:
* corresponding to `$index_key`. If `$index_key` is null, array keys from the original
* `$list` will be preserved in the results.
*/
public function pluck( $field, $index_key = null ) {
$newlist = array();
if ( ! $index_key ) {
/*
* This is simple. Could at some point wrap array_column()
* if we knew we had an array of arrays.
*/
foreach ( $this->output as $key => $value ) {
if ( is_object( $value ) ) {
$newlist[ $key ] = $value->$field;
} else {
$newlist[ $key ] = $value[ $field ];
}
}
the line 170 is this :
$newlist[ $key ] = $value[ $field ];
Source