note 62101 added to security.magicquotes

From: Date: Mon, 20 Feb 2006 03:09:08 +0000
Subject: note 62101 added to security.magicquotes
Groups: php.notes 
Request: Send a blank email to php-notes+get-104048@lists.php.net to get a copy of this message
Here's a simpler function to turn off magic quotes. It's weird how similar this looks to the previous function, but it was written independtly. <?php /** * Strip slashes from super globals if magic quotes is turned on. */ function removeMagicQuotes( ) { set_magic_quotes_runtime(0); if( ini_get('magic_quotes_gpc') ) { foreach( $GLOBALS as $global_name ) { $$global_name = arrayStripSlashes( $$global_name ); } } } /** * Strip slashes from a string or an array of values. * * @var mixed A string or array to strip slashes from. * * @return mixed The stripped string or array. */ function arrayStripSlashes( $to_strip ) { // if we have an array if( is_array( $to_strip ) ) foreach( $to_strip as $key=>$value ) $to_strip[$key] = arrayStripSlashes( $value ); // if we have a string, strip alshes if( is_string( $to_strip ) ) return stripslashes( $to_strip ); // otherwise, just return to_strip else return $to_strip; } ?> ---- Server IP: 64.71.164.2 Probable Submitter: 24.22.53.225 ---- Manual Page -- http://www.php.net/manual/en/security.magicquotes.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+62101 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+62101&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+62101&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+62101&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+62101&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+62101&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+62101&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+62101&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+62101&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#104048) next »