We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23448
    • 1 Posts
    /** This problem may already be addressed in another topic, I couldn’t find it but feel free to move **/

    Hi,

    Yesterday I started playing with ModX which ,by the way, is a mighty fine CMS. After working for some time in the English language version I switched to the Dutch translation which caused the ’Site Tree’ in the left frame of the Manager to disappear.

    Long story short: after poking around in the Dutch language file for about an hour I found the string that caused the problem on line 282 (lucky me).

    On first sight there’s nothing wrong with this string, except for the escaped single quote.
    <?php
    
        // nederlands-utf8.php - line 282
        $_lang["empty_recycle_bin_empty"] = 'Er zijn geen verwijderde Pagina\'s om permanent te verwijderen.';
    
    ?>
    


    Fast forward to tree.php, line 402, which is at the end of a chunk of JavaScript.

    Again, at first sight this code makes perfect sense. undecided
    <script language="JavaScript" type="text/javascript">
    
        // tree.php, line 402
        var title = '<?php echo addslashes($_lang['empty_recycle_bin_empty']); ?>' ;
    
    </script>
    


    However, if you take a look at this code example in your editor, you will find the reality of the situation to be quite different. shocked
    <?php
    
        // PHP: no issues
        $title = addslashes('Er zijn geen verwijderde Pagina\'s om permanent te verwijderen.');
    
    ?>
    
    <script language="JavaScript" type="text/javascript">
    
        // Single quoted string causes error
        var title = '<?php echo addslashes('Er zijn geen verwijderde Pagina\'s om permanent te verwijderen.'); ?>';
    
        // This works fine
        var title = 'Er zijn geen verwijderde Pagina\'s om permanent te verwijderen.';
    
        // Double quoted string solves the problem
        var title = "<?php echo addslashes('Er zijn geen verwijderde Pagina\'s om permanent te verwijderen.'); ?>";
    
    </script>
    


    In most languages nothing will happen because single quotes are seldom used in words, but in Dutch (and English!) language plural nouns sometimes end in ’s which in this particular case caused the script to stall.

    In this case I quickly found the bug and solved the problem by using double quotes but this bug could also be lurking unseen in other parts of the code...

    Greetz,

    Leo