CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Deprecated: preg_replace():

Print topic Send  topic

Author Message
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?
View profile  Send private message
sarmanho

Posts: 1
Posted: 06/16/2014, 6:53 PM

You solved this problem ?
View profile  Send private message
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
View profile  Send private message
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
View profile  Send private message
lucasleandrodemo

Posts: 14
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
View profile  Send private message
scarvello

Posts: 63
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.

}
View profile  Send private message
scarvello

Posts: 63
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.

}
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by UltraApps.com  and YesSoftware, Inc.