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

Description

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


if ($correlationName === null && count($this->_parts[self::FROM])) {
 $correlationName = current(array_keys($this->_parts[self::FROM]));
}

This can be prevented with:


if ($correlationName === null && count($this->_parts[self::FROM])) {
 $correlationNameKeys = array_keys($this->_parts[self::FROM]);
 $correlationName = current($correlationNameKeys);
}

Comments

This is a diff file of the proposed fix.

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

Fixed in r18440.

Release 1.9.7 has reverted by to the old code.

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