mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Fixes #3442, Sanitize escape NULL becomes "UL"
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5885 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
304bc01a9d
commit
31243741f9
2 changed files with 11 additions and 9 deletions
|
@ -72,7 +72,7 @@ class Sanitize{
|
|||
*/
|
||||
function escape($string, $connection = 'default') {
|
||||
$db =& ConnectionManager::getDataSource($connection);
|
||||
if (is_numeric($string)) {
|
||||
if (is_numeric($string) || $string === null) {
|
||||
return $string;
|
||||
}
|
||||
$string = substr($db->value($string), 1);
|
||||
|
|
|
@ -50,6 +50,15 @@ class SanitizeTest extends UnitTestCase {
|
|||
|
||||
$resultNumeric = Sanitize::escape('#1234.23', 'default');
|
||||
$this->assertEqual($resultNumeric, '#1234.23');
|
||||
|
||||
$resultNull = Sanitize::escape(null, 'default');
|
||||
$this->assertEqual($resultNull, null);
|
||||
|
||||
$resultNull = Sanitize::escape(false, 'default');
|
||||
$this->assertEqual($resultNull, false);
|
||||
|
||||
$resultNull = Sanitize::escape(true, 'default');
|
||||
$this->assertEqual($resultNull, true);
|
||||
}
|
||||
|
||||
function testClean() {
|
||||
|
@ -87,13 +96,6 @@ class SanitizeTest extends UnitTestCase {
|
|||
$expected = array(array('test & "quote" \'other\' ;.$ $ symbol.another line'));
|
||||
$result = Sanitize::clean($array, array('encode' => false, 'escape' => false));
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue