mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 17:29:21 +02:00
Fix compatibility with PHP 8.0 (latest XAMPP)
Solution by doctrine developers
This commit is contained in:
parent
6b07d56627
commit
5bd5aa0edf
@ -23,6 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
abstract class OTS_Base_DB extends PDO implements IOTS_DB
|
abstract class OTS_Base_DB extends PDO implements IOTS_DB
|
||||||
{
|
{
|
||||||
|
use OTS_DB_PDOQuery;
|
||||||
/**
|
/**
|
||||||
* Tables prefix.
|
* Tables prefix.
|
||||||
*
|
*
|
||||||
@ -74,7 +75,7 @@ abstract class OTS_Base_DB extends PDO implements IOTS_DB
|
|||||||
return $this->fieldName($this->prefix . $name);
|
return $this->fieldName($this->prefix . $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function query($query)
|
private function doQuery(...$args)
|
||||||
{
|
{
|
||||||
$this->queries++;
|
$this->queries++;
|
||||||
|
|
||||||
@ -82,7 +83,7 @@ abstract class OTS_Base_DB extends PDO implements IOTS_DB
|
|||||||
$startTime = microtime(true);
|
$startTime = microtime(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret = parent::query($query);
|
$ret = parent::query(...$args);;
|
||||||
if($this->logged) {
|
if($this->logged) {
|
||||||
$totalTime = microtime(true) - $startTime;
|
$totalTime = microtime(true) - $startTime;
|
||||||
$this->log .= round($totalTime, 4) . ' ms - ' . $query . PHP_EOL;
|
$this->log .= round($totalTime, 4) . ' ms - ' . $query . PHP_EOL;
|
||||||
|
25
system/libs/pot/OTS_DB_PDOQuery.php
Normal file
25
system/libs/pot/OTS_DB_PDOQuery.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (PHP_VERSION_ID >= 80000) {
|
||||||
|
trait OTS_DB_PDOQuery
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
|
public function query(?string $query = null, ?int $fetchMode = null, mixed ...$fetchModeArgs)
|
||||||
|
{
|
||||||
|
return $this->doQuery($query, $fetchMode, ...$fetchModeArgs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
trait OTS_DB_PDOQuery
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
|
public function query()
|
||||||
|
{
|
||||||
|
return $this->doQuery(...func_get_args());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -86,7 +86,7 @@ class OTS_MonstersList implements Iterator, Countable, ArrayAccess
|
|||||||
*
|
*
|
||||||
* @param array $properties List of object properties.
|
* @param array $properties List of object properties.
|
||||||
*/
|
*/
|
||||||
public function __set_state($properties)
|
public static function __set_state($properties)
|
||||||
{
|
{
|
||||||
$object = new self();
|
$object = new self();
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ class OTS_SpellsList implements IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param array $properties List of object properties.
|
* @param array $properties List of object properties.
|
||||||
*/
|
*/
|
||||||
public function __set_state($properties)
|
public static function __set_state($properties)
|
||||||
{
|
{
|
||||||
$object = new self();
|
$object = new self();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user