Fix compatibility with PHP 8
This commit is contained in:
parent
697eedc6a1
commit
50bb83dbf2
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
error_reporting(6135); // errors and warnings
|
||||
error_reporting(6133); // errors
|
||||
|
||||
include "../adminer/include/coverage.inc.php";
|
||||
|
||||
|
@ -60,7 +60,7 @@ if (!defined("SID")) {
|
|||
|
||||
// disable magic quotes to be able to use database escaping function
|
||||
remove_slashes(array(&$_GET, &$_POST, &$_COOKIE), $filter);
|
||||
if (get_magic_quotes_runtime()) {
|
||||
if (function_exists("get_magic_quotes_runtime") && get_magic_quotes_runtime()) {
|
||||
set_magic_quotes_runtime(false);
|
||||
}
|
||||
@set_time_limit(0); // @ - can be disabled
|
||||
|
|
|
@ -62,7 +62,7 @@ function number_type() {
|
|||
* @return null modified in place
|
||||
*/
|
||||
function remove_slashes($process, $filter = false) {
|
||||
if (get_magic_quotes_gpc()) {
|
||||
if (function_exists("get_magic_quotes_gpc") && get_magic_quotes_gpc()) {
|
||||
while (list($key, $val) = each($process)) {
|
||||
foreach ($val as $k => $v) {
|
||||
unset($process[$key][$k]);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
// PDO can be used in several database drivers
|
||||
if (extension_loaded('pdo')) {
|
||||
/*abstract*/ class Min_PDO extends PDO {
|
||||
var $_result, $server_info, $affected_rows, $errno, $error;
|
||||
/*abstract*/ class Min_PDO {
|
||||
var $_result, $server_info, $affected_rows, $errno, $error, $pdo;
|
||||
|
||||
function __construct() {
|
||||
global $adminer;
|
||||
|
@ -14,21 +14,21 @@ if (extension_loaded('pdo')) {
|
|||
|
||||
function dsn($dsn, $username, $password, $options = array()) {
|
||||
try {
|
||||
parent::__construct($dsn, $username, $password, $options);
|
||||
$this->pdo = new PDO($dsn, $username, $password, $options);
|
||||
} catch (Exception $ex) {
|
||||
auth_error(h($ex->getMessage()));
|
||||
}
|
||||
$this->setAttribute(13, array('Min_PDOStatement')); // 13 - PDO::ATTR_STATEMENT_CLASS
|
||||
$this->server_info = @$this->getAttribute(4); // 4 - PDO::ATTR_SERVER_VERSION
|
||||
$this->pdo->setAttribute(13, array('Min_PDOStatement')); // 13 - PDO::ATTR_STATEMENT_CLASS
|
||||
$this->server_info = @$this->pdo->getAttribute(4); // 4 - PDO::ATTR_SERVER_VERSION
|
||||
}
|
||||
|
||||
/*abstract function select_db($database);*/
|
||||
|
||||
function query($query, $unbuffered = false) {
|
||||
$result = parent::query($query);
|
||||
$result = $this->pdo->query($query);
|
||||
$this->error = "";
|
||||
if (!$result) {
|
||||
list(, $this->errno, $this->error) = $this->errorInfo();
|
||||
list(, $this->errno, $this->error) = $this->pdo->errorInfo();
|
||||
if (!$this->error) {
|
||||
$this->error = lang('Unknown error.');
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
Adminer 4.7.8-dev:
|
||||
Support PHP 8
|
||||
|
||||
Adminer 4.7.7 (released 2020-05-11):
|
||||
Fix open redirect if Adminer is accessible at //adminer.php%2F@
|
||||
|
|
12
compile.php
12
compile.php
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
error_reporting(6135); // errors and warnings
|
||||
error_reporting(6133); // errors
|
||||
include dirname(__FILE__) . "/adminer/include/version.inc.php";
|
||||
include dirname(__FILE__) . "/externals/JsShrink/jsShrink.php";
|
||||
|
||||
|
@ -233,7 +233,7 @@ function php_shrink($input) {
|
|||
$short_variables[$key] = short_identifier($number, $chars); // could use also numbers and \x7f-\xff
|
||||
}
|
||||
|
||||
$set = array_flip(preg_split('//', '!"#$%&\'()*+,-./:;<=>?@[\]^`{|}'));
|
||||
$set = array_flip(preg_split('//', '!"#$%&\'()*+,-./:;<=>?@[]^`{|}'));
|
||||
$space = '';
|
||||
$output = '';
|
||||
$in_echo = false;
|
||||
|
@ -315,6 +315,14 @@ function compile_file($match) {
|
|||
return '"' . add_quo_slashes($file) . '"';
|
||||
}
|
||||
|
||||
if (!function_exists("each")) {
|
||||
function each(&$arr) {
|
||||
$key = key($arr);
|
||||
next($arr);
|
||||
return $key === null ? false : array($key, $arr[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
function min_version() {
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue