Skip to content

Commit

Permalink
#25 (PHP 7.2 Deprecations: create_function): Replaced create_function…
Browse files Browse the repository at this point in the history
… with eval.

Fixed PHPUnit dependency (PHP_Timer).
  • Loading branch information
Athari committed Jul 11, 2023
1 parent cb8afe0 commit f837af6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion YaLinqo/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private static function createLambdaFromString ($closure, $closureArgs)
$code = trim($code, " \r\n\t");
if (strlen($code) > 0 && $code[0] != '{')
$code = "return {$code};";
$fun = @create_function($args, $code);
$fun = eval("return function($args) { $code };");
if (!$fun)
throw new \InvalidArgumentException(self::ERROR_CANNOT_PARSE_LAMBDA);
self::$lambdaCache[$closure][$closureArgs] = $fun;
Expand Down
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"require-dev": {
"phpunit/phpunit": "<6",
"phpdocumentor/phpdocumentor": "^2.8",
"satooshi/php-coveralls": "^2.0"
"php-coveralls/php-coveralls": "^2.5"
},
"autoload": {
"psr-4": {
Expand All @@ -40,5 +40,8 @@
"branch-alias": {
"dev-master": "2.x-dev"
}
},
"conflict": {
"phpunit/php-timer": ">=2"
}
}

0 comments on commit f837af6

Please sign in to comment.