Skip to content

Instantly share code, notes, and snippets.

@nickvergessen
Created July 11, 2011 22:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickvergessen/1076914 to your computer and use it in GitHub Desktop.
Save nickvergessen/1076914 to your computer and use it in GitHub Desktop.
diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php
index b29e279..3adec08 100644
--- a/phpBB/includes/db/dbal.php
+++ b/phpBB/includes/db/dbal.php
@@ -346,7 +346,7 @@ class dbal
}
else
{
- $values[] = $this->_sql_validate_value($var);
+ $values[] = $this->_sql_validate_value($var, $key);
}
}
@@ -541,12 +541,17 @@ class dbal
* Function for validating values
* @access private
*/
- function _sql_validate_value($var)
+ function _sql_validate_value($var, $key = '')
{
if (is_null($var))
{
return 'NULL';
}
+ else if (is_string($var) && !empty($var) && $key == 'c_varbinary')
+ {
+ $array = unpack("H*", $var);
+ return "x'" . $array[1] . "'";
+ }
else if (is_string($var))
{
return "'" . $this->sql_escape($var) . "'";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment