note 52435 added to function.addslashes

From: Date: Sun, 01 May 2005 03:23:42 +0000
Subject: note 52435 added to function.addslashes
Groups: php.notes 
Request: Send a blank email to php-notes+get-88807@lists.php.net to get a copy of this message
addslashes does NOT make your input safe for use in a database query! It only escapes according to what PHP defines, not what your database driver defines. Any use of this function to escape strings for use in a database is likely an error - mysql_real_escape_string, pg_escape_string, etc, should be used depending on your underlying database as each database has different escaping requirements. In particular, MySQL wants \n, \r and \x1a escaped which addslashes does NOT do. Therefore relying on addslashes is not a good idea at all and may make your code vulnerable to security risks. I really don't see what this function is supposed to do. ---- Manual Page -- http://www.php.net/manual/en/function.addslashes.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+52435 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52435&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52435&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52435&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52435&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52435&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+52435&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#88807) next »