Function ereg() is deprecated

Forum for questions and support relating to the 1.24.x releases only.
Locked
DREMA
Posts: 162
Joined: Fri Dec 12, 2008 2:39 am
Location: México

Function ereg() is deprecated

Post 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
User avatar
kingofkya
Posts: 1110
Joined: Mon Mar 26, 2007 6:07 am
Location: Las Vegas, Nevada

Post 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 ;
jcpu
Posts: 1
Joined: Sat Feb 20, 2010 4:01 pm

Re: Function ereg() is deprecated

Post 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';
    }
mastertheknife
Posts: 678
Joined: Wed Dec 16, 2009 4:32 pm
Location: Israel

Post 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
User avatar
Sir Veillance
Posts: 11
Joined: Tue Nov 13, 2007 3:44 am
Location: Germany

Post 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);
Martin from Germany
Locked