Anyone know what is this error? I need help with this Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in C:\xampp\htdocs\sfprojects\jobeet\lib\vendor\symfony\lib\response\sfWebResponse.class.php on line 409
. I'm using xampp 1.8.3 and symfony 1.4.
I couldn't get to step forward because of this a weeke a go :'(. Any help will be appreciated. Thank you.
In myproject/lib/vendor/symfony/lib/response/sfWebResponse.class.php on line 409
protected function normalizeHeaderName($name)
{
// return preg_replace('/\-(.)/e', "'-'.strtoupper('\\1')", strtr(ucfirst(strtolower($name)), '_', '-'));
return preg_replace_callback(
'/\-(.)/',
function ($matches) {
return '-'.strtoupper($matches[1]);
},
strtr(ucfirst(strtolower($name)), '_', '-')
);
}
FIX for pregtr method in /lib/vendor/symfony/lib/util/sfToolkit.class.php on line 360
public static function pregtr($search, $replacePairs){
// return preg_replace(array_keys($replacePairs), array_values($replacePairs), $search);
foreach($replacePairs as $pattern => $replacement)
{
if (preg_match('/(.*)e$/', $pattern, $matches))
{
$pattern = $matches[1];
$search = preg_replace_callback($pattern, function ($matches) use ($replacement) {
preg_match("/('::'\.)?([a-z]*)\('\\\\([0-9]{1})'\)/", $replacement, $match);
return ($match[1]==''?'':'::').call_user_func($match[2], $matches[$match[3]]);
}, $search);
}
else
{
$search = preg_replace($pattern, $replacement, $search);
}
}
return $search;
}
I've combined two answers from duplicate thread Symfony 1.4 using deprecated functions in php 5.5 answered by mika and xtech (up-vote them please)
It also affects /lib/form/addon/sfFormObject.class.php on line 281
protected function camelize($text)
{
//return preg_replace(array('#/(.?)#e', '/(^|_|-)+(.)/e'), array("'::'.strtoupper('\\1')", "strtoupper('\\2')"), $text); //ORIGINAL
return strtr(ucwords(strtr($text, array('/' => ':: ', '_' => ' ', '-' => ' '))), array(' ' => ''));
}
Found this:
http://blog.jakoubek.cz/symfony-1-4-deprecated-e-modifier
Tested, all changes look good
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With