-
Notifications
You must be signed in to change notification settings - Fork 316
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from grimzy/sql-injection-fix-mysql-5.6
Fix MySQL vulnerability (MySQL 5.6)
- Loading branch information
Showing
11 changed files
with
208 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace Grimzy\LaravelMysqlSpatial\Eloquent; | ||
|
||
use Illuminate\Database\Query\Builder as QueryBuilder; | ||
|
||
class BaseBuilder extends QueryBuilder | ||
{ | ||
protected function cleanBindings(array $bindings) | ||
{ | ||
$bindings = array_map(function ($binding) { | ||
return $binding instanceof SpatialExpression ? $binding->getSpatialValue() : $binding; | ||
}, $bindings); | ||
|
||
return parent::cleanBindings($bindings); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Grimzy\LaravelMysqlSpatial\Eloquent; | ||
|
||
use Illuminate\Database\Query\Expression; | ||
|
||
class SpatialExpression extends Expression | ||
{ | ||
public function getValue() | ||
{ | ||
return 'ST_GeomFromText(?)'; | ||
} | ||
|
||
public function getSpatialValue() | ||
{ | ||
return $this->value->toWkt(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace Grimzy\LaravelMysqlSpatial\Exceptions; | ||
|
||
class UnknownSpatialRelationFunction extends \RuntimeException | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.