ZF-11523: Bound variables lost when passing query to database adapter in Zend_Auth_Adapter_DbTable

Issue Type: Improvement Created: 2011-07-04T19:14:51.000+0000 Last Updated: 2011-07-05T19:15:25.000+0000 Status: Resolved Fix version(s): - 1.11.8 (07/Jul/11)

Reporter: Wilfried Loche (w_loche) Assignee: Adam Lundrigan (adamlundrigan) Tags: - Zend_Auth

Related issues: Attachments:



I have overridden Zend_Auth_Adapter_DbTable for customization purpose. I also overridden Zend_Db_Select to provide bindings/parameterized queries also with 'where' conditions.

Because of the $dbSelect->__toString() (in Zend/Auth/Adapter/DbTable.php@480), my object is not called! So I have to rewrite _authenticateQuerySelect() method just to remove this strange usage.

I propose this patch:

<pre class="highlight">
<             $resultIdentities = $this->_zendDb->fetchAll($dbSelect->__toString());
>             $resultIdentities = $this->_zendDb->fetchAll($dbSelect);

Hope this so simple path will be approved.

Thx a lot for your work on this good framework (it really helps me!), Wilfried


Posted by Adam Lundrigan (adamlundrigan) on 2011-07-05T13:05:56.000+0000

The issue at hand is that the user's superclass of Zend_Db_Select binds variables to the query, but these bindings are lost because Zend_Auth_Adapter_DbTable is cast to a string before being passed to the database adapter. Passing the Zend_Db_Select object directly rather than just the SQL string allows Zend_Db_Adapter::query to pull the bound variables and use them to execute the statement.

Posted by Adam Lundrigan (adamlundrigan) on 2011-07-05T13:10:07.000+0000

Fixed in trunk r24184 Merged to release-1.11 in r24185

Posted by Wilfried Loche (w_loche) on 2011-07-05T19:15:25.000+0000

Thx a lot for your quick support, it's a pleasure to help for the ZF enhancement :).

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.