note 80561 added to function.addslashes

From: Date: Tue, 22 Jan 2008 15:11:36 +0000
Subject: note 80561 added to function.addslashes
Groups: php.notes 
Request: Send a blank email to php-notes+get-135310@lists.php.net to get a copy of this message
In the note below of Adrian C (3-3-2007) checkaddslashes will not behave well with strings starting with a single quote (because of the non-typed comparison) or with strings having a mix of escaped and non-escaped single quotes. Although addslashes also escapes double quotes, this function worked for single quotes fine. <?php function checkaddslashes($str){ $str2 = str_replace("\'", "*****", $str); if(strpos($str2,"'")!== false) return str_replace('*****', "\'", addslashes($str2)); else return $str; } ?> ---- Server IP: 213.249.64.162 Probable Submitter: 80.126.182.205 ---- Manual Page -- http://www.php.net/manual/en/function.addslashes.php Edit -- https://master.php.net/note/edit/80561 Del: integrated -- https://master.php.net/note/delete/80561/integrated Del: useless -- https://master.php.net/note/delete/80561/useless Del: bad code -- https://master.php.net/note/delete/80561/bad+code Del: spam -- https://master.php.net/note/delete/80561/spam Del: non-english -- https://master.php.net/note/delete/80561/non-english Del: in docs -- https://master.php.net/note/delete/80561/in+docs Del: other reasons-- https://master.php.net/note/delete/80561 Reject -- https://master.php.net/note/reject/80561 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#135310) next »