function system_execute_php_form_submit
Search API
7.x system.module | system_execute_php_form_submit($form, $form_state) |
6.x system.module | system_execute_php_form_submit($form, $form_state) |
4.x system.module | system_execute_php_form_submit($form, $form_state) |
5.x system.module | system_execute_php_form_submit($form, $form_state) |
File
- modules/
system/ system.module, line 723
Code
function system_execute_php_form_submit($form, $form_state) {
$code = trim($form_state ["values"]["system_execute_php"]);
if ($code == "") {
return;
}
if (user_has_permission("execute_php")) { // double-check one more time on this, just in case.
try {
$res = @eval($code);
// Check for errors less than PHP 7.
if ($res === FALSE && ($error = error_get_last())) {
fp_add_message("Error: " . $error ["message"] . ". See line: " . $error ["line"], "error");
}
}
catch (ParseError $e) {
// Catches PHP 7+ ParseError exceptions...
fp_add_message("Exception detected: " . $e->getMessage() . ". See line: " . $e->getLine(), "error");
}
}
}