Skip to content

Commit

Permalink
fix where in shortcut and response header casing problem.
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Apr 1, 2012
1 parent b72f4e9 commit d2f3590
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions laravel/database/query/grammars/grammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,22 +397,24 @@ public function delete(Query $query)
* @param array $bindings
* @return string
*/
public function shortcut($sql, $bindings)
public function shortcut($sql, &$bindings)
{
// Laravel provides an easy short-cut notation for writing raw WHERE IN
// statements. If (...) is in the query, it will be replaced with the
// correct number of parameters based on the bindings.
// correct number of parameters based on the query bindings.
if (strpos($sql, '(...)') !== false)
{
for ($i = 0; $i < count($bindings); $i++)
{
// If the binding is an array, we can just assume it's used to
// fill a "where in" condition, so we will just replace the
// next place-holder in the query with the constraint.
// If the binding is an array, we can just assume it's used to fill a
// where in condition, so we'll just replace the next place-holder
// in the query with the constraint and splice the bindings.
if (is_array($bindings[$i]))
{
$parameters = $this->parameterize($bindings[$i]);

array_splice($bindings, $i, 1, $bindings[$i]);

$sql = preg_replace('~\(\.\.\.\)~', "({$parameters})", $sql, 1);
}
}
Expand Down
2 changes: 1 addition & 1 deletion laravel/response.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function __construct($content, $status = 200, $headers = array())
{
$this->status = $status;
$this->content = $content;
$this->headers = $headers;
$this->headers = array_change_key_case($headers);
}

/**
Expand Down

0 comments on commit d2f3590

Please sign in to comment.