We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32025
    • 305 Posts
    Dayton Web Design Reply #1, 6 years ago
    I updated my FormIt to the latest version (3.0.4) and installed the ReCaptchaV2 v2.3.0 since my contact from was using Google reCAPTCHA v1. I had a notice stating this version was being discontinued. I did have a plugin for SPAM that I believe was called: PHP reCAPTCHA (or something similar) that I removed as its no longer needed.

    I entered my new Google Keys and the form and Google SPAM fields show just fine. But now when I click submit, the contact form turns a white error page with these errors below instead of successfully redirecting to the success page:

    Warning: Unexpected character in input: '\' (ASCII=92) state=1 in public_html/core/cache/includes/elements/modsnippet/10.include.cache.php on line 61
    
    Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /MyRoot/public_html/core/cache/includes/elements/modsnippet/10.include.cache.php on line 61
    
    Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /MyRoot/public_html/core/cache/includes/elements/modsnippet/10.include.cache.php on line 61
    
    Parse error: syntax error, unexpected T_STRING in /MyRoot/core/cache/includes/elements/modsnippet/10.include.cache.php on line 61


    The page with issue is located here: http://www.centervillelandscape.com/contact.html

    I went to: core/cache and removed the files but this issue still persists. Any ideas?
      Making the web a better place on site at a time! Dayton Web Design: http://www.dayton-web-design.com/
      • 3749
      • 24,544 Posts
      What is the snippet with the ID 10?

      Can you paste the lines surrounding line 61 in this file in the core/cache directory so we can see them?

      public_html/core/cache/includes/elements/modsnippet/10.include.cache.php
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 32025
        • 305 Posts
        Dayton Web Design Reply #3, 6 years ago
        The second below line is #61 of the file you requested.

        require_once($recaptchav2Path . 'autoload.php');
        $recaptchav2 = new \ReCaptcha\ReCaptcha($secret, new \ReCaptcha\RequestMethod\CurlPost());
        if (!($recaptchav2 instanceof \ReCaptcha\ReCaptcha)) {
            $hook->addError('recaptchav2_error', $tech_err_msg);
            $modx->log(modX::LOG_LEVEL_WARN, 'Failed to load recaptchav2 class.'); 
            return false;
        



          Making the web a better place on site at a time! Dayton Web Design: http://www.dayton-web-design.com/
          • 3749
          • 24,544 Posts
          I'm guessing here, but try replacing the first two lines of the code above in the snippet with these three:

          require_once($recaptchav2Path . 'autoload.php');
          $method = new \ReCaptcha\RequestMethod\CurlPost();
          $recaptchav2 = new \ReCaptcha\ReCaptcha($secret, $method);
          


          Clear the cache before testing.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 32025
            • 305 Posts
            Dayton Web Design Reply #5, 6 years ago
            BobRay that is not changing anything. I am using an older version of Revo (2.2.11)and I just updated my FormIt plugin and installed new ReCaptchaV2 plus removed the PHP reCAPTCHA. So perhaps I need to update the platform. Wasn't ready to take this on today.

            I did take the redirect and SPAm (plugin ReCaptcha V2) off and the issue still persists. So I am assuming my updated version of FormIt is not working properly with my older version of Revolution.
              Making the web a better place on site at a time! Dayton Web Design: http://www.dayton-web-design.com/
              • 3749
              • 24,544 Posts
              Check your version of PHP as well. The ReCaptchaV2 may require a more recent version than you have.
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 32025
                • 305 Posts
                Dayton Web Design Reply #7, 6 years ago
                BobRay thank you for your help. Ultimately the issue was incompatibility with the core versus the addon. My core is outdated REvo v2.2 and the addon ReCaptchaV2 requires Revo v2.3x or greater. This turned out to be the issue. I had to restore my website to a previous state, and then took one step at a time testing to see where it broke. Basically when I added the snipett code from ReCaptchaV2 to my contact form, the issue resumed.

                I either need to update the site to the latest version or not use ReCaptcha V2 on my outdated FormIt installation. Right now, I just removed this field and my form works great. Its time my client upgrade! Should have double checked the version number on this addon before attempting to install. Again, thank you for your help.
                  Making the web a better place on site at a time! Dayton Web Design: http://www.dayton-web-design.com/
                  • 3749
                  • 24,544 Posts
                  Be sure to upgrade to 2.3.0, 2.4.0, 2.5.0, and 2.6.0 during the upgrade process.

                  I'm not sure if the UpgradeMODX extra will work in 2.2, but I think it will. It will definitely work in the first version that has widget capability in the Manager. It shouldn't hurt to try and install it.

                  Back up the site first, and I would recommend testing each version briefly after installing it.
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting