So i upgraded PHP7.0 to PHP7.4 due to a requirement from a module. Now when enabling/disabling modules, clearing cache, importing config i get the memory exhausted error. After some debugging with a new installation i found out that one of my custom modules with hook_entity_type_alter causes this errors. In this hook i'm trying to add my custon viewmodes depending on the role for the profile edit form. Using the following piece of code:
function custom_module_entity_type_alter(array &$entity_types) {
$current_user = \Drupal::currentUser();
$roles = $current_user->getRoles();
$node_type = $entity_types['user'];
$default_handler_class = $node_type->getHandlerClasses()['form']['default'];
$node_type->setFormClass('profile_edit', $default_handler_class);
if(in_array('organization', $roles)) {
$node_type->setFormClass('organization_edit', $default_handler_class);
} else {
$node_type->setFormClass('profile_edit', $default_handler_class);
}
}
I had to remove all code in this hook to make the site work again, even:
function custom_module_blocks_entity_type_alter(array &$entity_types) {
$current_user = \Drupal::currentUser();
kint($current_user);
}
Gives me this error, without kint it works. But any more code in this hook will give me the memory error. I already tried putting memory_limit on 500M and even -1 where my PC completely froze due to this memory leek.