Page 1 of 1

Function ereg() is deprecated

Posted: Fri Nov 13, 2009 5:00 pm
by DREMA
I keep geting lots of this errors in my httpd/error_log

[Fri Nov 13 10:53:35 2009] [error] [client 189.145.xxx.xxx] PHP Deprecated: Function ereg() is deprecated in /var/lib/zm/www/includes/functions.php on line 808, referer: http://xxx.xxx.org/zm/index.php
[Fri Nov 13 10:53:35 2009] [error] [client 189.145.xxx.xxx] PHP Deprecated: Function ereg() is deprecated in /var/lib/zm/www/includes/functions.php on line 813, referer: http://xxx.xxx.org/zm/index.php
[Fri Nov 13 10:53:35 2009] [error] [client 189.145.xxx.xxx] PHP Deprecated: Function ereg() is deprecated in /var/lib/zm/www/includes/functions.php on line 808, referer: http://xxx.xxx.org/zm/index.php
[Fri Nov 13 10:53:35 2009] [error] [client 189.145.xxx.xxx] PHP Deprecated: Function ereg() is deprecated in /var/lib/zm/www/includes/functions.php on line 813, referer: http://xxx.xxx.org/zm/index.php

How can I solve this? I'm using

- Zoneminder-svn
- PHP 5.3.0-5
- apache 2.2.14-2

Posted: Fri Nov 13, 2009 8:00 pm
by kingofkya
hope fulll this will be fixed before php 6 comes out anyways

open up php.ini and comment out the sections on errors

use ;

Re: Function ereg() is deprecated

Posted: Sat Feb 20, 2010 4:07 pm
by jcpu
DREMA wrote:I keep geting lots of this errors in my httpd/error_log

[Fri Nov 13 10:53:35 2009] [error] [client 189.145.xxx.xxx] PHP Deprecated: Function ereg() is deprecated in /var/lib/zm/www/includes/functions.php on line 808, referer: http://xxx.xxx.org/zm/index.php
[Fri Nov 13 10:53:35 2009] [error] [client 189.145.xxx.xxx] PHP Deprecated: Function ereg() is deprecated in /var/lib/zm/www/includes/functions.php on line 813, referer: http://xxx.xxx.org/zm/index.php
[Fri Nov 13 10:53:35 2009] [error] [client 189.145.xxx.xxx] PHP Deprecated: Function ereg() is deprecated in /var/lib/zm/www/includes/functions.php on line 808, referer: http://xxx.xxx.org/zm/index.php
[Fri Nov 13 10:53:35 2009] [error] [client 189.145.xxx.xxx] PHP Deprecated: Function ereg() is deprecated in /var/lib/zm/www/includes/functions.php on line 813, referer: http://xxx.xxx.org/zm/index.php

How can I solve this? I'm using

- Zoneminder-svn
- PHP 5.3.0-5
- apache 2.2.14-2
Change section in functions.php (ZM Version 1.24.2 ) to:

Code: Select all

    if (preg_match( '/MSIE ([0-9].[0-9]{1,2})/',$_SERVER['HTTP_USER_AGENT'],$logVersion))
    {
        $version = $logVersion[1];
        $browser = 'ie';
    }
    elseif (preg_match( '#Safari/([0-9.]+)#',$_SERVER['HTTP_USER_AGENT'],$logVersion))
    {
        $version = $logVersion[1];
        $browser = 'safari';
    }
        elseif (preg_match( '#Konqueror/([0-9.]+)#',$_SERVER['HTTP_USER_AGENT'],$logVersion))
        {
                $version = $logVersion[1];
                $browser = 'konqueror';
        }
    elseif (preg_match( '/Opera ([0-9].[0-9]{1,2})/',$_SERVER['HTTP_USER_AGENT'],$logVersion))
    {
        $version = $logVersion[1];
        $browser = 'opera';
    }
    elseif (preg_match( '#Mozilla/([0-9].[0-9]{1,2})#',$_SERVER['HTTP_USER_AGENT'],$logVersion))
    {
        $version = $logVersion[1];
        $browser = 'mozilla';
    }
    else
    {
        $version = 0;
        $browser = 'unknown';
    }

Posted: Sat Feb 20, 2010 6:52 pm
by mastertheknife
Thank you jcpu, i added it to to a page i just made to centralize all bug fixes:
http://www.zoneminder.com/wiki/index.ph ... 2_Bugfixes

Posted: Thu Mar 25, 2010 5:49 pm
by Sir Veillance
kingofkya wrote:open up php.ini and comment out the sections on errors
this would affect all php programs running on the server (unless you copy the php.ini into your zm directory and manipulated that one)

What one should do is
  • grep error_reporting *.php
    change all occurrences to error_reporting(E_ALL ^ (E_NOTICE | E_DEPRECATED));
The most important change is in index.php

If you want to keep E_NOTICE, use error_reporting(E_ALL ^ E_DEPRECATED);