Fix for travis and PHP 8.1 with PGSQL

This commit is contained in:
Laurent Destailleur
2022-09-20 21:13:51 +02:00
parent 46011509bc
commit 8f1ea59bc6
4 changed files with 43 additions and 2 deletions

View File

@@ -1164,7 +1164,17 @@ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0)
function dol_clone($object, $native = 0)
{
if (empty($native)) {
$tmpsavdb = null;
if (isset($object->db) && isset($object->db->db) && is_object($object->db->db) && get_class($object->db->db) == 'PgSql\Connection') {
$tmpsavdb = $object->db;
unset($object->db); // Such property can not be serialized when PgSql/Connection
}
$myclone = unserialize(serialize($object)); // serialize then unserialize is hack to be sure to have a new object for all fields
if ($tmpsavdb) {
$object->db = $tmpsavdb;
}
} else {
$myclone = clone $object; // PHP clone is a shallow copy only, not a real clone, so properties of references will keep the reference (refering to the same target/variable)
}
@@ -3723,6 +3733,8 @@ function isValidMXRecord($domain)
return 0;
}
}
// function idn_to_ascii or checkdnsrr does not exists
return -1;
}
@@ -4957,7 +4969,9 @@ function dol_print_error($db = '', $error = '', $errors = null)
// Return a http header with error code if possible
if (!headers_sent()) {
top_httphead();
if (function_exists('top_httphead')) { // In CLI context, the method does not exists
top_httphead();
}
http_response_code(500);
}