Index: tests/Zend/Db/Select/TestCommon.php =================================================================== --- tests/Zend/Db/Select/TestCommon.php (revision 24461) +++ tests/Zend/Db/Select/TestCommon.php (working copy) @@ -1609,6 +1609,18 @@ $this->assertEquals(1, $result[0]['id']); } + public function testSelectUnionBind() + { + $select1 = new Zend_Db_Select($this->_db); + $select1->from('foo')->joinLeft('bar', 'bar.id = :BIND1')->bind(array('BIND1' => '1')); + $select2 = new Zend_Db_Select($this->_db); + $select2->from('foo')->joinLeft('bar', 'bar.id = :BIND2')->bind(array('BIND2' => '2')); + + $select3 = new Zend_Db_Select($this->_db); + $select3->union(array($select1, $select2)); + $this->assertEquals(array('BIND1' => 1, 'BIND2' => 2), $select3->getBind()); + } + /** * @group ZF-4772 * @expectedException Zend_Db_Select_Exception Index: library/Zend/Db/Select.php =================================================================== --- library/Zend/Db/Select.php (revision 24461) +++ library/Zend/Db/Select.php (working copy) @@ -292,6 +292,9 @@ } foreach ($select as $target) { + if ($target instanceof Zend_Db_Select) { + $this->_bind = array_merge($this->_bind, $target->_bind); + } $this->_parts[self::UNION][] = array($target, $type); }