jtmorris/phpframework — Issue #3: selectid() creates a 2D array, but only used 1D
Author: jtmorris
Created: 2011-12-15 22:55:12+00:00
State: open
Labels: Potential Improvements

Where:
source/core/pf_dbinterface.php -> class Pf_dbinterface -> function selectid()

Problem:
Calls select() which creates and returns a 2d array, then extracts the single 2d array entry and returns that.

Why It's Bad
Array generation overhead. Takes valuable CPU time and memory to generate the 2d array when not needed

Possible Solutions

Pass optional flag to select() which tells it whether to create the 2d array or keep the single 1d array

How Bad?
Not very. Can definitely cause performance issues on larger sites; however, no security vulnerabilities or chance of site breakage.