Skip to content
Permalink
Browse files
Don't use create_function().
It's deprecated and unsafe and closures should be used instead.
  • Loading branch information
yunosh committed Feb 13, 2017
1 parent cf8be72 commit 78ad0c2390176cdde7260a271bc6ddd86f4c9c0e
Showing 1 changed file with 14 additions and 1 deletion.
@@ -332,7 +332,20 @@ public static function getCsv($file, array $params = array())

if ($row) {
$row = (strlen($params['quote']) && strlen($params['escape']))
? array_map(create_function('$a', 'return str_replace(\'' . str_replace('\'', '\\\'', $params['escape'] . $params['quote']) . '\', \'' . str_replace('\'', '\\\'', $params['quote']) . '\', $a);'), $row)
? array_map(
function ($a) use ($params) {
return str_replace(
str_replace(
'\'',
'\\\'',
$params['escape'] . $params['quote']
),
str_replace('\'', '\\\'', $params['quote']),
$a
);
},
$row
)
: array_map('trim', $row);

if (!empty($params['length'])) {

0 comments on commit 78ad0c2

Please sign in to comment.