Merge branch 'QA_5_0'

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2020-07-28 17:58:27 +02:00
commit bcf21c4081
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889
5 changed files with 29 additions and 5 deletions

View File

@ -90,6 +90,7 @@ phpMyAdmin - ChangeLog
- issue #16146 Fixed sorting did not keep the selector of number of rows
- issue #16194 Fixed SQL query does not appear in case of editing view where definer is not you on MySQL 8
- issue #16255 Fix tinyint(1) shown as INT on Search page
- issue #16256 Fix "Warning: error_reporting() has been disabled for security reasons" on php 7.x
5.0.2 (2020-03-20)
- issue Fixed deprecation warning "implode(): Passing glue string after array is deprecated." function on export page

View File

@ -389,7 +389,7 @@ class Config
return false;
}
$canUseErrorReporting = function_exists('error_reporting');
$canUseErrorReporting = Util::isErrorReportingAvailable();
$oldErrorReporting = null;
if ($canUseErrorReporting) {
$oldErrorReporting = error_reporting(0);
@ -450,7 +450,7 @@ class Config
* Parses the configuration file, we throw away any errors or
* output.
*/
$canUseErrorReporting = function_exists('error_reporting');
$canUseErrorReporting = Util::isErrorReportingAvailable();
$oldErrorReporting = null;
if ($canUseErrorReporting) {
$oldErrorReporting = error_reporting(0);

View File

@ -26,7 +26,6 @@ use function array_splice;
use function count;
use function defined;
use function error_reporting;
use function function_exists;
use function headers_sent;
use function htmlspecialchars;
use function set_error_handler;
@ -69,7 +68,7 @@ class ErrorHandler
if (! defined('TESTSUITE')) {
set_error_handler([$this, 'handleError']);
}
if (! function_exists('error_reporting')) {
if (! Util::isErrorReportingAvailable()) {
return;
}
@ -183,7 +182,7 @@ class ErrorHandler
string $errfile,
int $errline
): void {
if (function_exists('error_reporting')) {
if (Util::isErrorReportingAvailable()) {
/**
* Check if Error Control Operator (@) was used, but still show
* user errors even in this case.

View File

@ -19,6 +19,7 @@ use stdClass;
use const ENT_COMPAT;
use const ENT_QUOTES;
use const PHP_INT_SIZE;
use const PHP_MAJOR_VERSION;
use const PREG_OFFSET_CAPTURE;
use const STR_PAD_LEFT;
use function abs;
@ -49,6 +50,7 @@ use function htmlspecialchars;
use function htmlspecialchars_decode;
use function implode;
use function in_array;
use function ini_get;
use function is_array;
use function is_callable;
use function is_object;
@ -3260,4 +3262,25 @@ class Util
return '';
}
/**
* Check if error reporting is available
*/
public static function isErrorReportingAvailable(): bool
{
// issue #16256 - PHP 7.x does not return false for a core function
if (PHP_MAJOR_VERSION < 8) {
$disabled = ini_get('disable_functions');
if (is_string($disabled)) {
$disabled = explode(',', $disabled);
$disabled = array_map(static function (string $part) {
return trim($part);
}, $disabled);
return ! in_array('error_reporting', $disabled);
}
}
return function_exists('error_reporting');
}
}

View File

@ -38,6 +38,7 @@ define('PHPMYADMIN', true);
require ROOT_PATH . 'libraries/vendor_config.php';
// issue #16256 - This only works with php 8.0+
if (function_exists('error_reporting')) {
error_reporting(E_ALL);
}