Yii Framework Forum: Function ereg() is deprecated - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Function ereg() is deprecated PHP error Rate Topic: -----

#1 User is offline   kernel32ddl 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 26-May 12

Posted 14 August 2012 - 01:04 AM

Hi all!

According to draft proposal I MUST include in layout customer's existing header.php and footer.php templates.

But then I try to include them, Yii generate error:
PHP error

Function ereg() is deprecated 

It because customer's templates uses ereg() function:
 <?$uri = $_SERVER['REQUEST_URI']; if (ereg("inc_file.php", $uri))


Is any possibility to disable/bypass this error without customers templates correction?
0

#2 User is offline   Galin Velchev 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 10
  • Joined: 17-July 12

Posted 14 August 2012 - 01:14 AM

Maybe this will help you!

other
0

#3 User is offline   kernel32ddl 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 26-May 12

Posted 14 August 2012 - 01:32 AM

View PostGalin Velchev, on 14 August 2012 - 01:14 AM, said:

Maybe this will help you!

other

Galin Velchev, thank for reply, but this solution need to edit customer's template files (replace ereg to preg_match). Is any possibility to avoid this?
0

#4 User is offline   kernel32ddl 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 26-May 12

Posted 14 August 2012 - 01:48 AM

SOLVED!

This error issued in PHP 5.3
To allow using ereg* function in PHP 5.3
Find in php.ini:
; overload(replace) single byte functions by mbstring functions.
; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(),
; etc. Possible values are 0,1,2,4 or combination of them.
; For example, 7 for overload everything.
; 0: No overload
; 1: Overload mail() function
; 2: Overload str*() functions
; 4: Overload ereg*() functions
;mbstring.func_overload = 0

uncomment and set:
mbstring.func_overload = 5 

this will enable mail() and ereg*() (1+4) without any refactoring of customer's files!
0

#5 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,342
  • Joined: 12-October 09
  • Location:Croatia

Posted 14 August 2012 - 05:00 AM

NOTE: moved to proper section (General PHP Topics instead of General Discussion for Yii 1.1.x)
Find more about me.... btw. Do you know your WAN IP?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users