-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Update ext/spl dependencies #14544
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
base: master
Are you sure you want to change the base?
Update ext/spl dependencies #14544
Conversation
Seems some CI are failing now? |
This updates and syncs ext/spl dependencies for the configure phase using the PHP_ADD_EXTENSION_DEP in Autotools and ADD_EXTENSION_DEP on Windows. ZEND_MOD_REQUIRED dependencies are listed so that extensions are properly sorted during runtime.
6ec148a
to
53a6d5f
Compare
Rechecking CI... |
Hm, interesting. Something doesn't work. Then these dependencies are very error prone I'm guessing. P.S.: It is probably related to the cyclic dependency between ext/standard and ext/spl ( |
Yes, the sorting algorithm in zend_API.c gets into an infinite loop because there are session, spl and standard which all depend on each other in one way or the other and doesn't know how to break out of that yet: while (b1 < end) {
try_again:
m = (zend_module_entry*)Z_PTR(b1->val);
if (!m->module_started && m->deps) {
const zend_module_dep *dep = m->deps;
while (dep->name) {
if (dep->type == MODULE_DEP_REQUIRED || dep->type == MODULE_DEP_OPTIONAL) {
b2 = b1 + 1;
while (b2 < end) {
r = (zend_module_entry*)Z_PTR(b2->val);
if (strcasecmp(dep->name, r->name) == 0) {
tmp = *b1;
*b1 = *b2;
*b2 = tmp;
goto try_again;
}
b2++;
}
}
dep++;
}
}
b1++;
} Technically cycling dependencies are an architecture error but these could be probably resolved by manually stop sorting them and either the first of the last wins. This should be rethought a bit though. |
Hum, I know SPL depends on Standard, but why does it depend on session? or is it standard that depends on session? |
I'll have to recheck this to properly explain but it is something like this: Ideal solution would be to fix the sorting algo but it might be very difficult to get this done properly and improve performance here (at least for me :D). |
I'm very confused, why is ext/session depending on ext/spl? I can't seem to find any usage of SPL in ext/session... |
Because of this https://bugs.php.net/53141 |
I don't see how adding SPL fixes that issue? Is this some unloading ordering issue or what? |
Yes, the ZEND_MOD_OPTIONAL in this case registers the spl extension before the session extension so its functions are available I think. I've even tested this back then on PHP-8.4-dev and was still required to load it before the session. |
Erg this is stupid... well I suppose yet another motivation to get back to #8294 |
This updates and syncs ext/spl dependencies for the configure phase using the PHP_ADD_EXTENSION_DEP in Autotools and ADD_EXTENSION_DEP on Windows. ZEND_MOD_REQUIRED dependencies are listed so that extensions are properly sorted during runtime.