We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29086
    • 6 Posts
    Hey there,
    Been getting an error after updating to Evolution 1.0.3.
    The error I am getting is:
    PHP error debug
    Error: Function eregi() is deprecated
    Error type/ Nr.: - 8192
    File: D:\WEBS\CS\new\manager\includes\document.parser.class.inc.php(770) : eval()’d code
    Line: 9

    I have looked at the page and cannot find the eregi command but there is a eval on line 770, As far as i can make out eval is not the code command in question it is the eregi command that needs updated to preg_match.

    Where can I find the error in question to fix?

    Thanks
    • Code on line 9 of one of your Snippets is causing this. Line 770 in the document.parser.class.inc.php is the code responsible for executing Snippets.
        • 14127
        • 7 Posts
        You need to find lines with eregi in the snippets (RandomImage and ContactForm for example use eregi). eregi can be replaced by preg_match with parameter i, In RandomImage you need to replace the line
        		$is_image = eregi( "jpg|gif",$file_type );
        with
        		$is_image = preg_match( "/jpg|gif/i",$file_type );
        

        in ContactForm replace line
            } elseif (eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $from_email)) {
        with
            } elseif (preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i", $from_email)) {


        if you have installed MaxiGallery, eregi is also used in file "assets/snippets/maxigallery/watermark/Thumbnail.class.php"
          • 349
          • 76 Posts
          Do a mysql search for snippets with ereg in them:
          SELECT *
          FROM `modx_site_snippets`
          WHERE `snippet` LIKE '%ereg%'

          and edit them. Replace ereg or eregi with preg_match and add delimiters in your query.
            • 16956
            • 88 Posts
            /assets/cache/siteCache.idx.php

            line: 8430

            false:
            $link = (eregi("^www.",$link))?str_replace(\'www.\',\'\',$link):$link;

            true:
            $link = (preg_match("/^www./",$link))?str_replace(\'www.\',\'\',$link):$link;
              • 3647
              • 177 Posts
              even though most of the thread is old, once again thanks to the community for this post because just came across this problem moving hosts, in my case it was a site using RandomAd that causes the error (thanks to aceman3000 for the query code to isolate that - it might have taken ages without that!)

              change the line in the snippet
              $is_image = eregi( "jpg|jpeg|JPEG|JPG|gif|GIF|png|PNG",$file_type );
              to
              $is_image = preg_match( "/jpg|jpeg|JPEG|JPG|gif|GIF|png|PNG/i",$file_type );
                • 47575
                • 1 Posts
                Error with php 5.3 with Fix

                function bbcode($text) {

                $text=eregi_replace("\\[img\\](http://[^\\[]+)\\[/img\\]","<img src=\"\\1\" border=\"0\">",$text);
                $text=eregi_replace("\\[b\\]([^\\[]*)\\[/b\\]","<b>\\1</b>",$text);
                $text=eregi_replace("\\[i\\]([^\\[]*)\\[/i\\]","<i>\\1</i>",$text);
                $text=eregi_replace("\\[u\\]([^\\[]*)\\[/u\\]","<u>\\1</u>",$text);
                $text=eregi_replace("\\[email\\]([^\\[]*)\\[/email\\]","<a href=\"mailto:\\1\">\\1</a>",$text);
                $text=eregi_replace("\\[url\\]www.([^\\[]*)\\[/url\\]","<a href=\"http://www.\\1\" target=\"_blank\">www.\\1</a>",$text);
                $text=eregi_replace("\\[url\\]([^\\[]*)\\[/url\\]","<a href=\"\\1\" target=\"_blank\">\\1</a>",$text);
                $text=eregi_replace("\\[url=www.([^\\[]+)\\]([^\\[]*)\\[/url\\]","<a href=\"http://www.\\1\" target=\"_blank\">\\2</a>",$text);
                $text=eregi_replace("\\[url=http://([^\\[]+)\\]([^\\[]*)\\[/url\\]","<a href=\"http://\\1\" target=\"_blank\">\\2</a>",$text);
                $text=eregi_replace("\\[i\\]([^\\[]*)\\[/i\\]","<i>\\1</i>",$text);
                $text=eregi_replace("\\[u\\]([^\\[]*)\\[/u\\]","<u>\\1</u>",$text);
                $text=eregi_replace("\\[b\\]([^\\[]*)\\[/b\\]","<b>\\1</b>",$text);
                return $text;
                }