-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
swoole+runkit7_import have error #234
Comments
Related to #150 - Crashes in php 7.3+ are known https://github.com/runkit7/runkit7#runkit7-independent-fork-of-runkit-for-php-72 documents this
I spent hours looking into it then - the internals of php changed quite a bit since then, e.g. how PHP's internals for late static binding worked, and there didn't seem to be a straightforward way to get it to work, and the cause of any crashes was hard to determine from where crashes actually happened. Memory management of classes which were imported in a different context seemed to have changed and would no longer be straightforward One of the causes of crashes is importing a class that has an ancestor that was loaded in the caller. That used to work in php 7.2 reliably, but crashes in 7.4, probably due to the late static binding changes. Copying and pasting large parts of php's internals for selectively importing classes and functions might work, but wouldn't be maintainable and would probably introduce different bugs. |
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
I need this runkit7_import function, because it can update the business logic without restarting the service! I was wondering if it is possible to delete the classes with the same namespace, and then the new introduction can continue to work without causing PHP errors我非需要这个runkit7_import功能,因为这样可以在不重启服务就能热更新业务逻辑! 我在想是否可以,把命名空间相同的类删除掉,然后新的引入不引发PHP错误就可以继续工作 |
That was proposed in #29 - my response was #29 (comment) - the constraints on when it would be possible are too unpredictable for me to think it would be useful. There's https://www.php.net/manual/en/function.uopz-set-mock.php in a different extension but I don't know if it'd conflict with runkit7 or other extensions you'd have installed (xdebug, newrelic, etc). It might not even meet your use case.
|
Check if modification date of file changed, return if it didn't. (Probably need to call clearstatcache($pathToFile) first) I also thought of this method but didn’t implement it
|
I hope to change the public field of the class to protected at runtime, so that field access and setting will to be called by magic method "__get" and "__set". I don't know if there is any better implementation? |
For bug reports, please include:
php --version
(full output, including NTS/ZTS)php -v
PHP 7.4.9 (cli) (built: Sep 7 2020 15:23:27) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
Runkit7 version (
echo phpversion('runkit7');
). Make sure that the bug can be reproduced in the latest version on https://pecl.php.net/package/runkit7 (or newer)runkit7 version 4.0.0dev
OS version and compiler version
gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
CentOS Linux release 7.7.1908 (Core)
If possible, a minimal, self-contained snippet reproducing the problem,
or a link to the affected project and steps to reproduce the issue.
The text was updated successfully, but these errors were encountered: