Re: Sanitize and hyphens

2007-03-08 Thread bernardo

But why do hyphens need to be escaped in the first place?

I looked at the function cleanValue (that is called by cleanArray) and
it makes several replacements, some of them look weird, for example:
$val = str_replace(!, !, $val);
$val = str_replace(', ', $val);

I guess the intention was to write something like $val =
str_replace(', #39;, $val); but were copied from some web page
and the entities got lost.

I prefer to stick to the regular php function htmlspecialchars;
writing your own wrapper for this function to operate on arrays is
very easy.

On Mar 7, 8:32 pm, squidliberty [EMAIL PROTECTED] wrote:
 I have several areas of my site where it is necessary to sanitize
 large amounts of user form data. cleanArray() makes this process a
 breeze - however, I have found that it replaces hyphens ('-') with the
 htmlentity equivalent ('#45;'). This is a big problem for email
 addresses, which may contain hyphens.

 How should I be handling this? My best solution was to create a
 fixSafeChar() function to convert the hyphens back. But this seems
 pretty crude.

 Any suggestions? Is cleanArray() not the right function for the task?

 Thanks!


--~--~-~--~~~---~--~~
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 and hyphens

2007-03-07 Thread squidliberty

I have several areas of my site where it is necessary to sanitize
large amounts of user form data. cleanArray() makes this process a
breeze - however, I have found that it replaces hyphens ('-') with the
htmlentity equivalent ('#45;'). This is a big problem for email
addresses, which may contain hyphens.

How should I be handling this? My best solution was to create a
fixSafeChar() function to convert the hyphens back. But this seems
pretty crude.

Any suggestions? Is cleanArray() not the right function for the task?

Thanks!


--~--~-~--~~~---~--~~
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 and hyphens

2007-03-07 Thread Dr. Tarique Sani

On 3/8/07, squidliberty [EMAIL PROTECTED] wrote:
 How should I be handling this? My best solution was to create a
 fixSafeChar() function to convert the hyphens back. But this seems
 pretty crude.

Thats what I have done as well...

However, the problem is usually in the URLs and emails - a better
solution is to use a regex for validating. The presumption being if it
validates it does not need cleaning ;)

Cheers
Tarique

-- 
=
PHP for E-Biz: http://sanisoft.com
Cheesecake-Photoblog: http://cheesecake-photoblog.org
=

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---