We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42397
    • 29 Posts
    I had bellow AjaxSearch error on my system event (Using Modx Evolution 1.0.14 )


    « MODX Parse 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 '\"%') OR (sc.longtitle LIKE '%here...\\'\"%') OR (sc.description LIKE ' at line 1 »
    SQL > SELECT sc.id, sc.pagetitle, sc.longtitle, sc.description, sc.alias, sc.introtext, sc.template, sc.menutitle, sc.content, sc.publishedon, GROUP_CONCAT( DISTINCT CAST(ntv.id AS CHAR) SEPARATOR "," ) AS tv_id, GROUP_CONCAT( DISTINCT ntv.value SEPARATOR "," ) AS tv_value FROM `modx_site_content` sc LEFT JOIN( SELECT DISTINCT tv.id, tv.value, tv.contentid FROM `modx_site_tmplvar_contentvalues` tv ) AS ntv ON sc.id = ntv.contentid WHERE ((sc.published=1) AND (sc.searchable=1) AND (sc.deleted=0) AND (sc.privateweb=0)) GROUP BY sc.id HAVING (((sc.pagetitle LIKE '%Search%') OR (sc.longtitle LIKE '%Search%') OR (sc.description LIKE '%Search%') OR (sc.alias LIKE '%Search%') OR (sc.introtext LIKE '%Search%') OR (sc.menutitle LIKE '%Search%') OR (sc.content LIKE '%Search%') OR (tv_value LIKE '%Search%')) OR ((sc.pagetitle LIKE '%here...\\'\"%') OR (sc.longtitle LIKE '%here...\\'\"%') OR (sc.description LIKE '%here...\\'\"%') OR (sc.alias LIKE '%here...\\'\"%') OR (sc.introtext LIKE '%here...\\'\"%') OR (sc.menutitle LIKE '%here...\\'\"%') OR (sc.content LIKE '%here...\\'\"%') OR (tv_value LIKE '%here...\\'\"%'))) ORDER BY `publishedon`,`pagetitle`
    Basic info
    REQUEST_URI : http://subnet.ir/search-results.html
    Resource : [8]Search Results
    Current Snippet : AjaxSearch
    Referer : dumval\’\"
    User Agent : dumval\’\"
    IP : 198.7.59.8
    Benchmarks
    MySQL : 0.0043 s (6 Requests)
    PHP : 0.0432 s
    Total : 0.0476 s
    Memory : 5.11371612549 mb

    Backtrace

    1 DocumentParser->executeParser()
    index.php on line 144
    2 DocumentParser->prepareResponse()
    manager/includes/document.parser.class.inc.php on line 1579
    3 DocumentParser->outputContent()
    manager/includes/document.parser.class.inc.php on line 1681
    4 DocumentParser->parseDocumentSource()
    manager/includes/document.parser.class.inc.php on line 596
    5 DocumentParser->evalSnippets()
    manager/includes/document.parser.class.inc.php on line 1461
    6 DocumentParser->_get_snip_result()
    manager/includes/document.parser.class.inc.php on line 1060
    7 DocumentParser->evalSnippet()
    manager/includes/document.parser.class.inc.php on line 1147
    8 eval()
    manager/includes/document.parser.class.inc.php on line 1009
    9 require()
    manager/includes/document.parser.class.inc.php(1009) : eval()'d code on line 1
    10 AjaxSearch->run()
    assets/snippets/ajaxSearch/snippet.ajaxSearch.php on line 409
    11 AjaxSearchCtrl->run()
    assets/snippets/ajaxSearch/classes/ajaxSearch.class.inc.php on line 101
    12 AjaxSearchResults->getSearchResults()
    assets/snippets/ajaxSearch/classes/ajaxSearchCtrl.class.inc.php on line 70
    13 AjaxSearchRequest->doSearch()
    assets/snippets/ajaxSearch/classes/ajaxSearchResults.class.inc.php on line 99
    14 DBAPI->query()
    assets/snippets/ajaxSearch/classes/ajaxSearchRequest.class.inc.php on line 65
      • 13428 ☆ A M B ☆
      • 1,031 Posts
      Looks like the ' is somehow double escaped. Maybe a magic quotes issue (could be solved: http://php.net/manual/de/security.magicquotes.disabling.php).

      If not: Feel free to debug AjaxSearch to see where/why that happens. It is maybe annoying but I don't see a security flaw with that.