Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 8, 2020. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library/Zend/Db/Sql/Insert.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function columns(array $columns)
*/
public function values(array $values, $flag = self::VALUES_SET)
{
if ($values == null) {
if ($values === null) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the problem was not use a strict comparison ===

throw new Exception\InvalidArgumentException('values() expects an array of values');
}

Expand Down
9 changes: 9 additions & 0 deletions tests/ZendTest/Db/Sql/InsertTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ public function testValues()
$this->assertEquals(array('bax'), $this->readAttribute($this->insert, 'values'));
}

/**
* @covers Zend\Db\Sql\Insert::values
* @group ZF2-4926
*/
public function testEmptyArrayValues()
{
$this->insert->values(array());
$this->assertEquals(array(), $this->readAttribute($this->insert, 'columns'));
}

/**
* @covers Zend\Db\Sql\Insert::prepareStatement
Expand Down