Conversation
supportSimilar to https://wordpress.org/support/topic/php-warnings-168/ I am getting a PHP error [25-Jul-2024 19:56:58 UTC] PHP Notice: Trying to get property 'comment_ID' of non-object in /wp-content/plugins/urvanov-syntax-highlighter/class-urvanov-syntax-highlighter-plugin.php on line 743 [25-Jul-2024 19:56:58 UTC] PHP Notice: Trying to get property 'comment_ID' of non-object in wp-content/plugins/urvanov-syntax-highlighter/class-urvanov-syntax-highlighter-plugin.php on line 753 Plugin Version 2.8.36 PHP Version 7.4.33 WordPress 6.6.1 Looks to be related to these two functions: public static function pre_comment_text($text, $comment, $args ) { $comment_id = strval($comment->comment_ID); if (array_key_exists($comment_id, self::$comment_captures)) { // Replace with IDs now that we need to $text = self::$comment_captures[$comment_id]; } return $text; } public static function comment_text($text) { global $comment; $comment_id = strval($comment->comment_ID); // Find if this post has Crayons if (array_key_exists($comment_id, self::$comment_queue)) { // XXX We want the plain post content, no formatting $the_content_original = $text; // Loop through Crayons $post_in_queue = self::$comment_queue[$comment_id]; foreach ($post_in_queue as $id => $v) { $atts = $v['atts']; $content = $v['code']; // The code we replace post content with $crayon = self::shortcode($atts, $content, $id); $crayon_formatted = $crayon->output(TRUE, FALSE); // Replacing may cause <p> tags to become disjoint with a <div> inside them, close and reopen them if needed if (!$crayon->is_inline()) { $text = preg_replace_callback('#' . self::REGEX_BETWEEN_PARAGRAPH_SIMPLE . '#msi', 'Urvanov_Syntax_Highlighter_Plugin::add_paragraphs', $text); } // Replace the code with the Crayon $text = UrvanovSyntaxHighlighterUtil::preg_replace_escape_back(self::regex_with_id($id), $crayon_formatted, $text, 1, $text); } } return $text; }
Thank you for reporting. I will try to investigate this problem. I thought I fixed it last time.
That would be great, thank you.
Fixed in 2.8.37. I hope.
New error, not sure if it is our end or not, but comes up. [05-Aug-2024 04:09:05 UTC] PHP Notice: Trying to get property 'ID' of non-object in /home/xxxx/public_html/wp-content/plugins/urvanov-syntax-highlighter/class-urvanov-syntax-highlighter-plugin.php on line 696
Thank you for reporting. I will try to investigate this problem. I thought I fixed it last time.
That would be great, thank you.
Fixed in 2.8.37. I hope.
New error, not sure if it is our end or not, but comes up. [05-Aug-2024 04:09:05 UTC] PHP Notice: Trying to get property 'ID' of non-object in /home/xxxx/public_html/wp-content/plugins/urvanov-syntax-highlighter/class-urvanov-syntax-highlighter-plugin.php on line 696