_log_query method raises a warning when query contains "%"

Issue

When logging is on:

ORM::configure('logging', true);

Queries containing the "%":

$many = Model::factory('user')->where("active",1)->where_raw('username like "ben%"')->find_many();

Raise PHP warning:

Warning: vsprintf() : Too few arguments in idiorm.php on line 267

Because % must be escaped in the query for vsprintf.

Fix

In idiorm.php, line 264:

$query = str_replace("?", "%s", $query);

should be:

$query = str_replace("?", "%s", str_replace("%","%%",$query));

This fixes the problem for the "%" chars.

Second issue

The problem remains with the "?" char inside the query:

$many = Model::factory('book')->where("active",1)->where_raw('comments like "has been released?%"')->find_many();

vsprintf raises the same error.

— Ben