ZF-7975: Strict Standards: Only variables should be passed by reference in Zend/Db/Select.php on line 246

Issue Type: Bug Created: 2009-09-29T11:26:31.000+0000 Last Updated: 2010-01-12T22:17:49.000+0000 Status: Resolved Fix version(s): - 1.10.0 (27/Jan/10)

Reporter: Jeremy Postlethwaite (gammamatrix) Assignee: Jan Pieper (jpieper) Tags: - Zend_Db_Select

Related issues: - ZF-8790

Attachments: - Zend_Db_Select.php.diff


The error comes from lin 246 where array_keys() is wrapped in current().

This is triggering the error: Only variables should be passed by reference

<pre class="highlight">
if ($correlationName === null && count($this->_parts[self::FROM])) {
 $correlationName = current(array_keys($this->_parts[self::FROM]));

This can be prevented with:

<pre class="highlight">
if ($correlationName === null && count($this->_parts[self::FROM])) {
 $correlationNameKeys = array_keys($this->_parts[self::FROM]);
 $correlationName = current($correlationNameKeys);


Posted by Jeremy Postlethwaite (gammamatrix) on 2009-09-29T11:32:41.000+0000

This is a diff file of the proposed fix.

Posted by Jeremy Postlethwaite (gammamatrix) on 2009-09-29T11:40:51.000+0000

This happens on:

  • Red Hat Enterprise Linux 5 64 bit - PHP 5.3

This does not happen on:

  • OS X 10.4 - PHP 5.2
  • OS X 10.5 - PHP 5.2
  • FreeBSD 7 - PHP 5.2

Posted by Jan Pieper (jpieper) on 2009-09-29T13:00:28.000+0000

Fixed in r18440.

Posted by Daniel Ott (thedott) on 2010-01-12T08:35:21.000+0000

Release 1.9.7 has reverted by to the old code.

Posted by Satoru Yoshida (satoruyoshida) on 2010-01-12T22:17:49.000+0000

I set fix version. It seems to be released in next minor release for me.

Have you found an issue?

See the Overview section for more details.


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

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