Menu

#2648 (ok 2.11.6) Deprecated: is_a() and get_magic_quotes_gpc()

2.11.5
fixed
1
2013-06-11
2008-03-02
No

Hello,

I tried phpMyAdmin 2.11.5 with snapshot of PHP 5.3.0-dev
(Sat, 01 Mar 2008 08:22:44 -0500).
It won't work and produces the following errors:

Deprecated: get_magic_quotes_gpc() [function.get-magic-quotes-gpc]: This function is deprecated and removed in PHP 6. See http://php.net/\{migrate}#get_magic_quotes_gpc for details. in phpmyadmin\libraries\common.inc.php on line 225

Deprecated: is_a(): Deprecated. Please use the instanceof operator in phpmyadmin\libraries\dbi\mysqli.dbi.lib.php on line 337

[multiple times]

I've changed sources by this way to solve the problem:

common.inc.php , Line 225:
if (function_exists('get_magic_quotes_gpc') && @get_magic_quotes_gpc()) {

Replacement for function in file mysqli.dbi.lib.php:

function PMA_DBI_free_result()
{
foreach (func_get_args() as $result) {
if (is_object($result)
&& (get_class($result) == strtolower('mysqli_result')
or is_subclass_of($result, 'mysqli_result')) ) {
mysqli_free_result($result);
}
}
}

Hope that helps.

Discussion

  • Marc Delisle

    Marc Delisle - 2008-03-02
    • assigned_to: nobody --> lem9
     
  • Marc Delisle

    Marc Delisle - 2008-03-03

    Logged In: YES
    user_id=210714
    Originator: NO

    Thanks, I'll merge for 2.11.6.

    Why the strtolower() ?

     
  • Marc Delisle

    Marc Delisle - 2008-03-03

    Logged In: YES
    user_id=210714
    Originator: NO

    Also, I'll merge this code from 3.0-dev instead:

    if ($result instanceof mysqli_result) {

     
  • Marc Delisle

    Marc Delisle - 2008-03-03
    • summary: Deprecated: is_a() and get_magic_quotes_gpc() --> (ok 2.11.6) Deprecated: is_a() and get_magic_quotes_gpc()
    • priority: 5 --> 1
    • status: open --> open-fixed
     
  • Dmitry N. Shilnikov

    Logged In: YES
    user_id=419005
    Originator: YES

    > Why the strtolower() ?
    :) Mechanically. I was in a hurry.

    I didn't use `instanceof` for compatibility with PHP 4, as the operator was introduced in PHP 5.

     
  • Dmitry N. Shilnikov

    Logged In: YES
    user_id=419005
    Originator: YES

    The code works perfectly. Thank you for responding.

     
  • Christopher Troup

    Logged In: YES
    user_id=2046917
    Originator: NO

    In PHP 5.3.0-dev I get:

    in ./libraries/common.inc.php#239
    get_magic_quotes_gpc() [function.get-magic-quotes-gpc]: This function is deprecated and removed in PHP 6. See http://php.net/\{migrate}#get_magic_quotes_gpc for details.

    Backtrace

    ./libraries/common.inc.php#239: get_magic_quotes_gpc()
    ./index.php#34: require_once(./libraries/common.inc.php)

    ---

    get_magic_quotes_gpc() still exists in PHP 5.3, but throws a depreciation warning, causing phpMyAdmin to fail.

     
  • Marc Delisle

    Marc Delisle - 2008-03-27

    Logged In: YES
    user_id=210714
    Originator: NO

    minichate,
    are you using phpMyAdmin 2.11.6? (it has not been released yet)

     
  • Marc Delisle

    Marc Delisle - 2008-03-27

    Logged In: YES
    user_id=210714
    Originator: NO

    I was sure that putting a "@" before get_magic_quotes_gpc() would remove the warning. Please show me the line 239 from your file.

     
  • Marc Delisle

    Marc Delisle - 2008-03-27

    Logged In: YES
    user_id=210714
    Originator: NO

    Does it work better if line 239 becomes:
    if (function_exists('get_magic_quotes_gpc') && version_compare(PHP_VERSION, '5.3.0') < 0 && @get_magic_quotes_gpc()) {

     
  • Christopher Troup

    Logged In: YES
    user_id=2046917
    Originator: NO

    Same error:

    in ./libraries/common.inc.php#240
    get_magic_quotes_gpc() [function.get-magic-quotes-gpc]: This function is deprecated and removed in PHP 6. See http://php.net/\{migrate}#get_magic_quotes_gpc for details.

    Backtrace

    ./libraries/common.inc.php#240: get_magic_quotes_gpc()
    ./index.php#34: require_once(./libraries/common.inc.php)

    Lines 237 - 245:
    // remove quotes added by php
    // (@ before get_magic_quotes_gpc() because it's deprecated in PHP 5.3)
    if (function_exists('get_magic_quotes_gpc') &&
    version_compare(PHP_VERSION, '5.3.0') < 0 && @get_magic_quotes_gpc()) {
    PMA_arrayWalkRecursive($_GET, 'stripslashes', true);
    PMA_arrayWalkRecursive($_POST, 'stripslashes', true);
    PMA_arrayWalkRecursive($_COOKIE, 'stripslashes', true);
    PMA_arrayWalkRecursive($_REQUEST, 'stripslashes', true);
    }

     
  • Marc Delisle

    Marc Delisle - 2008-03-29
    • priority: 1 --> 5
     
  • Marc Delisle

    Marc Delisle - 2008-03-29

    Logged In: YES
    user_id=210714
    Originator: NO

    Ok, it's because version 5.3.0-dev is really lower than 5.3.0. This works:

    if (function_exists('get_magic_quotes_gpc')
    && (version_compare(PHP_VERSION, '5.2.99') == -1)
    && @get_magic_quotes_gpc()) {

     
  • Marc Delisle

    Marc Delisle - 2008-03-29

    Logged In: YES
    user_id=210714
    Originator: NO

    Merged.

     
  • Marc Delisle

    Marc Delisle - 2008-03-29
    • priority: 5 --> 1
     
  • Christopher Troup

    Logged In: YES
    user_id=2046917
    Originator: NO

    Thanks! Latest trunk now works!

     
  • Marc Delisle

    Marc Delisle - 2008-04-29
    • status: open-fixed --> closed-fixed
     
  • Michal Čihař

    Michal Čihař - 2013-06-11
    • Status: closed-fixed --> fixed