Als ik PHP 8 activeer krijg ik onderstaande foutmelding:
Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, non-static method Comment_Says_Custom_Text_Wrangler::comment_says_text() cannot be called statically in /home/vhosts/estrellaweb.nl/httpdocs/wp-includes/class-wp-hook.php:308 Stack trace: #0 /home/vhosts/estrellaweb.nl/httpdocs/wp-includes/plugin.php(205): WP_Hook->apply_filters('Nieuw bericht t...', Array) #1 /home/vhosts/estrellaweb.nl/httpdocs/wp-includes/l10n.php(199): apply_filters('gettext', 'Nieuw bericht t...', 'Add New Post', 'default') #2 /home/vhosts/estrellaweb.nl/httpdocs/wp-includes/l10n.php(299): translate('Add New Post', 'default') #3 /home/vhosts/estrellaweb.nl/httpdocs/wp-includes/class-wp-post-type.php(834): __('Add New Post') #4 /home/vhosts/estrellaweb.nl/httpdocs/wp-includes/post.php(1980): WP_Post_Type::get_default_labels() #5 /home/vhosts/estrellaweb.nl/httpdocs/wp-includes/class-wp-post-type.php(601): get_post_type_labels(Object(WP_Post_Type)) #6 /home/vhosts/estrellaweb.nl/httpdocs/wp-includes/class-wp-post-type.php(418): WP_Post_Type->set_props(Array) #7 /home/vhosts/estrellaweb.nl/httpdocs/wp-includes/post.php(1694): WP_Post_Type->__construct('post', Array) #8 /home/vhosts/estrellaweb.nl/httpdocs/wp-includes/post.php(43): register_post_type('post', Array) #9 /home/vhosts/estrellaweb.nl/httpdocs/wp-includes/class-wp-hook.php(308): create_initial_post_types('') #10 /home/vhosts/estrellaweb.nl/httpdocs/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array) #11 /home/vhosts/estrellaweb.nl/httpdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #12 /home/vhosts/estrellaweb.nl/httpdocs/wp-settings.php(617): do_action('init') #13 /home/vhosts/estrellaweb.nl/httpdocs/wp-config.php(76): require_once('/home/vhosts/es...') #14 /home/vhosts/estrellaweb.nl/httpdocs/wp-load.php(50): require_once('/home/vhosts/es...') #15 /home/vhosts/estrellaweb.nl/httpdocs/wp-blog-header.php(13): require_once('/home/vhosts/es...') #16 /home/vhosts/estrellaweb.nl/httpdocs/index.php(17): require('/home/vhosts/es...') #17 {main} thrown in /home/vhosts/estrellaweb.nl/httpdocs/wp-includes/class-wp-hook.php on line 308
Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, non-static method Comment_Says_Custom_Text_Wrangler::comment_says_text() cannot be called statically in /home/vhosts/estrellaweb.nl/httpdocs/wp-includes/class-wp-hook.php:308 Stack trace: #0 /home/vhosts/estrellaweb.nl/httpdocs/wp-includes/plugin.php(205): WP_Hook->apply_filters('Fout is niet ve...', Array) #1 /home/vhosts/estrellaweb.nl/httpdocs/wp-includes/l10n.php(199): apply_filters('gettext', 'Fout is niet ve...', 'Error not cause...', 'default') #2 /home/vhosts/estrellaweb.nl/httpdocs/wp-includes/l10n.php(299): translate('Error not cause...', 'default') #3 /home/vhosts/estrellaweb.nl/httpdocs/wp-includes/class-wp-recovery-mode.php(173): __('Error not cause...') #4 /home/vhosts/estrellaweb.nl/httpdocs/wp-includes/class-wp-fatal-error-handler.php(53): WP_Recovery_Mode->handle_error(Array) #5 [internal function]: WP_Fatal_Error_Handler->handle() #6 {main} thrown in /home/vhosts/estrellaweb.nl/httpdocs/wp-includes/class-wp-hook.php on line 308Als ik WP_DEBUG inschakel (terwijl de server op PHP 7.4 draait) krijg ik deze foutmelding..
Deprecated: Non-static method Comment_Says_Custom_Text_Wrangler::comment_says_text() should not be called statically in /home/vhosts/estrellaweb.nl/httpdocs/wp-includes/class-wp-hook.php on line 308
Die bewuste regel in class-wp-hook.php laat dit zien:
$value = call_user_func_array( $the_['function'], $args );
Dit gaf mij het idee dat het mis gaat met het aanroepen van de functies. Het stukje 'comment_says_text' komt ook voor in de functions.php van mijn thema, dat is deze functie:
/* remove/change 'says' in comments // alchymyth 2011 */
class Comment_Says_Custom_Text_Wrangler {
function comment_says_text($translation, $text, $domain) {
$new_says = ' '; //whatever you want to have instead of 'says' in comments
$translations = &get_translations_for_domain( $domain );
if ( $text == '<cite class="fn">%s</cite> <span class="says">says:</span>' ) {
if($new_says) $new_says = ' '.$new_says; //compensate for the space character
return $translations->translate( '<cite class="fn">%s</cite><span class="says">'.$new_says.'</span>' );
} else {
return $translation; // standard text
}
}Hier moet dus iets mis mee zijn, al heb ik geen idee of dit het enige is of niet.
Hoop heel erg dat iemand me hiermee kan helpen, want zelf kom ik er helaas niet uit.
Bij voorbaat dank!