mirror of
https://github.com/e107inc/e107.git
synced 2025-07-30 19:30:25 +02:00
Guard type errors in e_db::insert() implementations
This commit is contained in:
@@ -774,7 +774,8 @@ class e_db_pdo implements e_db
|
||||
// See if we need to auto-add field types array
|
||||
if(!isset($arg['_FIELD_TYPES']))
|
||||
{
|
||||
$arg = array_merge($arg, $this->getFieldDefs($tableName));
|
||||
$fieldDefs = $this->getFieldDefs($tableName);
|
||||
if (is_array($fieldDefs)) $arg = array_merge($arg, $fieldDefs);
|
||||
}
|
||||
|
||||
$argUpdate = $arg; // used when DUPLICATE_KEY_UPDATE is active;
|
||||
@@ -801,7 +802,8 @@ class e_db_pdo implements e_db
|
||||
foreach($arg['data'] as $fk => $fv)
|
||||
{
|
||||
$tmp[] = ':'.$fk;
|
||||
$bind[$fk] = array('value'=>$this->_getPDOValue($fieldTypes[$fk],$fv), 'type'=> $this->_getPDOType($fieldTypes[$fk],$this->_getPDOValue($fieldTypes[$fk],$fv)));
|
||||
$fieldType = isset($fieldTypes[$fk]) ? $fieldTypes[$fk] : null;
|
||||
$bind[$fk] = array('value'=>$this->_getPDOValue($fieldType,$fv), 'type'=> $this->_getPDOType($fieldType,$this->_getPDOValue($fieldType,$fv)));
|
||||
}
|
||||
|
||||
$valList= implode(', ', $tmp);
|
||||
@@ -983,7 +985,8 @@ class e_db_pdo implements e_db
|
||||
// See if we need to auto-add field types array
|
||||
if(!isset($arg['_FIELD_TYPES']))
|
||||
{
|
||||
$arg = array_merge($arg, $this->getFieldDefs($tableName));
|
||||
$fieldDefs = $this->getFieldDefs($tableName);
|
||||
if (is_array($fieldDefs)) $arg = array_merge($arg, $fieldDefs);
|
||||
}
|
||||
|
||||
$fieldTypes = $this->_getTypes($arg);
|
||||
@@ -2715,6 +2718,7 @@ class e_db_pdo implements e_db
|
||||
|
||||
$baseStruct = $dbAdm->get_current_table($tableName);
|
||||
$fieldDefs = $dbAdm->parse_field_defs($baseStruct[0][2]); // Required definitions
|
||||
if (!$fieldDefs) return false;
|
||||
|
||||
$outDefs = array();
|
||||
|
||||
|
@@ -921,7 +921,8 @@ class e_db_mysql implements e_db
|
||||
// See if we need to auto-add field types array
|
||||
if(!isset($arg['_FIELD_TYPES']))
|
||||
{
|
||||
$arg = array_merge($arg, $this->getFieldDefs($tableName));
|
||||
$fieldDefs = $this->getFieldDefs($tableName);
|
||||
if (is_array($fieldDefs)) $arg = array_merge($arg, $fieldDefs);
|
||||
}
|
||||
|
||||
$argUpdate = $arg; // used when DUPLICATE_KEY_UPDATE is active;
|
||||
@@ -948,7 +949,8 @@ class e_db_mysql implements e_db
|
||||
foreach($arg['data'] as $fk => $fv)
|
||||
{
|
||||
$tmp[] = ($this->pdo == true) ? ':'.$fk : $this->_getFieldValue($fk, $fv, $fieldTypes);
|
||||
$bind[$fk] = array('value'=>$this->_getPDOValue($fieldTypes[$fk],$fv), 'type'=> $this->_getPDOType($fieldTypes[$fk],$this->_getPDOValue($fieldTypes[$fk],$fv)));
|
||||
$fieldType = isset($fieldTypes[$fk]) ? $fieldTypes[$fk] : null;
|
||||
$bind[$fk] = array('value'=>$this->_getPDOValue($fieldType,$fv), 'type'=> $this->_getPDOType($fieldType,$this->_getPDOValue($fieldType,$fv)));
|
||||
}
|
||||
|
||||
$valList= implode(', ', $tmp);
|
||||
@@ -1155,7 +1157,8 @@ class e_db_mysql implements e_db
|
||||
// See if we need to auto-add field types array
|
||||
if(!isset($arg['_FIELD_TYPES']))
|
||||
{
|
||||
$arg = array_merge($arg, $this->getFieldDefs($tableName));
|
||||
$fieldDefs = $this->getFieldDefs($tableName);
|
||||
if (is_array($fieldDefs)) $arg = array_merge($arg, $fieldDefs);
|
||||
}
|
||||
|
||||
$fieldTypes = $this->_getTypes($arg);
|
||||
@@ -3155,6 +3158,7 @@ class e_db_mysql implements e_db
|
||||
|
||||
$baseStruct = $dbAdm->get_current_table($tableName);
|
||||
$fieldDefs = $dbAdm->parse_field_defs($baseStruct[0][2]); // Required definitions
|
||||
if (!$fieldDefs) return false;
|
||||
|
||||
$outDefs = array();
|
||||
|
||||
|
Reference in New Issue
Block a user