mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-24 10:29:56 +00:00
Adding fix for #2882, Sanitize::escape() fails for numbers.
Added test for #2882. Corrected header files in tests git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5428 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
016f5a952b
commit
1df4249d54
8 changed files with 141 additions and 86 deletions
|
@ -72,9 +72,12 @@ class Sanitize{
|
|||
*/
|
||||
function escape($string, $connection = 'default') {
|
||||
$db = ConnectionManager::getDataSource($connection);
|
||||
$value = substr($db->value($string), 1);
|
||||
$value = substr($value, 0, -1);
|
||||
return $value;
|
||||
if(is_numeric($string)) {
|
||||
return $string;
|
||||
}
|
||||
$string = substr($db->value($string), 1);
|
||||
$string = substr($string, 0, -1);
|
||||
return $string;
|
||||
}
|
||||
/**
|
||||
* Returns given string safe for display as HTML. Renders entities.
|
||||
|
|
|
@ -7,32 +7,31 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP Test Suite <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* Copyright (c) 2006, Larry E. Masters Shorewood, IL. 60431
|
||||
* Author(s): Larry E. Masters aka PhpNut <phpnut@gmail.com>
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @author Larry E. Masters aka PhpNut <phpnut@gmail.com>
|
||||
* @copyright Copyright (c) 2006, Larry E. Masters Shorewood, IL. 60431
|
||||
* @link http://www.phpnut.com/projects/
|
||||
* @package test_suite
|
||||
* @subpackage test_suite.cases.app
|
||||
* @since CakePHP Test Suite v 1.0.0.0
|
||||
* @version $Revision$
|
||||
* @modifiedby $LastChangedBy$
|
||||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
* @version $Revision$
|
||||
* @modifiedby $LastChangedBy$
|
||||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||
*/
|
||||
uses('file');
|
||||
/**
|
||||
* Short description for class.
|
||||
*
|
||||
* @package test_suite
|
||||
* @subpackage test_suite.cases.libs
|
||||
* @since CakePHP Test Suite v 1.0.0.0
|
||||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs
|
||||
*/
|
||||
class FileTest extends UnitTestCase {
|
||||
|
||||
|
|
|
@ -7,32 +7,31 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP Test Suite <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* Copyright (c) 2006, Larry E. Masters Shorewood, IL. 60431
|
||||
* Author(s): Larry E. Masters aka PhpNut <phpnut@gmail.com>
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @author Larry E. Masters aka PhpNut <phpnut@gmail.com>
|
||||
* @copyright Copyright (c) 2006, Larry E. Masters Shorewood, IL. 60431
|
||||
* @link http://www.phpnut.com/projects/
|
||||
* @package test_suite
|
||||
* @subpackage test_suite.cases.app
|
||||
* @since CakePHP Test Suite v 1.0.0.0
|
||||
* @version $Revision$
|
||||
* @modifiedby $LastChangedBy$
|
||||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
* @version $Revision$
|
||||
* @modifiedby $LastChangedBy$
|
||||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||
*/
|
||||
uses('folder');
|
||||
/**
|
||||
* Short description for class.
|
||||
*
|
||||
* @package test_suite
|
||||
* @subpackage test_suite.cases.libs
|
||||
* @since CakePHP Test Suite v 1.0.0.0
|
||||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs
|
||||
*/
|
||||
class FolderTest extends UnitTestCase {
|
||||
|
||||
|
|
|
@ -7,30 +7,31 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP Test Suite <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* Copyright (c) 2006, Larry E. Masters Shorewood, IL. 60431
|
||||
* Author(s): Larry E. Masters aka PhpNut <phpnut@gmail.com>
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @author Larry E. Masters aka PhpNut <phpnut@gmail.com>
|
||||
* @copyright Copyright (c) 2006, Larry E. Masters Shorewood, IL. 60431
|
||||
* @link http://www.phpnut.com/projects/
|
||||
* @package test_suite
|
||||
* @subpackage test_suite.cases.app
|
||||
* @since CakePHP Test Suite v 1.0.0.0
|
||||
* @version $Revision$
|
||||
* @modifiedby $LastChangedBy$
|
||||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
* @version $Revision$
|
||||
* @modifiedby $LastChangedBy$
|
||||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||
*/
|
||||
uses('http_socket');
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
* Short description for class.
|
||||
*
|
||||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs
|
||||
*/
|
||||
class HttpSocketTest extends UnitTestCase {
|
||||
|
||||
|
|
|
@ -7,35 +7,34 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP Test Suite <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* Copyright (c) 2006, Larry E. Masters Shorewood, IL. 60431
|
||||
* Author(s): Larry E. Masters aka PhpNut <phpnut@gmail.com>
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @author Larry E. Masters aka PhpNut <phpnut@gmail.com>
|
||||
* @copyright Copyright (c) 2006, Larry E. Masters Shorewood, IL. 60431
|
||||
* @link http://www.phpnut.com/projects/
|
||||
* @package test_suite
|
||||
* @subpackage test_suite.cases.app
|
||||
* @since CakePHP Test Suite v 1.0.0.0
|
||||
* @version $Revision$
|
||||
* @modifiedby $LastChangedBy$
|
||||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
* @version $Revision$
|
||||
* @modifiedby $LastChangedBy$
|
||||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||
*/
|
||||
uses('inflector');
|
||||
/**
|
||||
* Short description for class.
|
||||
*
|
||||
* @package test_suite
|
||||
* @subpackage test_suite.cases.libs
|
||||
* @since CakePHP Test Suite v 1.0.0.0
|
||||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs
|
||||
*/
|
||||
class InflectorTest extends UnitTestCase {
|
||||
|
||||
|
||||
var $Inflector = null;
|
||||
|
||||
function setUp() {
|
||||
|
|
55
cake/tests/cases/libs/sanitize.test.php
Normal file
55
cake/tests/cases/libs/sanitize.test.php
Normal file
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
/* SVN FILE: $Id$ */
|
||||
/**
|
||||
* Short description for file.
|
||||
*
|
||||
* Long description for file
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.5428
|
||||
* @version $Revision$
|
||||
* @modifiedby $LastChangedBy$
|
||||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||
*/
|
||||
uses('sanitize');
|
||||
/**
|
||||
* Short description for class.
|
||||
*
|
||||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs
|
||||
*/
|
||||
class SanitizeTest extends UnitTestCase {
|
||||
|
||||
function testEscapeAlphaNumeric() {
|
||||
$resultAlpha = Sanitize::escape('abc', 'default');
|
||||
$this->assertEqual($resultAlpha, 'abc');
|
||||
|
||||
$resultNumeric = Sanitize::escape('123', 'default');
|
||||
$this->assertEqual($resultNumeric, '123');
|
||||
|
||||
$resultNumeric = Sanitize::escape(1234, 'default');
|
||||
$this->assertEqual($resultNumeric, 1234);
|
||||
|
||||
$resultNumeric = Sanitize::escape(1234.23, 'default');
|
||||
$this->assertEqual($resultNumeric, 1234.23);
|
||||
|
||||
$resultNumeric = Sanitize::escape('#1234.23', 'default');
|
||||
$this->assertEqual($resultNumeric, '#1234.23');
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -7,32 +7,31 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP Test Suite <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* Copyright (c) 2006, Larry E. Masters Shorewood, IL. 60431
|
||||
* Author(s): Larry E. Masters aka PhpNut <phpnut@gmail.com>
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @author Larry E. Masters aka PhpNut <phpnut@gmail.com>
|
||||
* @copyright Copyright (c) 2006, Larry E. Masters Shorewood, IL. 60431
|
||||
* @link http://www.phpnut.com/projects/
|
||||
* @package test_suite
|
||||
* @subpackage test_suite.cases.app
|
||||
* @since CakePHP Test Suite v 1.0.0.0
|
||||
* @version $Revision$
|
||||
* @modifiedby $LastChangedBy$
|
||||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
* @version $Revision$
|
||||
* @modifiedby $LastChangedBy$
|
||||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||
*/
|
||||
uses('session');
|
||||
/**
|
||||
* Short description for class.
|
||||
*
|
||||
* @package test_suite
|
||||
* @subpackage test_suite.cases.libs
|
||||
* @since CakePHP Test Suite v 1.0.0.0
|
||||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs
|
||||
*/
|
||||
class SessionTest extends UnitTestCase {
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs.model
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
* @version $Revision$
|
||||
* @modifiedby $LastChangedBy$
|
||||
|
@ -33,8 +33,8 @@ uses('set');
|
|||
/**
|
||||
* UnitTestCase for the Set class
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs
|
||||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs
|
||||
*/
|
||||
class SetTest extends UnitTestCase {
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue