symfony 1.4 - Warning: A non-numeric value encountered

Viewed 1460

Warning: A non-numeric value encountered in C:\Program Files (x86)\Ampps\www\Symfony_project\lib\vendor\symfony1\lib\yaml\sfYamlInline.php(138) : runtime-created function on line 1

Use php 7.1

if (
      (1 == count($keys) && '0' == $keys[0])
      ||
    Line 138->  (count($keys) > 1 && array_reduce($keys, create_function('$v,$w', 'return (integer) $v + $w;'), 0) == count($keys) * (count($keys) - 1) / 2))

23 0.1704 3586632 __lambda_func( ) ...\sfYamlInline.php:138

How to fix?

2 Answers

There are some forks of symfony1 out there that are compatible with PHP7.1.

In this case, you can patch this easily by changing 'return (integer) $v + $w;' to 'return (integer) $v + (integer) $w;'.

(count($keys) > 1 && array_reduce($keys, create_function('$v,$w', 'return (integer) $v + $w;'), 0) == count($keys) * (count($keys) - 1) / 2))      [position 138:48]    

Should be replaced with

(count($keys) > 1 && array_reduce($keys, function($v,$w) { return ((int) $v + (int) $w);}, 0) == count($keys) * (count($keys) - 1) / 2))
Related