mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-04 18:42:40 +00:00
Merge pull request #1620 from ovidiupruteanu/patch-1
Fixed handling null values in Sqlserver->value(). Fixes #3768
This commit is contained in:
commit
1499723252
2 changed files with 5 additions and 1 deletions
|
@ -571,7 +571,7 @@ class Sqlserver extends DboSource {
|
|||
* @return string Quoted and escaped data
|
||||
*/
|
||||
public function value($data, $column = null) {
|
||||
if (is_array($data) || is_object($data)) {
|
||||
if ($data === null || is_array($data) || is_object($data)) {
|
||||
return parent::value($data, $column);
|
||||
} elseif (in_array($data, array('{$__cakeID__$}', '{$__cakeForeignKey__$}'), true)) {
|
||||
return $data;
|
||||
|
|
|
@ -311,6 +311,10 @@ class SqlserverTest extends CakeTestCase {
|
|||
$expected = "''";
|
||||
$result = $this->db->value('', 'binary');
|
||||
$this->assertSame($expected, $result);
|
||||
|
||||
$expected = 'NULL';
|
||||
$result = $this->db->value(null, 'string');
|
||||
$this->assertSame($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue