We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23050
    • 1,842 Posts
    Hi Coroico smiley

    I’v just upgraded to 1.7.1 and I’ve noticed that a visitor searched for "d’eau" and it seems that the ’ makes an error :

    MODx encountered the following error while attempting to parse the requested resource:
    « Execution of a query to the database failed - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ’eau%’ OR sc.longtitle LIKE ’%d\\’eau%’ OR sc.description LIKE ’%d\\’eau%’ OR sc.’ at line 1 »
    SQL: SELECT DISTINCT sc.id, sc.pagetitle, sc.longtitle, sc.description, sc.introtext, sc.content FROM `perrine`.`modx_site_content` sc LEFT JOIN `perrine`.`modx_site_tmplvar_contentvalues` stc ON sc.id = stc.contentid WHERE (sc.pagetitle LIKE ’%salle%’ OR sc.longtitle LIKE ’%salle%’ OR sc.description LIKE ’%salle%’ OR sc.introtext LIKE ’%salle%’ OR sc.content LIKE ’%salle%’ OR stc.value LIKE ’%salle%’) AND (sc.pagetitle LIKE ’%d\\’eau%’ OR sc.longtitle LIKE ’%d\\’eau%’ OR sc.description LIKE ’%d\\’eau%’ OR sc.introtext LIKE ’%d\\’eau%’ OR sc.content LIKE ’%d\\’eau%’ OR stc.value LIKE ’%d\\’eau%’) AND sc.privateweb=0 AND sc.published=1 AND sc.searchable=1 AND sc.deleted=0;

    Have you ever noticed that ? Thanks wink
      • 5811
      • 1,717 Posts
      Yes, I have already noticed that. This is corrected with the version 1.8 which the development is in progress

      For a quick correction, adds
        $searchString = stripslashes($searchString);
      before the return statement of the initSearchString function in includes/ajaxSearch.inc.php
        • 23050
        • 1,842 Posts
        Ok ! Nice and quick correction wink

        Thank you
          • 6726
          • 7,075 Posts
          Thanks for spotting that Perrine I’ll make sure to update !
            .: COO - Commerce Guys - Community Driven Innovation :.


            MODx est l'outil id
            • 5811
            • 1,717 Posts
            Perrine, you can test this correction on AS180 beta demo playground.

            Choose in the upper menu, "non ajax mode test", then in the left menu, the "same page" test for example, select the french document group and try as searchterms "l’école l’éducation" (vaste programme ! smiley ).

            To highlight the words with an accent (like "d’eau" or "l’école"), you should improve the highligth plugin (1.2.0.2) by replacing
            $searched = strip_tags(urldecode($_REQUEST['searched']));
            by
            $searched = stripslashes(strip_tags(urldecode($_REQUEST['searched'])));
              • 23050
              • 1,842 Posts
              Ok ! I did make the change but it was running fine before with v1.2

              Thx Coroico ! wink