Re: sanitize bug or ?

2007-10-28 Thread J. Eckert

You should update your cake core.

The newest escape function reads:

00073 function escape($string, $connection = 'default') {
00074 $db =& ConnectionManager::getDataSource($connection);
00075 if (is_numeric($string)) {
00076 return $string;
00077 }
00078 $string = substr($db->value($string), 1);
00079 $string = substr($string, 0, -1);
00080 return $string;
00081 }

And will deal right with your number.

Cheers,
Joachim

On Oct 26, 11:21 pm, vg2k <[EMAIL PROTECTED]> wrote:
> i forgot say, using cakephp 1.2 alpha


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: sanitize bug or ?

2007-10-26 Thread vg2k

i forgot say, using cakephp 1.2 alpha


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



sanitize bug or ?

2007-10-26 Thread vg2k

sanitize.php
/**
 * Makes a string SQL-safe.
 *
 * @param string $string String to sanitize
 * @param string $connection Database connection being used
 * @return string SQL safe string
 * @access public
 * @static
 */
function escape($string, $connection = 'default') {
$db = ConnectionManager::getDataSource($connection);
$value = substr($db->value($string), 1);
$value = substr($value, 0, -1);
return $value;
}



if try at controler code:

$san = new Sanitize();
$var = $san->escape('12345');
die(var_dump($var));

take: string '234' (length=3)

WHY ?

if code:

$san = new Sanitize();
$var = $san->escape('1');
die(var_dump($var));

take: boolean false


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---