Skip to content

Fix bug where input parameters were sent as part-indexed, part associati...#71

Closed
hellogerard wants to merge 1 commit intoj4mie:masterfrom
hellogerard:invalid-params
Closed

Fix bug where input parameters were sent as part-indexed, part associati...#71
hellogerard wants to merge 1 commit intoj4mie:masterfrom
hellogerard:invalid-params

Conversation

@hellogerard
Copy link
Copy Markdown
Contributor

...ve array

Hello,

Thanks for taking over the project. I updated idiorm with great anticipation and ran into an error on a simple update. Taking the example from the test, the following code:

$widget = ORM::for_table('widget')->find_one(1);
$widget->name = "Fred";
$widget->age = 10;
$widget->save();

passes the test because it is not actually executed. Upon execution, I get the following error:

SQLSTATE[HY093]: Invalid parameter number: parameter was not defined

If I dump out the input parameters sent to execute() (line 1285), I get:

array(3) {
  'name' => string(4) "Fred"
  'age' => int(10)
  [0] => string(1) "1"
}

PDO does not seem to like the mix of named and indexed parameters. This PR fixes this so that the input parameters are all indexed array values.

Gerard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant