anewt-developers team mailing list archive
-
anewt-developers team
-
Mailing list archive
-
Message #00243
[Branch ~uws/anewt/anewt.uws] Rev 1770: [core] Avoid deprecation warning on PHP >= 5.3; cleanup
------------------------------------------------------------
revno: 1770
committer: Wouter Bolsterlee <uws@xxxxxxxxx>
branch nick: anewt.uws
timestamp: Sat 2010-03-20 22:20:16 +0100
message:
[core] Avoid deprecation warning on PHP >= 5.3; cleanup
modified:
core/noquotes.lib.php
--
lp:anewt
https://code.launchpad.net/~uws/anewt/anewt.uws
Your team Anewt developers is subscribed to branch lp:anewt.
To unsubscribe from this branch go to https://code.launchpad.net/~uws/anewt/anewt.uws/+edit-subscription.
=== modified file 'core/noquotes.lib.php'
--- core/noquotes.lib.php 2008-11-13 17:42:04 +0000
+++ core/noquotes.lib.php 2010-03-20 21:20:16 +0000
@@ -25,7 +25,8 @@
* \return
* The parameter with stripslashes() applied to values.
*/
-function stripslashes_recursive($value) {
+function stripslashes_recursive($value)
+{
if (is_array($value))
return array_map('stripslashes_recursive', $value);
@@ -33,12 +34,19 @@
}
-set_magic_quotes_runtime(0);
+/* If needed, clean the GET, POST and COOKIE arrays */
-if (get_magic_quotes_gpc()) {
- $_GET = array_map('stripslashes_recursive', $_GET); /**< Clean GET */
- $_POST = array_map('stripslashes_recursive', $_POST); /**< Clean POST */
- $_COOKIE = array_map('stripslashes_recursive', $_COOKIE); /**< Clean COOKIE */
+if (get_magic_quotes_gpc())
+{
+ $_GET = array_map('stripslashes_recursive', $_GET);
+ $_POST = array_map('stripslashes_recursive', $_POST);
+ $_COOKIE = array_map('stripslashes_recursive', $_COOKIE);
}
+
+/* Disable magic quotes on PHP versions < 5.3 */
+
+if (version_compare(PHP_VERSION, '5.3.0', '<'))
+ set_magic_quotes_runtime(0);
+
?>