mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2024-03-22 13:10:41 +08:00
sanitize both single rows and multiple ones
This commit is contained in:
parent
b54308a77e
commit
b133c2e233
|
@ -585,10 +585,9 @@ class Database extends AbstractData
|
||||||
if (self::$_type === 'oci' && is_array($result)) {
|
if (self::$_type === 'oci' && is_array($result)) {
|
||||||
// returned column names are all upper case, convert these back
|
// returned column names are all upper case, convert these back
|
||||||
// returned CLOB values are streams, convert these into strings
|
// returned CLOB values are streams, convert these into strings
|
||||||
$result = array_combine(
|
$result = $firstOnly ?
|
||||||
array_map('strtolower', array_keys($result)),
|
self::_sanitizeOciRow($result) :
|
||||||
array_map('self::_sanitizeClob', array_values($result))
|
array_map('self::_sanitizeOciRow', $result);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -839,7 +838,7 @@ class Database extends AbstractData
|
||||||
*
|
*
|
||||||
* From: https://stackoverflow.com/questions/36200534/pdo-oci-into-a-clob-field
|
* From: https://stackoverflow.com/questions/36200534/pdo-oci-into-a-clob-field
|
||||||
*
|
*
|
||||||
* @access private
|
* @access public
|
||||||
* @static
|
* @static
|
||||||
* @param int|string|resource $value
|
* @param int|string|resource $value
|
||||||
* @return int|string
|
* @return int|string
|
||||||
|
@ -865,6 +864,22 @@ class Database extends AbstractData
|
||||||
return preg_replace('/[^A-Za-z0-9_]+/', '', self::$_prefix . $identifier);
|
return preg_replace('/[^A-Za-z0-9_]+/', '', self::$_prefix . $identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sanitizes row returned by OCI
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @static
|
||||||
|
* @param array $row
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private static function _sanitizeOciRow($row)
|
||||||
|
{
|
||||||
|
return array_combine(
|
||||||
|
array_map('strtolower', array_keys($row)),
|
||||||
|
array_map('self::_sanitizeClob', array_values($row))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* upgrade the database schema from an old version
|
* upgrade the database schema from an old version
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user