mirror of
https://github.com/vrana/adminer.git
synced 2025-08-18 20:31:19 +02:00
Fix compatibility with PHP 8
This commit is contained in:
@@ -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.');
|
||||
}
|
||||
|
Reference in New Issue
Block a user