We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5811
    • 1,717 Posts
    After creating a component by using the MODx transport mechanism, I got systematically this error:
    Parse error: parse error in E:\Perso\www\modx200rc2\core\cache\elements\modsnippet\20.include.cache.php on line 23
    Hereafter is the content of the file 20.include.cache.php:
    <?php
    function elements_modsnippet_20($scriptProperties= array()) {
    global $modx;
    if (is_array($scriptProperties)) {
    extract($scriptProperties, EXTR_SKIP);
    }
    
    /*
     * AjaxSearchForm
     *
     *          Ajax and non-Ajax search that supports results highlighting
     *
     * @author      Coroico <[email protected]>
     *
     * @category    3rd Party Component
     * @license     http://www.gnu.org/copyleft/gpl.html GNU Public License (GPL)
     *
     *               Use AjaxSearchForm to display a search form
     *
     * -----------------------------------------------------------------------------
     */
    
    $asPathDef = $modx->getOption('core_path') . 'components/ajaxSearch/';
    $asPath = $modx->getOption('ajaxSearch.core_path',null,asPathDef);
    $asf = $modx->getService('ajaxSearchForm','AjaxSearchForm',$asPath . 'model/ajaxSearch/',$scriptProperties);
    
    if (!($asf instanceof AjaxSearchForm)) return '<h3>error: AjaxSearchForm class not found</h3>';
    
    $output = $asf->run();
    return $output;
    }
    The code is correct but I got sistematically a parse error huh I spent lot of time to understand ...
    I don’t know why but the line 7 contains a &#65279; character which breaks the include.
    You see this character because I did a copy paste from the file to the text edit area, otherwise, this is a blank character >:(
    If I remove this line, the inclusion is ok and the file parsed. This character is not in my file before the transport but appear in the snippet window area after the package installation.

    Any idea how I could fix this issue ?

      • 22303 MODX Staff
      • 10,725 Posts
      You’ve put some odd character in the first line of your source code. Remove it and it will not be generated into the cache that way. wink
        • 5811
        • 1,717 Posts
        This character is not in my file before the transport but appear in the snippet window area after the package installation.
        This character doesn’t exist in my snippet file (before the transport process). I have checked several times wink
          • 5811
          • 1,717 Posts
          SOLVED : The weird character is the BOM character! () I don’t why but my snippets have been saved in UTF-8 rather than UTF-8 without BOM undecided