• Resolved yurakreichman

    (@yurakreichman)


    Site crashes with error. The page where we’re using shortcode is crashing.

    This happens with our 2 sites: jct.md, synagogue.md

    Temporary we disabled plugin

    2024/10/20 15:19:49 [error] 1657642#1657642: *1420596 FastCGI sent in stderr: "PHP message: PHP Warning:  Undefined array key "city" in /var/www/saoyvpxg/data/www/jct.md/wp-content/plugins/calj/CalJPlugin.php on line 23PHP message: PHP Warning:  Undefined array key "city" in /var/www/saoyvpxg/data/www/jct.md/wp-content/plugins/calj/CalJPlugin.php on line 139PHP message: PHP Warning:  file_get_contents(https://api.calj.net/wp/1/shabbat.json?city=&key=0gCvsHITIAKf9CsH0Gxq): Failed to open stream: Redirection limit reached, aborting in /var/www/saoyvpxg/data/www/jct.md/wp-content/plugins/calj/CalJPlugin.php on line 140PHP message: PHP Fatal error:  Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, null given in /var/www/saoyvpxg/data/www/jct.md/wp-content/plugins/calj/CalJPlugin.php:66
    Stack trace:
    #0 /var/www/saoyvpxg/data/www/jct.md/wp-content/plugins/calj/CalJPlugin.php(66): array_key_exists(NULL, NULL)
    #1 /var/www/saoyvpxg/data/www/jct.md/wp-includes/shortcodes.php(434): calj\wordpress\CalJPlugin->shortcode(Array, '', 'caljshabbat')
    #2 [internal function]: do_shortcode_tag(Array)
    #3 /var/www/saoyvpxg/data/www/jct.md/wp-includes/shortcodes.php(273): preg_replace_callback('/\\[(\\[?)(caljsh...', 'do_shortcode_ta...', '<p><img src="ht...')
    #4 /var/www/saoyvpxg/data/www/jct.md/wp-content/themes/Divi/includes/builder/class-et-builder-element.php(3122): do_shortcode('<p><img src="ht...')
    #5 /var/www/saoyvpxg/data/www/jct.md/wp-includes/shortcodes.php(434): ET_Builder_Element->_render(Array, '<p><img src="ht...', 'et_pb_text')
    #6 [internal function]: do_shortcode_tag(Array)
    #7 /va" while reading upstream, client: 31.31.16.40, server: jct.md, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/var/www/php-fpm/1.sock:", host: "jct.md"

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • I can provide my 2 cents of solution since I also experienced the issue, as it seems they put a validation for user-agent http header which doesnt exists when the used file_get_contents
    in the file: calj/CalJPlugin.php function refreshCache line 133, change where you see the file_get_contents – comment the line, and change it, it is also more wordpress compliant

    			// Fixed by idokd ( [email protected] )
    $url = 'https://api.calj.net/wp/1/shabbat.json?city='.$city.'&key='.$key;
    $response = wp_remote_get( $url );
    $response = wp_remote_retrieve_body( $response );
    //$response = file_get_contents( 'https://api.calj.net/wp/1/shabbat.json?city='.$city.'&key='.$key, false, $context );

    that will use the wordpress built-in function to get the remote content. and by the way will use a wordpress user agent ( use any pre-configured proxies etc.), and will solve you the issue of the crash, and /or any 9 seconds delays of redirections etc.

    aminciotti

    (@aminciotti)

    We are having the same problem orhahayim.com:

    Thank you @idokd the fix worked.

    • This reply was modified 1 month ago by aminciotti.
    • This reply was modified 1 month ago by aminciotti.
    Plugin Author calj

    (@calj)

    Hi,

    Gabriel speaking (plugin’s author)

    Thank you very much to @yurakreichman , and @aminciotti and special kudos to @idokd !

    I wasn’t aware of this current Site Crash page, nor of the fact that file_get_contents could make problems in certain cases with some hosting providers.
    Thank you very much. I have published an update (v1.5) with Ido’s fix.

    Gabriel

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