adrianmarlow
Posts: 2
|
Posted: 04/14/2014, 4:28 AM |
|
Just upgraded my local development site to; Apache 2.4.7 - mySQL 5.6.15 - PHP 5.5.8 and having a problem with Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\motordiscounts\Template.php on line 92
does anybody know how to fix this?
|
|
|
sarmanho
Posts: 1
|
Posted: 06/16/2014, 6:53 PM |
|
You solved this problem ?
|
|
|
2Code
Posts: 24
|
Posted: 06/17/2014, 3:19 PM |
|
yes preg_replace(): is depreciated in the new version of php however it still seems to function ok the error shows up in the template php area I don't use templates or the default css if you disable error reporting it will disappear
|
|
|
adrianmarlow
Posts: 2
|
Posted: 06/17/2014, 4:58 PM |
|
Yes you have 2 choices
Downgrade to PHP 5.4.24 or Set your templates, but I was still finding issues and errors
If you disable error reporting which also affect other reporting and I found problems their
There is no simple solution for PHP 5.5.8
|
|
|
lucasleandrodemo
Posts: 15
|
Posted: 05/15/2015, 5:35 AM |
|
Someone already tried to modify the CodeCharge files generated by putting in place this function preg_replace_callback function ()
_________________
Lucas Leandro de Moura
lucasleandrodemoura@gmail.com
PHP Programmer
Estrela/RS - Brazil |
|
|
scarvello
Posts: 64
|
Posted: 05/21/2015, 2:31 AM |
|
I don't have tried but I think it's also possible to use php function_exists() to check if preg_replace() is implementend in your PHP environment.
Something like this pseudo-code:
if (! function_exists('preg_replace')) {
include 'my_preg_replace.php';
}
?
File my_preg_replace.php should be like this:
function preg_replace($pattern, $replacement, $subject, $limit, $count){
// custom implementation by using php 5.5 preg_replace_callback if you
// are using PHP 5.5.
}
|
|
|
scarvello
Posts: 64
|
Posted: 05/23/2015, 4:50 PM |
|
Another possible solution
override_function('preg_replace', $pattern, $replacement, $subject,$limit,$count,
'return my_preg_replace($pattern, $replacement, $subject, $limit, $count);');
function my_preg_replace($pattern, $replacement, $subject, $limit, $count){
// custom implementation by using php 5.5 preg_replace_callback if you
// are using PHP 5.5.
}
|
|
|
|