Restored compatibility with PHP 5.6

This commit is contained in:
Lionel Laffineur 2024-03-03 19:46:34 +01:00
parent 5020f92f18
commit 00a9ae1148

View file

@ -1101,13 +1101,13 @@ if (!defined("DRIVER")) {
* @return string
*/
function unconvert_field($field, $return) {
if (preg_match("~binary~", $field["type"] ?? null)) {
if (preg_match("~binary~", isset($field["type"]) ? $field["type"] : null)) {
$return = "UNHEX($return)";
}
if (isset($field["type"]) && $field["type"] == "bit") {
$return = "CONV($return, 2, 10) + 0";
}
if (preg_match("~geometry|point|linestring|polygon~", $field["type"] ?? null)) {
if (preg_match("~geometry|point|linestring|polygon~", isset($field["type"]) ? $field["type"] : null)) {
$prefix = (min_version(8) ? "ST_" : "");
$return = $prefix . "GeomFromText($return, $prefix" . "SRID($field[field]))";
}