Skip to content
This repository has been archived by the owner on Oct 16, 2019. It is now read-only.

Commit

Permalink
Merge pull request zendframework#670 from ezimuel/fix/655
Browse files Browse the repository at this point in the history
Fix for 655 issue - ZF2015-08 breaks binary data
  • Loading branch information
tavy315 committed Apr 14, 2016
1 parent 3f79be2 commit 7bbee79
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
2 changes: 0 additions & 2 deletions library/Zend/Db/Adapter/Pdo/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,6 @@ protected function _quote($value)
if (is_int($value) || is_float($value)) {
return $value;
}
// Fix for null-byte injection
$value = addcslashes($value, "\000\032");
$this->_connect();
return $this->_connection->quote($value);
}
Expand Down
15 changes: 15 additions & 0 deletions library/Zend/Db/Adapter/Pdo/Mssql.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,4 +420,19 @@ public function getServerVersion()
return null;
}
}

/**
* Quote a raw string.
*
* @param string $value Raw string
* @return string Quoted string
*/
protected function _quote($value)
{
if (!is_int($value) && !is_float($value)) {
// Fix for null-byte injection
$value = addcslashes($value, "\000\032");
}
return parent::_quote($value);
}
}
14 changes: 14 additions & 0 deletions library/Zend/Db/Adapter/Pdo/Sqlite.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,4 +294,18 @@ public function limit($sql, $count, $offset = 0)
return $sql;
}

/**
* Quote a raw string.
*
* @param string $value Raw string
* @return string Quoted string
*/
protected function _quote($value)
{
if (!is_int($value) && !is_float($value)) {
// Fix for null-byte injection
$value = addcslashes($value, "\000\032");
}
return parent::_quote($value);
}
}

0 comments on commit 7bbee79

Please sign in to comment.