Skip to content

Commit

Permalink
Validate that the key parameter is a string
Browse files Browse the repository at this point in the history
This pull request validates that the `$key` parameter provided to the function is actually a string before trying to use this. I came across this as I was working to modify JTable to be able to support multiple primary keys in a somewhat transparent way. By default JTable passes through it's keys onto the database `insertObject` and `updateObject` function which works well for single keys but not properly for `insertObject` when the `$key` is an array.
  • Loading branch information
pasamio committed Aug 23, 2012
1 parent b1fded3 commit 399353d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libraries/joomla/database/driver.php
Expand Up @@ -851,7 +851,7 @@ public function insertObject($table, &$object, $key = null)

// Update the primary key if it exists.
$id = $this->insertid();
if ($key && $id)
if ($key && $id && is_string($key))
{
$object->$key = $id;
}
Expand Down

0 comments on commit 399353d

Please sign in to comment.