• Resolved audioscavenger

    (@audioscavenger)


    hey Steven

    I use your plugin because it’s so useful, many thanks.

    1) However I recently noticed a lot of PHP errors showing up here and there:

    
    Notice: Undefined index: _ez_toc_nonce in /path/site.com/wp-content/plugins/easy-table-of-contents/includes/class.admin.php on line 340
    

    bugfix class.admin.php on line 340:
    .. && array_key_exists('_ez_toc_nonce', $_REQUEST) ..

    
    [25-Feb-2018 03:05:28 UTC] PHP Notice:  Trying to get property of non-object in /path/site.com/wp-content/plugins/easy-table-of-contents/easy-table-of-contents.php on line 594
    [25-Feb-2018 03:05:28 UTC] PHP Notice:  Trying to get property of non-object in /path/site.com/wp-content/plugins/easy-table-of-contents/easy-table-of-contents.php on line 595
    [25-Feb-2018 03:05:28 UTC] PHP Notice:  Trying to get property of non-object in /path/site.com/wp-content/plugins/easy-table-of-contents/easy-table-of-contents.php on line 596
    [25-Feb-2018 03:05:28 UTC] PHP Notice:  Trying to get property of non-object in /path/site.com/wp-content/plugins/easy-table-of-contents/easy-table-of-contents.php on line 844
    [25-Feb-2018 03:05:28 UTC] PHP Notice:  Trying to get property of non-object in /path/site.com/wp-content/plugins/easy-table-of-contents/easy-table-of-contents.php on line 883
    [25-Feb-2018 03:05:28 UTC] PHP Notice:  Trying to get property of non-object in /path/site.com/wp-content/plugins/easy-table-of-contents/easy-table-of-contents.php on line 887
    

    Is it because of PHP 7? Or is it because of https? Or have you pushed some untested changes in your code?
    I could correct that myself but that would defeat the purpose of relying on plugins to do a job we publishers do not want to do.

    2) why is your plugin active in the admin area at all?

    Please let me know if I can help and if you need more log extracts!

    best regards

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Steven

    (@shazahm1hotmailcom)

    @audioscavenger

    RE: Is it because of PHP 7?

    ezTOC is developed on an instance of PHP 7.1.x with debugging set to show and log notices and errors. I do not receive this notice in testing:

    Notice: Undefined index: _ez_toc_nonce in ../wp-content/plugins/easy-table-of-contents/includes/class.admin.php on line 340

    It should not be possible for _ez_toc_nonce not to be set in this instance because the save callback is only invoked on post types for which support has been enabled in the settings.

    So something is a miss… the metabox is not being rendered on the post type in which support has been enabled. Are you perhaps using another plugin or other technique to suppress the ezTOC metabox on a post type for which you have enabled support for?

    Or is it because of https?

    No.

    RE: Or have you pushed some untested changes in your code?

    No. There have been no changes surrounding the code for the metaboxes and saving their values to post meta since the original release.

    RE: why is your plugin active in the admin area at all?

    Hmmm… how do you think settings are done or the post type metabox added??? It has to run in the admin. It only runs under those specific circumstances. Even the CSS/JavaScript is loaded only on the pages where needed.

    You can verify this yourself in the class.admin.php file within the hook() and registerMetaboxes() methods.

    In regards to the PHP Notice: Trying to get property of non-object notices

    I belive it may be related to this as reported in another support thread:
    https://wordpress.org/support/topic/error-on-save-update-post/

    I’m fairly certain this is because Yoast SEO applies the_content filter in the admin context for its link checker when saving the post. These notices, I think, would occur because the code for ezTOC is designed to only run within the loop context.

    The odd thing is… I run Yoast SEO on both my dev and live eCommerce site with ezTOC and I do not receive these error notices. My live site is set to log all PHP error messages and notices to a non-public accessible folder on the server.

    I’ve asked others to open a support ticket regarding this specific issue. Unfortunately none has so that limits my ability to help track down and resolve.

    No sure if this helps, but I hope it does in some way.

    Steven

    (@shazahm1hotmailcom)

    These should not longer present themselves after the next update due to changes in the code to harden against them. Marking resolved 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘many PHP errors’ is closed to new replies.