Bug #10971

QubitPdo::modify being called repeatedly with wrong # of arguments

Added by Mike Gale over 3 years ago. Updated almost 2 years ago.

Status:VerifiedStart date:03/13/2017
Priority:MediumDue date:
Assignee:Mike Gale% Done:

0%

Category:Internals
Target version:Release 2.4.0
Google Code Legacy ID: Tested version:2.3
Sponsored:No Requires documentation:

Description

First reported in the AtoM User forum on 2016-03-13: https://groups.google.com/d/msg/ica-atom-users/9HuFGdZiDMM/87uXuwsQBgAJ

In our QubitPdo class, our modify function requires 2 parameters as shown here: https://github.com/artefactual/atom/blob/qa/2.4.x/lib/QubitPdo.class.php#L75

However, grepping around after a user reported issues with it, it appears we call it several times with only 1 instead of 2 parameters:

$ git grep -P 'QubitPdo::modi'
lib/task/migrate/QubitMigrate.class.php: QubitPdo::modify("ALTER TABLE object AUTO_INCREMENT = $last");
lib/task/migrate/QubitMigrate.class.php: QubitPdo::modify(
lib/task/migrate/QubitMigrate.class.php: QubitPdo::modify(
lib/task/migrate/QubitMigrate.class.php: QubitPdo::modify(
lib/task/migrate/arUpgradeSqlTask.class.php: QubitPdo::modify($sql, array($version, 'version'));
lib/task/migrate/arUpgradeSqlTask.class.php: QubitPdo::modify($sql, array($milestone, 'milestone'));
lib/task/migrate/arUpgrader110.class.php: QubitPdo::modify($sql);
lib/task/migrate/arUpgrader110.class.php: QubitPdo::modify($sql);
lib/task/migrate/arUpgrader110.class.php: QubitPdo::modify('ALTER TABLE digital_object ADD `checksum_type` VARCHAR AFTER `checksum`');
lib/task/migrate/arUpgrader110.class.php: QubitPdo::modify($sql);
lib/task/migrate/arUpgrader110.class.php: QubitPdo::modify($sql);
lib/task/migrate/arUpgrader110.class.php: QubitPdo::modify($sql);
lib/task/migrate/arUpgrader110.class.php: QubitPdo::modify($sql);
lib/task/migrate/arUpgrader110.class.php: QubitPdo::modify($sql);
lib/task/migrate/arUpgrader110.class.php: QubitPdo::modify($sql);
lib/task/migrate/arUpgrader110.class.php: QubitPdo::modify($sql);
lib/task/migrate/arUpgrader120.class.php: QubitPdo::modify($sql, array(
lib/task/migrate/arUpgrader120.class.php: QubitPdo::modify($sql);
lib/task/migrate/arUpgrader120.class.php: QubitPdo::modify($sql);
lib/task/migrate/arUpgrader120.class.php: QubitPdo::modify($sql);
lib/task/migrate/arUpgrader120.class.php: QubitPdo::modify($sql);
lib/task/migrate/arUpgrader120.class.php: QubitPdo::modify($sql);
lib/task/migrate/arUpgrader120.class.php: QubitPdo::modify($sql);
lib/task/migrate/arUpgrader120.class.php: QubitPdo::modify($sql);

It should be an easy fix, we just need to change the modify function's signature so $parameters has a default value (i.e.: $parameters = array())

History

#1 Updated by Dan Gillean over 3 years ago

  • Description updated (diff)
  • Tested version 2.3 added

Added a link to the original user forum thread where this was reported to the description.

#2 Updated by Mike Gale about 3 years ago

  • Status changed from New to QA/Review
  • Assignee set to Steve Breker

Hi Steve, can you please CR this @ https://github.com/artefactual/atom/pull/562 (assuming someone else doesn't review it on github first without asking)?

This is just a case of PHP keeps on chugging along even if we're calling a function without the correct number of function parameters passed in. Easy fix was just adding a default value to the missing parameter we kept leaving out when calling it.

#3 Updated by Steve Breker about 3 years ago

  • Status changed from QA/Review to Feedback
  • Assignee changed from Steve Breker to Mike Gale

Looks good to me!

#4 Updated by Mike Gale about 3 years ago

  • Status changed from Feedback to Verified

Tested it myself, seems to be working.

#5 Updated by Dan Gillean almost 2 years ago

  • Target version set to Release 2.4.0

Also available in: Atom PDF