From 5e6173015709d67c40877bcf51a5c4520e83f9de Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sat, 26 Nov 2011 06:54:40 -0500 Subject: [PATCH] bug #3438420 [core] Magic quotes removed in PHP 5.4 --- ChangeLog | 1 + libraries/common.inc.php | 30 ++++++++++++++++++++---------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 343d6dae4b..53555513ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ phpMyAdmin - ChangeLog 3.4.9.0 (not yet released) - bug #3442028 [edit] Inline editing enum fields with null shows no dropdown - bug #3442004 [interface] DB suggestion not correct for user with underscore +- bug #3438420 [core] Magic quotes removed in PHP 5.4 3.4.8.0 (not yet released) - bug #3425230 [interface] enum data split at space char (more space to edit) diff --git a/libraries/common.inc.php b/libraries/common.inc.php index b695022ec6..53eeb79e64 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -69,11 +69,15 @@ if (version_compare(phpversion(), '5.3', 'lt')) { } /** - * Avoid problems with magic_quotes_runtime - * (in the future, this setting will be removed but it's not yet - * known in which PHP version) + * This setting was removed in PHP 5.4. But at this point PMA_PHP_INT_VERSION + * is not yet defined so we use another way to find out the PHP version. */ -@ini_set('magic_quotes_runtime', false); +if (version_compare(phpversion(), '5.4', 'lt')) { + /** + * Avoid problems with magic_quotes_runtime + */ + @ini_set('magic_quotes_runtime', false); +} /** * for verification in all procedural scripts under libraries @@ -253,12 +257,18 @@ if (isset($_POST['usesubform'])) { } // end check if a subform is submitted -// remove quotes added by php -if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) { - PMA_arrayWalkRecursive($_GET, 'stripslashes', true); - PMA_arrayWalkRecursive($_POST, 'stripslashes', true); - PMA_arrayWalkRecursive($_COOKIE, 'stripslashes', true); - PMA_arrayWalkRecursive($_REQUEST, 'stripslashes', true); +/** + * This setting was removed in PHP 5.4. But at this point PMA_PHP_INT_VERSION + * is not yet defined so we use another way to find out the PHP version. + */ +if (version_compare(phpversion(), '5.4', 'lt')) { + // remove quotes added by PHP + if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) { + PMA_arrayWalkRecursive($_GET, 'stripslashes', true); + PMA_arrayWalkRecursive($_POST, 'stripslashes', true); + PMA_arrayWalkRecursive($_COOKIE, 'stripslashes', true); + PMA_arrayWalkRecursive($_REQUEST, 'stripslashes', true); + } } /** -- 2.11.4.GIT