1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-19 04:02:28 +02:00

PHP 7.2 null fix courtesy of Miro.

This commit is contained in:
Cameron 2018-12-18 12:12:46 -08:00
parent 0c444dfb69
commit 519001a690

View File

@ -927,7 +927,7 @@ class e_db_mysql
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]));
$bind[$fk] = array('value'=>$this->_getPDOValue($fieldTypes[$fk],$fv), 'type'=> $this->_getPDOType($fieldTypes[$fk],$this->_getPDOValue($fieldTypes[$fk],$fv)));
}
$valList= implode(', ', $tmp);
@ -1148,7 +1148,7 @@ class e_db_mysql
if($ftype != 'cmd')
{
$this->pdoBind[$fn] = array('value'=>$this->_getPDOValue($ftype,$fv), 'type'=> $this->_getPDOType($ftype));
$this->pdoBind[$fn] = array('value'=>$this->_getPDOValue($ftype,$fv), 'type'=> $this->_getPDOType($ftype,$this->_getPDOValue($ftype,$fv)));
}
}
@ -1360,7 +1360,11 @@ class e_db_mysql
break;
case 'null':
return null;
return (
is_string($fieldValue) && (
($fieldValue !== '_NULL_') && ($fieldValue !== '')
)
) ? $fieldValue : null;
break;
case 'array':
@ -1397,7 +1401,7 @@ class e_db_mysql
* @param $type
* @return int
*/
private function _getPDOType($type)
private function _getPDOType($type, $value = null)
{
switch($type)
{
@ -1407,7 +1411,7 @@ class e_db_mysql
break;
case 'null':
return PDO::PARAM_NULL;
return ($value === null) ? PDO::PARAM_NULL : PDO::PARAM_STR;
break;
case 'cmd':