Deprecated function: Function create_function() is deprecated in Drupal\views_php\Plugin\views\field\ViewsPhp->render() (line 122 of modules/contrib/views_php/src/Plugin/views/field/ViewsPhp.php).

i have this error after install purger, what are u all think?

Comments

nor sairi created an issue. See original summary.

nor sairi’s picture

Issue summary: View changes
aayush23’s picture

StatusFileSize
new7.43 KB

I have created a patch for this. Please find a patch below.

aayush23’s picture

Status: Active » Needs work
aayush23’s picture

Status: Needs work » Needs review
nor sairi’s picture

#3, tested and its work. tq aayush

nor sairi’s picture

Status: Needs review » Fixed
tobiasb’s picture

Assigned: nor sairi » Unassigned
Status: Fixed » Closed (duplicate)
gerson.analista’s picture

Status: Closed (duplicate) » Needs review
Related issues: +#2274543: [7.x-1.x] Remove usage of deprecated create_function()

I think that this issue is not duplicate.

The issue #2274543: Remove usage of deprecated create_function() calls for PHP 7.2+ future proofing - https://www.drupal.org/project/views_php/issues/2274543 is for Drupal 7.

I believe the most correct would be to add as a related issue.

gerson.analista’s picture

#3, tested and its work. thanks aayush

tobiasb’s picture

In the normal way, we should create a patch for D8 and then backport it for D7. But I can also life with two issues. ;-)

nor sairi’s picture

Status: Needs review » Reviewed & tested by the community
joseph.olstad’s picture

In D7 , this technique had issues in combination with VBO, so we ended up using the closure library instead.

It is likely that the D8 solution using the 'eval' function above may have the same complication in combination with VBO in D8.

If so, please review the D7 patch for how it is done.
#2274543-100: [7.x-1.x] Remove usage of deprecated create_function()

the authors of the closure library helped us figure this out.

proweb.ua’s picture

#3 works

promo-il’s picture

  1. this error only php higher than php 7.1 There is no errors "Function create_function() is deprecated" (php 7.1)
  2. for php 7.2 patch #3 is OK
liam morland’s picture

The patch in #3 may have object serialization problems since functions are assigned to object properties. This is avoided in the approach taken for D7 in #2274543-180: [7.x-1.x] Remove usage of deprecated create_function().

anybody’s picture

@Liam Morland So we should set this back to Needs work?

liam morland’s picture

Status: Reviewed & tested by the community » Needs work