Zend Framework

Zend_Db Performance sample code mistake: utilize a combination of vsprintf() and array_walk() to inject the values into the SQL

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.11.3
  • Component/s: Zend_Db
  • Labels:
    None

Description

Zend_Db Performance sample code mistake: utilize a combination of vsprintf() and array_walk() to inject the values into the SQL

http://framework.zend.com/manual/en/performance.database.html

by the document, it show us the sample code like below :

// $adapter is the DB adapter. In Zend_Db_Table, retrieve
// it using $this->getAdapter().
$sql = vsprintf(
self::SELECT_FOO,
array_walk($values, array($adapter, 'quoteInto'))
);

but by the php manual, we know array_walk only return true or false .

http://us.php.net/array_walk
http://us.php.net/vsprintf

so the vsprintf method did not return the right formatted sql as expected.

Activity

Hide
Mickael Perraud added a comment -

Fixed with r23643 (replace array_walk by array_map)

Show
Mickael Perraud added a comment - Fixed with r23643 (replace array_walk by array_map)

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: