• Resolved xxxLesy

    (@xxxlesy)


    I get a fatal error on open any post after 4.2.0 update. Disabling CPR fixes it. Downgrading to 4.0.3 also fixes it.

    Fatal error: Uncaught TypeError: Unsupported operand types: string * int in /var/www/vhosts/nascasopis.si/httpdocs/wp-content/plugins/contextual-related-posts/includes/class-crp-core-query.php:484 Stack trace: #0 /var/www/vhosts/nascasopis.si/httpdocs/wp-content/plugins/contextual-related-posts/includes/class-crp-core-query.php(152): WebberZone\Contextual_Related_Posts\CRP_Core_Query->prepare_query_args() #1 /var/www/vhosts/nascasopis.si/httpdocs/wp-content/plugins/contextual-related-posts/includes/class-crp-query.php(36): WebberZone\Contextual_Related_Posts\CRP_Core_Query->__construct() #2 /var/www/vhosts/nascasopis.si/httpdocs/wp-content/plugins/contextual-related-posts/includes/frontend/class-display.php(304): CRP_Query->__construct() #3 /var/www/vhosts/nascasopis.si/httpdocs/wp-content/plugins/contextual-related-posts/includes/frontend/class-display.php(137): WebberZone\Contextual_Related_Posts\Frontend\Display::get_posts() #4 /var/www/vhosts/nascasopis.si/httpdocs/wp-content/plugins/contextual-related-posts/includes/functions.php(24): WebberZone\Contextual_Related_Posts\Frontend\Display::related_posts() #5 /var/www/vhosts/nascasopis.si/httpdocs/wp-content/plugins/contextual-related-posts/includes/frontend/blocks/class-blocks.php(125): get_crp() #6 /var/www/vhosts/nascasopis.si/httpdocs/wp-includes/class-wp-block.php(599): WebberZone\Contextual_Related_Posts\Frontend\Blocks\Blocks::render_block_related_posts() #7 /var/www/vhosts/nascasopis.si/httpdocs/wp-includes/class-wp-block.php(579): WP_Block->render() #8 /var/www/vhosts/nascasopis.si/httpdocs/wp-includes/class-wp-block.php(579): WP_Block->render() #9 /var/www/vhosts/nascasopis.si/httpdocs/wp-includes/class-wp-block.php(579): WP_Block->render() #10 /var/www/vhosts/nascasopis.si/httpdocs/wp-includes/class-wp-block.php(579): WP_Block->render() #11 /var/www/vhosts/nascasopis.si/httpdocs/wp-includes/blocks.php(2383): WP_Block->render() #12 /var/www/vhosts/nascasopis.si/httpdocs/wp-includes/blocks.php(2466): render_block() #13 /var/www/vhosts/nascasopis.si/httpdocs/wp-includes/block-template.php(291): do_blocks() #14 /var/www/vhosts/nascasopis.si/httpdocs/wp-includes/template-canvas.php(12): get_the_block_template_html() #15 /var/www/vhosts/nascasopis.si/httpdocs/wp-includes/template-loader.php(125): include(‘…’) #16 /var/www/vhosts/nascasopis.si/httpdocs/wp-blog-header.php(19): require_once(‘…’) #17 /var/www/vhosts/nascasopis.si/httpdocs/index.php(17): require(‘…’) #18 {main} thrown in /var/www/vhosts/nascasopis.si/httpdocs/wp-content/plugins/contextual-related-posts/includes/class-crp-core-query.php on line 484

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Ajay

    (@ajay)

    Have you tried v4.2.1?

    Also, in the settings tab, do you have the number of posts field set to a number greater than 0?

    Thread Starter xxxLesy

    (@xxxlesy)

    Number of post to display: 10.

    4.2.1 beta also gives a different fatal error:

    Fatal error: Uncaught TypeError: array_slice(): Argument #3 ($length) must be of type ?int, string given in /var/www/vhosts/nascasopis.si/httpdocs/wp-content/plugins/contextual-related-posts/includes/class-crp-core-query.php:1300 Stack trace: #0 /var/www/vhosts/nascasopis.si/httpdocs/wp-content/plugins/contextual-related-posts/includes/class-crp-core-query.php(1300): array_slice() #1 /var/www/vhosts/nascasopis.si/httpdocs/wp-includes/class-wp-hook.php(341): WebberZone\Contextual_Related_Posts\CRP_Core_Query->the_posts() #2 /var/www/vhosts/nascasopis.si/httpdocs/wp-includes/plugin.php(256): WP_Hook->apply_filters() #3 /var/www/vhosts/nascasopis.si/httpdocs/wp-includes/class-wp-query.php(3629): apply_filters_ref_array() #4 /var/www/vhosts/nascasopis.si/httpdocs/wp-includes/class-wp-query.php(3958): WP_Query->get_posts() #5 /var/www/vhosts/nascasopis.si/httpdocs/wp-includes/class-wp-query.php(4090): WP_Query->query() #6 /var/www/vhosts/nascasopis.si/httpdocs/wp-content/plugins/contextual-related-posts/includes/class-crp-query.php(41): WP_Query->__construct() #7 /var/www/vhosts/nascasopis.si/httpdocs/wp-content/plugins/contextual-related-posts/includes/frontend/class-display.php(304): CRP_Query->__construct() #8 /var/www/vhosts/nascasopis.si/httpdocs/wp-content/plugins/contextual-related-posts/includes/frontend/class-display.php(137): WebberZone\Contextual_Related_Posts\Frontend\Display::get_posts() #9 /var/www/vhosts/nascasopis.si/httpdocs/wp-content/plugins/contextual-related-posts/includes/functions.php(24): WebberZone\Contextual_Related_Posts\Frontend\Display::related_posts() #10 /var/www/vhosts/nascasopis.si/httpdocs/wp-content/plugins/contextual-related-posts/includes/frontend/blocks/class-blocks.php(125): get_crp() #11 /var/www/vhosts/nascasopis.si/httpdocs/wp-includes/class-wp-block.php(599): WebberZone\Contextual_Related_Posts\Frontend\Blocks\Blocks::render_block_related_posts() #12 /var/www/vhosts/nascasopis.si/httpdocs/wp-includes/class-wp-block.php(579): WP_Block->render() #13 /var/www/vhosts/nascasopis.si/httpdocs/wp-includes/class-wp-block.php(579): WP_Block->render() #14 /var/www/vhosts/nascasopis.si/httpdocs/wp-includes/class-wp-block.php(579): WP_Block->render() #15 /var/www/vhosts/nascasopis.si/httpdocs/wp-includes/class-wp-block.php(579): WP_Block->render() #16 /var/www/vhosts/nascasopis.si/httpdocs/wp-includes/blocks.php(2383): WP_Block->render() #17 /var/www/vhosts/nascasopis.si/httpdocs/wp-includes/blocks.php(2466): render_block() #18 /var/www/vhosts/nascasopis.si/httpdocs/wp-includes/block-template.php(291): do_blocks() #19 /var/www/vhosts/nascasopis.si/httpdocs/wp-includes/template-canvas.php(12): get_the_block_template_html() #20 /var/www/vhosts/nascasopis.si/httpdocs/wp-includes/template-loader.php(125): include(‘…’) #21 /var/www/vhosts/nascasopis.si/httpdocs/wp-blog-header.php(19): require_once(‘…’) #22 /var/www/vhosts/nascasopis.si/httpdocs/index.php(17): require(‘…’) #23 {main} thrown in /var/www/vhosts/nascasopis.si/httpdocs/wp-content/plugins/contextual-related-posts/includes/class-crp-core-query.php on line 1300

    Plugin Author Ajay

    (@ajay)

    Please can you tell me how you’re displaying the posts and which version of PHP you’re using?

    I’ve made some code changes in this beta version that force the typecasting, which is causing the above error.

    Please can you give this a try: https://github.com/WebberZone/contextual-related-posts/releases/tag/4.2.2-beta1

    Thread Starter xxxLesy

    (@xxxlesy)

    4.2.2-beta1 no longer causes a fatal error (or any error in debug), but no longer displays CRP. It shows the “no related posts found” display.

    I tried php 8.2.30, 8.3.30 and 8.4.18. Same results in all.
    Wp 6.9.1
    nginx/1.28.0
    PHP memory limit 128M

    I’m using theme Twenty Twenty-Five with its new theme site editor system. I’m using CRP guttenberg block (options “show date” and “order by: date”) in the sidebar on single post to display lastest posts by same user (set in general settings with options “Limit to same post type” and “Limit to same author”).

    I can email you admin access to the site, if you need.

    • This reply was modified 1 month, 1 week ago by xxxLesy.
    Thread Starter xxxLesy

    (@xxxlesy)

    Update. I played with settings. The option “Use global settings in block” is a pro feature now, so I had to manually fill in all of the block options for it to show up.

    So yes, 4.2.2-beta1 fixes everything.

    Thanks so much for the hard work Ajay.

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.