Conversation
supportPHP Warning (Attempt to read property “childNodes” on null) in simple-html-to-markdown.php Hi there, I noticed a PHP warning in my server logs caused by the Meerkat Markdown for AI Visibility plugin. The error occurs under PHP 8.5.x when the HTML-to-Markdown parser encounters an unexpected or empty node. Error Log: Plaintext [proxy_fcgi:error] AH01071: Got error 'PHP message: PHP Warning: Attempt to read property "childNodes" on null in /wp-content/plugins/meerkat-markdown-for-ai-visibility/includes/simple-html-to-markdown.php on line 50; PHP message: PHP Warning: foreach() argument must be of type array|object, null given in /wp-content/plugins/meerkat-markdown-for-ai-visibility/includes/simple-html-to-markdown.php on line 50' Cause: In includes/simple-html-to-markdown.php , the method process_nodes( $node ) receives $node which can sometimes be null (either on the initial call or during recursion). Line 50 tries to access $node->childNodes directly without validating the variable first. Suggested Fix: Adding a simple guard clause at the very beginning of the process_nodes function resolves the issue cleanly: PHP private function process_nodes( $node ) { if ( ! $node ) { return ''; } $markdown = ''; foreach ( $node->childNodes as $child ) { // ... rest of the code Could you please include a null-check in the next plugin update to prevent these warnings from flooding the logs? Thank you for your great work! Best regards, Frank
No comments were stored for this source.