Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any other function that can replace 'runkit_import' in php7 #72

Closed
pandabajie opened this issue Feb 7, 2017 · 4 comments · Fixed by #235
Closed

Is there any other function that can replace 'runkit_import' in php7 #72

pandabajie opened this issue Feb 7, 2017 · 4 comments · Fixed by #235

Comments

@pandabajie
Copy link

pandabajie commented Feb 7, 2017

Is there any other function that can replace 'runkit_import' in php7?Please tell us,thank you!

@pandabajie pandabajie changed the title What to replace the “runkit_import” method Is there any other function that can replace 'runkit_import' in php7 Feb 7, 2017
@TysonAndre
Copy link
Member

Is there any other function that can replace 'runkit_import' in php7

No, and there are no built in php functions.

runkit_import was temporarily disabled/removed while working on bug fixes for other, more commonly used features.

  1. It may be reintroduced in the future, without supporting adding/removing properties of classes that already exist. (Importing classes and functions which don't already exist seems doable).

One might be able to hack something together in pure php without runkit, using https://github.com/nikic/PHP-Parser , filtering the AST to only include top-level class/function declarations (and namespace choices), converting the AST back to php code, and eval()ing the php code

@pandabajie
Copy link
Author

But how can I replace "runkit_import($controller_file, RUNKIT_IMPORT_CLASS_METHODS|RUNKIT_IMPORT_OVERRIDE);" ?
This is the previous version,but it's wrong one,
Thank you very much!

@TysonAndre
Copy link
Member

There's no replacement for runkit_import($controller_file, RUNKIT_IMPORT_CLASS_METHODS|RUNKIT_IMPORT_OVERRIDE) at this moment, in this repo or in any other projects I'm aware of.

That may be implemented in a future release of runkit7.

@TysonAndre
Copy link
Member

#107 is a work in progress, may help for that use case (runkit_import($controller_file, RUNKIT_IMPORT_CLASS_METHODS|RUNKIT_IMPORT_OVERRIDE);)

It adds classes and methods and functions, but does not support properties, even if the class is new (Will need to investigate further how that would be done properly).

TysonAndre added a commit that referenced this issue Sep 8, 2020
There are various known crashes in runkit7_import
due to overrides, extending classes that were already loaded,
late static binding, etc.

Related to #234, #211, #185, #150, #135, #112

Closes #72
TysonAndre added a commit that referenced this issue Sep 8, 2020
There are various known crashes in runkit7_import
due to overrides, extending classes that were already loaded,
late static binding, etc.

Fixing this would probably require copying large amounts of php's
functionality for php 7.3, 7.4, 8.0, etc.,
and would likely be a massive undertaking.
Crashes and test failures often occur far away from the buggy code
causing the crash.

Related to #234, #211, #185, #150, #135, #112

Closes #72
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants