Skip to content
This repository was archived by the owner on Jun 26, 2023. It is now read-only.

work around for the create_function deprecation#8

Open
dustinrue wants to merge 3 commits into10up:mhfrom
dustinrue:hotfix/fix-deprecation
Open

work around for the create_function deprecation#8
dustinrue wants to merge 3 commits into10up:mhfrom
dustinrue:hotfix/fix-deprecation

Conversation

@dustinrue
Copy link
Copy Markdown

Description of the Change

This change is intended to work around the "create_function" deprecation while allowing it to work as it did before.

Alternate Designs

Other methods to resolve were not attempted/test

Benefits

Compatibility with future versions of PHP

Possible Drawbacks

It is eval'ing code without checks

Verification Process

Gained an understanding of the current setup and replicated the documented method for running code but using an anonymous function instead.

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Applicable Issues

Changelog Entry

$fun = create_function('', $function);
$value = $fun();

$fun = function($function) {
Copy link
Copy Markdown
Collaborator

@tott tott Dec 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i feel we should not define the variable as this would allow calling $fun outside of this context. can we just
$value = eval( $function );
instead to keep it anonymous.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that should work just fine as well

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants