有人知道这是什么错误吗?我需要帮助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。我正在使用xampp 1.8.3和symfony 1.4。由于这个礼拜,我无法前进:'(。任何帮助将不胜感激。谢谢。
在第409行的myproject / lib / vendor / symfony / lib / response / sfWebResponse.class.php中
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)), '_', '-')
);
}
Run Code Online (Sandbox Code Playgroud)
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;
}
Run Code Online (Sandbox Code Playgroud)
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(' ' => ''));
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5871 次 |
| 最近记录: |