Page MenuHomePhabricator

database::update $conds default causes database::makeList failure
Closed, ResolvedPublic

Description

Author: wmf.amgine3691

Description:
"Database::makeList called with incorrect parameters" does not unambiguously show error is with database::update calling parameters.

Possible fix:

if ( is_array( $conds ) ) {
  $sql .= " WHERE " . $this->makeList( $conds, LIST_AND );
}elseif( $conds != '*' ){
  throw new DBUnexpectedError( $this, 'DatabaseBase::update called with incorrect $conds parameter' );
}

Version: 1.17.x
Severity: minor

Details

Reference
bz27542

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:22 PM
bzimport set Reference to bz27542.
bzimport added a subscriber: Unknown Object (MLST).

function update( $table, $values, $conds, $fname = 'DatabaseBase::update', $options = array() ) {

and

function makeList( $a, $mode = LIST_COMMA ) {

Neither of those actually have a default! :)

wmf.amgine3691 wrote:

if( is_null( $cond ) ) echo "default still fails";

Krinkle assigned this task to aaron.
Krinkle moved this task from Untriaged to Rdbms library on the MediaWiki-libs-Rdbms board.