• Hello, I’m currently using the updated version of Webcomic and getting the following error:

    Fatal error: Uncaught TypeError: Argument 2 passed to Mgsisk\Webcomic\Restrict\hook_comic_title() must be of the type integer, string given, called in /home/astromon/public_html/wp-includes/class-wp-hook.php on line 286 and defined in /home/astromon/public_html/wp-content/plugins/webcomic/lib/restrict/common.php:98 Stack trace: #0 /home/astromon/public_html/wp-includes/class-wp-hook.php(286): Mgsisk\Webcomic\Restrict\hook_comic_title('<img class="wpm...', 'wpml-ls-7-es') #1 /home/astromon/public_html/wp-includes/plugin.php(203): WP_Hook->apply_filters('<img class="wpm...', Array) #2 /home/astromon/public_html/wp-includes/class-walker-nav-menu.php(204): apply_filters('the_title', '<img class="wpm...', 'wpml-ls-7-es') #3 /home/astromon/public_html/wp-includes/class-wp-walker.php(145): Walker_Nav_Menu->start_el('<li id="menu-it...', Object(WPML_LS_Menu_Item), 0, Object(stdClass)) #4 /home/astromon/public_html/wp-includes/class-wp-walker.php(243): Walker->display_element(Object(WPML_LS_Menu_Item), Array, 0, 0, Array, '<li id= in /home/astromon/public_html/wp-content/plugins/webcomic/lib/restrict/common.php on line 98
    

    Please note that this error was occurring before version 5.0.0 and if I deactivate the plugin everything goes back to normal.

    Any help you can provide in this case will be greatly appreciated. Thanks!

    Luis

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mike

    (@mgsisk)

    Apologies for the trouble, @astromono. I understand the error, but I’m not sure what the best fix is here…?the problem is that Webcomic is expecting an integer post ID, but it looks like WPML is somehow using string post ID’s. As a temporary fix, try opening up /wp-content/pugins/webcomic/lib/restrict/common.php and changing lines 98 and 99:

    
    function hook_comic_title( string $title, int $id ) : string {
    	if ( is_a_webcomic( $id ) && ( webcomic_roles_required( $id ) || webcomic_age_required( $id ) ) ) {
    

    to this:

    
    function hook_comic_title( string $title, $id ) : string {
    	preg_match('/-(\d+)-/', $id, $match);
    	
    	if ($match) {
    		$id = (int) $match[1];
    	}
    	
    	if ( is_a_webcomic( $id ) && ( webcomic_roles_required( $id ) || webcomic_age_required( $id ) ) ) {
    

    I believe that’ll fix the error in this case, though I’m not sure this is a good long-term solution so the next Webcomic update might undo your changes. As a premium plugin I don’t have access to WPML, unfortunately, so I’m not entirely sure why it uses string post ID’s or if they’re consistent enough for this to work in all situations.

    As an alternative, disabling the Restrict component (assuming you aren’t actually using it) should also “correct” the issue.

    Thread Starter astromono

    (@astromono)

    Hi, Mike!

    Thanks for the quick reply on this. I made the changes you suggested, but found that the issue wasn’t resolved. Instead I got a new error message with line 355 now being the culprit:

    Fatal error: Uncaught TypeError: Argument 2 passed to Mgsisk\Webcomic\Transcribe\hook_get_transcript_title() must be of the type integer, string given, called in /home/astromon/public_html/wp-includes/class-wp-hook.php on line 286 and defined in /home/astromon/public_html/wp-content/plugins/webcomic/lib/transcribe/common.php:366 Stack trace: #0 /home/astromon/public_html/wp-includes/class-wp-hook.php(286): Mgsisk\Webcomic\Transcribe\hook_get_transcript_title('<img class="wpm...', 'wpml-ls-7-es') #1 /home/astromon/public_html/wp-includes/plugin.php(203): WP_Hook->apply_filters('<img class="wpm...', Array) #2 /home/astromon/public_html/wp-includes/class-walker-nav-menu.php(204): apply_filters('the_title', '<img class="wpm...', 'wpml-ls-7-es') #3 /home/astromon/public_html/wp-includes/class-wp-walker.php(145): Walker_Nav_Menu->start_el('<li id="menu-it...', Object(WPML_LS_Menu_Item), 0, Object(stdClass)) #4 /home/astromon/public_html/wp-includes/class-wp-walker.php(243): Walker->display_element(Object(WPML_LS_Menu_Item), Arr in /home/astromon/public_html/wp-content/plugins/webcomic/lib/transcribe/common.php on line 366

    I also tried disabling the Restrict component prior to making the changes in the common.php file, but this didn’t solve the issue either. I hope this information helps in figuring out how to solve it!

    Thanks again for your support!

    Luis

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Fatal Error On Update’ is closed to new replies.