Skip to content

Commit 78ad0c2

Browse files
committed
Don't use create_function().
It's deprecated and unsafe and closures should be used instead.
1 parent cf8be72 commit 78ad0c2

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

lib/Horde/Data/Csv.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,20 @@ public static function getCsv($file, array $params = array())
332332

333333
if ($row) {
334334
$row = (strlen($params['quote']) && strlen($params['escape']))
335-
? array_map(create_function('$a', 'return str_replace(\'' . str_replace('\'', '\\\'', $params['escape'] . $params['quote']) . '\', \'' . str_replace('\'', '\\\'', $params['quote']) . '\', $a);'), $row)
335+
? array_map(
336+
function ($a) use ($params) {
337+
return str_replace(
338+
str_replace(
339+
'\'',
340+
'\\\'',
341+
$params['escape'] . $params['quote']
342+
),
343+
str_replace('\'', '\\\'', $params['quote']),
344+
$a
345+
);
346+
},
347+
$row
348+
)
336349
: array_map('trim', $row);
337350

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

0 commit comments

Comments
 (0)