Merge pull request #18188 from MoonE/qa-fix-gis-insert-form
Fix inserting gis-data via insert/edit form
This commit is contained in:
commit
d0997e0377
@ -1605,7 +1605,11 @@ class InsertEdit
|
||||
in_array($multiEditFuncs[$key], $gisFromTextFunctions)
|
||||
|| in_array($multiEditFuncs[$key], $gisFromWkbFunctions)
|
||||
) {
|
||||
return $multiEditFuncs[$key] . "('" . $this->dbi->escapeString($currentValue) . "')";
|
||||
preg_match('/^(\'?)(.*?)\1(?:,(\d+))?$/', $currentValue, $matches);
|
||||
$escapedParams = "'" . $this->dbi->escapeString($matches[2])
|
||||
. (isset($matches[3]) ? "'," . $matches[3] : "'");
|
||||
|
||||
return $multiEditFuncs[$key] . '(' . $escapedParams . ')';
|
||||
}
|
||||
|
||||
if (
|
||||
|
||||
@ -2464,6 +2464,36 @@ class InsertEditTest extends AbstractTestCase
|
||||
'0'
|
||||
);
|
||||
$this->assertTrue(password_verify("a'c", mb_substr($result, 1, -1)));
|
||||
|
||||
// case 7 / 8 / 9 / 10
|
||||
$gisParams = [
|
||||
['ST_GeomFromText'],
|
||||
[],
|
||||
['ST_GeomFromText'],
|
||||
"'POINT(3 4)',4326",
|
||||
[],
|
||||
[],
|
||||
[],
|
||||
'0',
|
||||
];
|
||||
// case 7
|
||||
$result = $this->insertEdit->getCurrentValueAsAnArrayForMultipleEdit(...$gisParams);
|
||||
$this->assertEquals('ST_GeomFromText(\'POINT(3 4)\',4326)', $result);
|
||||
|
||||
// case 8
|
||||
$gisParams[3] = "POINT(3 4),4326";
|
||||
$result = $this->insertEdit->getCurrentValueAsAnArrayForMultipleEdit(...$gisParams);
|
||||
$this->assertEquals('ST_GeomFromText(\'POINT(3 4)\',4326)', $result);
|
||||
|
||||
// case 9
|
||||
$gisParams[3] = "'POINT(3 4)'";
|
||||
$result = $this->insertEdit->getCurrentValueAsAnArrayForMultipleEdit(...$gisParams);
|
||||
$this->assertEquals('ST_GeomFromText(\'POINT(3 4)\')', $result);
|
||||
|
||||
// case 10
|
||||
$gisParams[3] = "POINT(3 4)";
|
||||
$result = $this->insertEdit->getCurrentValueAsAnArrayForMultipleEdit(...$gisParams);
|
||||
$this->assertEquals('ST_GeomFromText(\'POINT(3 4)\')', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user