fix regular expression validation when phpMyAdmin custom error handler is set
This commit is contained in:
@@ -131,6 +131,16 @@ function PMA_config_validate($validator_id, &$values, $isPostSource)
|
|||||||
return empty($new_result) ? true : $new_result;
|
return empty($new_result) ? true : $new_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Empty error handler, used to temporarily restore PHP internal error handler
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
function PMA_null_error_handler()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensures that $php_errormsg variable will be registered in case of an error
|
* Ensures that $php_errormsg variable will be registered in case of an error
|
||||||
* and enables output buffering (when $start = true).
|
* and enables output buffering (when $start = true).
|
||||||
@@ -141,17 +151,25 @@ function PMA_config_validate($validator_id, &$values, $isPostSource)
|
|||||||
*/
|
*/
|
||||||
function test_php_errormsg($start = true)
|
function test_php_errormsg($start = true)
|
||||||
{
|
{
|
||||||
static $old_html_errors, $old_track_errors;
|
static $old_html_errors, $old_track_errors, $old_error_reporting;
|
||||||
|
static $old_display_errors;
|
||||||
if ($start) {
|
if ($start) {
|
||||||
$old_html_errors = ini_get('html_errors');
|
$old_html_errors = ini_get('html_errors');
|
||||||
$old_track_errors = ini_get('track_errors');
|
$old_track_errors = ini_get('track_errors');
|
||||||
|
$old_display_errors = ini_get('display_errors');
|
||||||
|
$old_error_reporting = error_reporting(E_ALL);
|
||||||
ini_set('html_errors', false);
|
ini_set('html_errors', false);
|
||||||
ini_set('track_errors', true);
|
ini_set('track_errors', true);
|
||||||
|
ini_set('display_errors', true);
|
||||||
|
set_error_handler("PMA_null_error_handler");
|
||||||
ob_start();
|
ob_start();
|
||||||
} else {
|
} else {
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
|
restore_error_handler();
|
||||||
|
error_reporting($old_error_reporting);
|
||||||
ini_set('html_errors', $old_html_errors);
|
ini_set('html_errors', $old_html_errors);
|
||||||
ini_set('track_errors', $old_track_errors);
|
ini_set('track_errors', $old_track_errors);
|
||||||
|
ini_set('display_errors', $old_display_errors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user