function _field_encrypt_can_eval in Field Encryption 3.0.x
Determines if eval() is enabled on this PHP installation.
Several PHP extensions disable eval() as a security measure therefore we cannot assume it is available. The setting 'field_encrypt.use_eval_for_entity_hooks' provides a way for sites to disable this feature and add the hooks to a custom module. The code they need to add is provided on admin/reports/status. This will improve performance as code generated via eval() cannot be opcached.
Return value
bool Whether eval() is available.
5 calls to _field_encrypt_can_eval()
- DynamicEntityHooksTest::testDynamicFunctionRegistration in tests/
src/ Kernel/ DynamicEntityHooksTest.php - Tests _field_encrypt_define_entity_hooks().
- field_encrypt_entity_insert in ./
field_encrypt.module - Implements hook_entity_insert().
- field_encrypt_entity_update in ./
field_encrypt.module - Implements hook_entity_update().
- field_encrypt_requirements in ./
field_encrypt.install - Implements hook_requirements().
- _field_encrypt_define_entity_hooks in ./
field_encrypt.module - Creates entity hooks for entity types with encrypted fields.
File
- ./
field_encrypt.module, line 406 - Contains module hooks for field_encrypt.
Code
function _field_encrypt_can_eval() {
$can_eval = Settings::get('field_encrypt.use_eval_for_entity_hooks', TRUE);
// If you are using either of these extensions assume eval() is not available.
if ($can_eval && (extension_loaded('snuffleupagus') || extension_loaded('diseval'))) {
$can_eval = FALSE;
}
return $can_eval;
}