Notice в служебном файле wordpress
Скажите что это за функция? которая располагается в файле wp-includes/class-wp-list-util.php
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 {
*161* $newlist[ $key ] = $value[ $field ];
}
}
$this->output = $newlist;
return $this->output;
}
/*
* When index_key is not set for a particular item, push the value
* to the end of the stack. This is how array_column() behaves.
*/
foreach ( $this->output as $value ) {
if ( is_object( $value ) ) {
if ( isset( $value->$index_key ) ) {
$newlist[ $value->$index_key ] = $value->$field;
} else {
$newlist[] = $value->$field;
}
} else {
if ( isset( $value[ $index_key ] ) ) {
$newlist[ $value[ $index_key ] ] = $value[ $field ];
} else {
$newlist[] = $value[ $field ];
}
}
}
$this->output = $newlist;
return $this->output;
}
не могу понять почему я получаю такую ошибку на некоторый страницах сайта
Notice: Trying to access array offset on value of type int in /home/..../..../..../wp-includes/class-wp-list-util.php on line 161
Версия php 7.4.3
Если добавить в эту строку проверку на нулевое значение ?? null ошибка исчезает, но это не правильно же менять файлы ядра, т.к. после обновления все слетит. Где искать причину?