mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
N°3251 - Null in data synchro (fixes the regression introduced in a1f5d80)
- restore the initial behavior, thanks to hipska through PR#166 - refactor so as to make it clear that no SQL injection is possible (and will never be) - add PHPUnit tests on the data synchronization => up to 20s to execute - fix utils::ExeciTopScript to alow its usage within the automated test
This commit is contained in:
@@ -534,11 +534,7 @@ try
|
||||
$aValues = array(); // Used to build the insert query
|
||||
foreach ($aRow as $iCol => $value)
|
||||
{
|
||||
if ($value === null) // Source CSV: "<NULL>"
|
||||
{
|
||||
$aValues[] = null;
|
||||
}
|
||||
elseif ($aIsDateToTransform[$iCol] !== false)
|
||||
if ($aIsDateToTransform[$iCol] !== false)
|
||||
{
|
||||
$bDateOnly = false;
|
||||
$sFormat = $sDateTimeFormat;
|
||||
@@ -550,7 +546,7 @@ try
|
||||
$sDate = ChangeDateFormat($value, $sFormat, $bDateOnly);
|
||||
if ($sDate === false)
|
||||
{
|
||||
$aValues[] = CMDBSource::Quote('');
|
||||
$aValues[] = '';
|
||||
if ($sOutput === 'details')
|
||||
{
|
||||
$oP->add("$iRow: Wrong format for {$aIsDateToTransform[$iCol]} column $iCol: '$value' does not match the expected format: '$sFormat' (column skipped)\n");
|
||||
@@ -558,15 +554,15 @@ try
|
||||
}
|
||||
else
|
||||
{
|
||||
$aValues[] = CMDBSource::Quote($sDate);
|
||||
$aValues[] = $sDate;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$aValues[] = CMDBSource::Quote($value);
|
||||
$aValues[] = $value;
|
||||
}
|
||||
}
|
||||
$sValues = implode(', ', $aValues);
|
||||
$sValues = implode(', ', CMDBSource::Quote($aValues));
|
||||
$sInsert = "INSERT INTO `$sTable` ($sInsertColumns) VALUES ($sValues)";
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user