• Resolved matke1984

    (@matke1984)


    As the title says, I got this warning when I upgraded my server from PHP 7.4 to PHP 8.1. To eliminate this warning, I tried the following:

    1. I turned off all addons and put the default wordpress theme. The warning still occurs.
    2. I reinstalled wordpress 6.6.1. The warning still occurs.

    Everything is with the latest updates. Any idea what else I should try and why this problem occurs. Thanks in advance for your help.

Viewing 15 replies - 1 through 15 (of 16 total)
  • Moderator James Huff

    (@macmanx)

    Try downloading WordPress again, access your server via SFTP or FTP, or a file manager in your hosting account’s control panel (consult your hosting provider’s documentation for specifics on these), and delete then replace your copies of everything on the server except the wp-config.php file and the /wp-content/ directory with fresh copies from the download. This will effectively replace all of your core files without damaging your content and settings.

    If you’d like to manually make a backup of your site first, please follow the steps at https://www.ads-software.com/documentation/article/wordpress-backups/

    Some uploaders tend to be unreliable when overwriting files, so don’t forget to delete the original files before replacing them.

    Thread Starter matke1984

    (@matke1984)

    Unfortunately, this didn’t help either. I don’t know what else to try. Everything points to some plugin, but it turns out that it isn’t. Do you have any suggestion?

    Moderator James Huff

    (@macmanx)

    What version of PHP are you running?

    Thread Starter matke1984

    (@matke1984)

    8.1.29

    Moderator James Huff

    (@macmanx)

    And, just to check again, you reinstalled the core files, you deactivated all plugins, and you switched to the Twenty Twenty-Four theme?

    Because, I’m unable to reproduce the problem with a fresh WordPress 6.6.1 install under PHP 8.1.29.

    Thread Starter matke1984

    (@matke1984)

    Yes. I turned off literally all addons and switched the theme to Twenty Twenty-Four. And I was convinced that the error would disappear. I did the reinstallation in the standard way first and then as you told me with the deletion of files.

    I didn’t mention that the error appears when I go to the add new addon page and that without debug enabled.

    I don’t know what else to try? I haven’t noticed any problems with the site, but I don’t like having any kind of error. How serious is this problem and how can it manifest itself in the work of the site?

    Moderator James Huff

    (@macmanx)

    when I go to the add new addon page?

    Do you mean Plugins > Add New in your Dashboard?

    How serious is this problem and how can it manifest itself in the work of the site?

    I don’t know, I haven been able to reproduce the issue at all, and you haven’t quoted the full error message.

    Thread Starter matke1984

    (@matke1984)

    There is nothing in debug log except this one line.

    Warning: Undefined property: stdClass::$plugin in /home/xxxxxxxxx/public_html/us/wp-includes/class-wp-list-util.php on line 168

    Moderator James Huff

    (@macmanx)

    You only ever see it in the debug log, not in the Dashboard itself?

    Thread Starter matke1984

    (@matke1984)

    In the Dashboard too.

    plugins > add a new plugin

    Thread Starter matke1984

    (@matke1984)

    I think I solved the problem for now. I turned off all addons again. Then I went to the wordpress settings and changed the language from mine to English. The error is gone. Then I went back into settings and set it back to my language. There is still no error. Then I turned on all the addons at once. An error occurred. I repeated the complete procedure again but this time I turn on one by one addons. And there are no errors for now. But this definitely shouldn’t be like this and it seems like a bug in wordpress.

    Thread Starter matke1984

    (@matke1984)

    Unfortunately, it is not the solution to the problem. As I updated plugins, the error appeared again.

    Moderator James Huff

    (@macmanx)

    Very weird.

    I’m glad it’s gone for now, but if I run into it, I’ll do some more digging.

    Hi, I have the same problem.

    Under Plugins > add a new plugin

    I see 8 times this warning.

    Warning: Undefined property: stdClass::$plugin in /home/clients/xxxxxxxxxxxxxx/wp-includes/class-wp-list-util.php on line 168

    I’m using PHP 8.3.9 (tried with 8.0, 8.1, 8.2 the same warning)

    Update: found the problem on 4 plugin, I’m asking to developer.

    • This reply was modified 2 months, 3 weeks ago by lluca. Reason: found problem

    The error you reported appears to occur because the script is trying to access a property of an object that does not exist or is not well defined. To resolve this issue, you can add additional checks to ensure the $field property exists before trying to access it. Here’s how you can adjust the code:

    1. Added property existence check:

    You can use the property_exists() function to check if the $value object has the $field property. Similarly, for arrays, you can use array_key_exists() to check for key existence.

    1. Editing the code with additional checks:

    Here’s how you can modify the code to properly handle these checks:

    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 ) ) {

    ? ? ? ? ? ? ? ? ? ? // Vérifie si la propriété $field existe dans l'objet $value

    ? ? ? ? ? ? ? ? ? ? if (property_exists($value, $field)) {

    ? ? ? ? ? ? ? ? ? ? ? ? $newlist[ $key ] = $value->$field;

    ? ? ? ? ? ? ? ? ? ? } else {

    ? ? ? ? ? ? ? ? ? ? ? ? // Affiche un message d'erreur de debug si la propriété n'existe pas

    ? ? ? ? ? ? ? ? ? ? ? ? error_log("La propriété '$field' n'existe pas dans l'objet.");

    ? ? ? ? ? ? ? ? ? ? }

    ? ? ? ? ? ? ? ? } elseif ( is_array( $value ) ) {

    ? ? ? ? ? ? ? ? ? ? // Vérifie si la clé $field existe dans le tableau $value

    ? ? ? ? ? ? ? ? ? ? if (array_key_exists($field, $value)) {

    ? ? ? ? ? ? ? ? ? ? ? ? $newlist[ $key ] = $value[ $field ];

    ? ? ? ? ? ? ? ? ? ? } else {

    ? ? ? ? ? ? ? ? ? ? ? ? // Affiche un message d'erreur de debug si la clé n'existe pas

    ? ? ? ? ? ? ? ? ? ? ? ? error_log("La clé '$field' n'existe pas dans le tableau.");

    ? ? ? ? ? ? ? ? ? ? }

    ? ? ? ? ? ? ? ? } else {

    ? ? ? ? ? ? ? ? ? ? // Log de l'erreur si la valeur n'est ni un objet ni un tableau

    ? ? ? ? ? ? ? ? ? ? _doing_it_wrong(

    ? ? ? ? ? ? ? ? ? ? ? ? __METHOD__,

    ? ? ? ? ? ? ? ? ? ? ? ? __( 'Values for the input array must be either objects or arrays.' ),

    ? ? ? ? ? ? ? ? ? ? ? ? '6.2.0'

    ? ? ? ? ? ? ? ? ? ? );

    ? ? ? ? ? ? ? ? }

    ? ? ? ? ? ? }

    ? ? ? ? ? ? $this->output = $newlist;

    ? ? ? ? ? ? return $this->output;

    ? ? ? ? }

    Explications des modifications :

    1. Vérification des objets : Utilisation de property_exists($value, $field) pour s’assurer que la propriété $field existe avant d’y accéder. Si elle n’existe pas, un message d’erreur est enregistré via error_log().
    2. Vérification des tableaux : Utilisation de array_key_exists($field, $value) pour vérifier que la clé $field existe dans le tableau $value. Si elle n’existe pas, un message d’erreur est enregistré.
    3. Journalisation des erreurs : error_log() est utilisé pour enregistrer des messages d’erreur dans le journal des erreurs de PHP, ce qui peut aider à diagnostiquer et comprendre le problème.
Viewing 15 replies - 1 through 15 (of 16 total)
  • You must be logged in to reply to this topic.