Skip to content

Commit

Permalink
Don't use create_function().
Browse files Browse the repository at this point in the history
It's deprecated and unsafe and closures should be used instead.
  • Loading branch information
yunosh committed Feb 13, 2017
1 parent cf8be72 commit 78ad0c2
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/Horde/Data/Csv.php
Expand Up @@ -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'])) {
Expand Down

0 comments on commit 78ad0c2

Please sign in to comment.