#30754 [Opn]: Add a function like smart_addslashes()?

From: Date: Thu, 11 Nov 2004 06:06:43 +0000
Subject: #30754 [Opn]: Add a function like smart_addslashes()?
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-68937@lists.php.net to get a copy of this message
ID: 30754 Updated by: tony2001@php.net Reported By: webjedi at hudzilla dot eclipse dot co dot uk Status: Open Bug Type: Feature/Change Request Operating System: Fedora Core 3 PHP Version: Irrelevant New Comment: Here it is: <? function smart_addslashes($str) { if (!get_magic_quotes_gpc()) { return addslashes($str); } return $str; } ?> Is that what you want? Previous Comments: ------------------------------------------------------------------------ [2004-11-10 22:19:18] webjedi at hudzilla dot eclipse dot co dot uk Description: ------------ Would it be possible to write a function, named something like smart_addslashes(), that only adds slashes to a string if magic_quotes_gpc is disabled? Yes, this is only three lines of userland code: if (!get_magic_quotes_gpc()) { $input_string = addslashes($input_string); } But adding slashes to strings is a common task, and checking whether the string has already been auto-slashed is crucial for portability reasons - trimming three lines down to one would help ease the job a little. Thanks! ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=30754&edit=1

« previous php.bugs (#68937) next »