• Resolved todesengel

    (@todesengel)


    I was trying to edit a comment, from within the admin panel > comments. When I attempt to save, I get an error. After checking the debug.log Apache error.log this is the error.

    [Tue Feb 09 21:31:50.924685 2021] [php7:notice] [pid 10034] [client xxx.xxx.xxx.xxx:57071] PHP Notice: Trying to get property ‘ID’ of non-object in /var/www/html/wp-content/plugins/automatic-featured-images-from-videos/automatic-featured-images-from-videos.php on line 475, referer: https://www.website.com/wp-admin/edit-comments.php

    Any ideas?

    • This topic was modified 3 years, 9 months ago by todesengel.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support Michael Beckwith

    (@tw2113)

    The BenchPresser

    Is that the only error? or are you kind of getting a general “Your site experienced an error” and this is the only thing in the log at the moment? Asking because while we’ll definitely want to get that one prevented, it shouldn’t be preventing saving and processing of your editing as a whole.

    For a quick fix, and if you’re willing to hotfix edit the plugin yourself, you can add the following to around line 475:

    if ( ! isset( $post ) ) {
    	return;
    }
    

    Making the whole function read as such:

    function wds_register_display_video_metabox() {
    	global $post;
    
    	if ( ! isset( $post ) ) {
    		return;
    	}
    
    	if ( get_post_meta( $post->ID, '_is_video', true ) ) {
    		add_meta_box(
    			'wds_display_video_urls_metabox',
    			esc_html__( 'Video Files found in Content', 'wds-automatic-featured-images-from-video' ),
    			'wds_video_thumbnail_meta'
    		);
    	}
    }
    
    Thread Starter todesengel

    (@todesengel)

    Hello,

    This only occurs when I’m inside the admin panel > comments and attempt to edit. I have also updated my original post, I made a mistake. This error is from apache error.log, not the debug.log. The debug.log did not generate any errors when I turned on debug mode and attempted to edit a comment.

    I added your hotfix to the function and I attempted another test, but it still fails to edit the comment.

    Plugin Support Michael Beckwith

    (@tw2113)

    The BenchPresser

    Beyond that, I couldn’t begin to guess what’s going on and why things are failing here. Perhaps enable WP_DEBUG and WP_DEBUG_DISPLAY to try and get some extra information.

    Adding these to your wp-config.php could help get things figured out.

    define( 'WP_DEBUG', true );
    define( 'WP_DEBUG_DISPLAY', false );
    define( 'WP_DEBUG_LOG', true );
    

    More information about these PHP constants can be found at https://www.ads-software.com/support/article/debugging-in-wordpress/

    Thread Starter todesengel

    (@todesengel)

    Hi,

    Unfortunately, with debug options turned on it would not create a debug.log file no matter how I edited or saved the comments.

    I did find it is limited to only affecting comments on certain post types. IE Events.

    ————————————————————–
    I doubt these will help but its all the info I got.

    Browser Debug when saving a comment
    XML Parsing Error: XML or text declaration not at start of entity
    Location: https://www.website.com/wp-admin/edit-comments.php
    Line Number 2, Column 1:

    [Tue Feb 09 21:31:50.924685 2021] [php7:notice] [pid 10034] [client xxx.xxx.xxx.xxx:57071] PHP Notice: Trying to get property ‘ID’ of non-object in /var/www/html/wp-content/plugins/automatic-featured-images-from-videos/automatic-featured-images-from-videos.php on line 475, referer: https://www.website.com/wp-admin/edit-comments.php

    Plugin Support Michael Beckwith

    (@tw2113)

    The BenchPresser

    Hmm, that first part actually feels promising. It seems like something somehow is trying to output some XML perhaps, and it’s not quite right and thus throwing potentially breaking errors.

    I do note that you hotfixed things above for our part, but I’m wondering if other things are still throwing their own errors.

    This feels like a longshot, but perhaps try setting these in your wp-config.php

    define( ‘WP_DEBUG_DISPLAY’, false );
    @ini_set( ‘display_errors’, 0 );
    @error_reporting( 0 );

    I’m just hoping it helps a little.

    Thread Starter todesengel

    (@todesengel)

    Hi,

    It looks like it’s all pointing to another plugin that I use for my events.

    I added those debug options, and it did not create debug.log, but there are more errors in the apache.log

    [Wed Feb 10 01:11:22.598886 2021] [php7:warn] [pid 12050] [client xxx.xxx.xxx.xxx:60464] PHP Warning: Use of undefined constant \x91WP_DEBUG_DISPLAY\x92 – assumed ‘\x91WP_DEBUG_DISPLAY\x92’ (this will throw an Error in a future version of PHP) in /var/www/html/wp-config.php on line 87, referer: https://www.website.com/events/eventname/?rid=460

    [Wed Feb 10 01:12:45.772662 2021] [php7:warn] [pid 12933] [client xxx.xxx.xxx.xxx:60503] PHP Warning: Use of undefined constant \x91WP_DEBUG_DISPLAY\x92 – assumed ‘\x91WP_DEBUG_DISPLAY\x92’ (this will throw an Error in a future version of PHP) in /var/www/html/wp-config.php on line 87, referer: https://www.website.com/wp-admin/edit-comments.php

    • This reply was modified 3 years, 9 months ago by todesengel.
    Plugin Support Michael Beckwith

    (@tw2113)

    The BenchPresser

    bah, caught by the “fancy” quotes. Try the version below.

    define( 'WP_DEBUG_DISPLAY', false );
    @ini_set( 'display_errors', 0 );
    @error_reporting( 0 );
    

    I’m putting it in code block this time which should prevent fancy quotes. Note how the errors included “\x91” and “\x92”

    Plugin Support Michael Beckwith

    (@tw2113)

    The BenchPresser

    This should be getting better addressed in version 1.2.0

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Error when trying to edit comments’ is closed to new replies.