• There’s an issue on line 1025 in gravityforms-update-post.php where the declared variable in the use() is the same as the declared parameter in the anonymous function.

    Here’s the error I recieved in testing (using PHP Compatibility Checker):

    1025 | ERROR | Variables bound to a closure via the use construct cannot use the same name as superglobals, $this, or a declared parameter since PHP 7.1.

    Here’s what that line looks like:

    add_filter( 'gform_field_value_' . $field['inputName'], function($value) use($value) { return $value; } );

    All I did was change the declared variable and return variable from $value to $val, and it seems to fix the issue:

    add_filter( 'gform_field_value_' . $field['inputName'], function($val) use($value) { return $val; } );

Viewing 7 replies - 1 through 7 (of 7 total)
  • Yes same issue with php 7.2. This fix fixed issue on php 7.2

    lauzis,

    Are you saying that if we are using 7.2. this error is not an issue? Or that it is still an issue?

    I also found this using the PHP Compatibility Checker. Hoping that it won’t be an issue!

    Does anyone have a solution?

    I’m running php 7.2 and get the following error:

    Fatal error: Cannot use lexical variable $value as a parameter name in /nas/content/staging/scribetribenew/wp-content/plugins/gravity-forms-post-updates/gravityforms-update-post.php on line 1021

    Doing the above fix of changing $value to $val only changed the error to this:

    Cannot use lexical variable $val as a parameter name in /nas/content/staging/scribetribenew/wp-content/plugins/gravity-forms-post-updates/gravityforms-update-post.php on line 1021

    Please help!
    ======
    UPDATE
    ======
    FOUND THE SOLUTION HERE: https://github.com/jupitercow/gravity-forms-post-updates/issues/16

    Replace with:
    add_filter( ‘gform_field_value_’ . $field[‘inputName’], function($v) use($value) { return $v; } );

    • This reply was modified 5 years, 5 months ago by alexwilk.
    • This reply was modified 5 years, 5 months ago by alexwilk.

    THANK YOU SO MUCH!!!

    Yes Thank you very much!
    I got my site down this morning because of that issue and was able to fix it in minutes…

    OMG! Thank you, thank you, THAAAAANK YOU!! 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Found issue with PHP 7.1+’ is closed to new replies.