Fatal error: Uncaught TypeError: Unsupported operand types: string & int

Support MB Custom Post Type Fatal error: Uncaught TypeError: Unsupported operand types: string & intResolved

  • This topic has 3 replies, 2 voices, and was last updated 1 year ago by AMXAMX.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #45137
    AMXAMX
    Participant

    Hi,

    I am experiencing some issues with migrating one site from PHP 7.4 to PHP 8.1 / 8.2

    I have fixed most issues, but going to Settings -> Permalinks causes a white screen. I have narrowed it down, and it happens when MB Custom Post Type (from MB AIO) is activated. I get this debug info:

    Fatal error: Uncaught TypeError: Unsupported operand types: string & int in /home/xxxxx/public_html/wp-includes/class-wp-rewrite.php:1036 Stack trace: #0 /home/xxxxx/public_html/wp-includes/class-wp-rewrite.php(1410): WP_Rewrite->generate_rewrite_rules() #1 /home/xxxxx/public_html/wp-includes/class-wp-rewrite.php(1509): WP_Rewrite->rewrite_rules() #2 /home/xxxxx/public_html/wp-includes/class-wp-rewrite.php(1884): WP_Rewrite->refresh_rewrite_rules() #3 /home/xxxxx/public_html/wp-includes/rewrite.php(282): WP_Rewrite->flush_rules() #4 /home/xxxxx/public_html/wp-admin/options-permalink.php(212): flush_rewrite_rules() #5 {main} thrown in /home/xxxxx/public_html/wp-includes/class-wp-rewrite.php on line 1036
    
    There has been a critical error on this website. Please check your site admin email inbox for instructions.
    

    Everything works fine in PHP 7.4. But upgrading to 8.1 or 8.2 with MB Custom Post Type causes this error. I tested on Cloudways and in LocalWP.

    Greetings,
    Tom

    #45138
    AMXAMX
    Participant

    The site was migrated from Toolset to Meta Box some time ago, if that matters.

    #45145
    PeterPeter
    Moderator

    Hello,

    According to the error message Fatal error: Uncaught TypeError: Unsupported operand types: string & int in /home/xxxxx/public_html/wp-includes/class-wp-rewrite.php:1036

    this is the code in the file class-wp-rewrite.php line 1036
    if ( EP_PAGES & $ep_mask || EP_PERMALINK & $ep_mask ) {

    it relates to the post type setting ep_mask that is not supported by MB CPT. Please try to delete the current CPT and re-create it manually with the same slug and settings and check the issue again.

    Following the documentation https://developer.wordpress.org/reference/functions/register_post_type/

    #45149
    AMXAMX
    Participant

    Thanks! It seems to working now.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.