bjorn / rpgdx

RPGDX
http://rpgdx.net
2 stars 3 forks source link

Consider deprecating HTTP_ vars. #5

Closed Poikilos closed 3 months ago

Poikilos commented 3 months ago

I'll add some issues in case there are minor improvements, or issues that usage may uncover later, in the code I've seen.

Currently, the codebase sets the deprecated vars:

// PHP5 with register_long_arrays off?
if (@phpversion() >= '5.0.0' && (!@ini_get('register_long_arrays') || @ini_get('register_long_arrays') == '0' || strtolower(@ini_get('register_long_arrays')) == 'off'))
{
    $HTTP_POST_VARS = $_POST;
    $HTTP_GET_VARS = $_GET;
    $HTTP_SERVER_VARS = $_SERVER;
    $HTTP_COOKIE_VARS = $_COOKIE;
    $HTTP_ENV_VARS = $_ENV;
    $HTTP_POST_FILES = $_FILES;

    // _SESSION is the only superglobal which is conditionally set
    if (isset($_SESSION))
    {
        $HTTP_SESSION_VARS = $_SESSION;
    }
}

Maybe just use the new vars instead.

bjorn commented 3 months ago

This mostly affects the old phpBB2 code. Since we don't expect to ever update that again, a search & replace for these variables seems appropriate.

Poikilos commented 3 months ago

For reference, maybe use:

find ./ -name "*.php" -exec sed -i 's/\$HTTP_POST_VARS/\$_POST/g' {} \;
find ./ -name "*.php" -exec sed -i 's/\$HTTP_GET_VARS/\$_GET/g' {} \;
find ./ -name "*.php" -exec sed -i 's/\$HTTP_SESSION_VARS/\$_SESSION/g' {} \;
find ./ -name "*.php" -exec sed -i 's/\$HTTP_COOKIE_VARS/\$_COOKIE/g' {} \;
find ./ -name "*.php" -exec sed -i 's/\$HTTP_ENV_VARS/\$_ENV/g' {} \;
find ./ -name "*.php" -exec sed -i 's/\$HTTP_SERVER_VARS/\$_SERVER/g' {} \;
find ./ -name "*.php" -exec sed -i 's/\$HTTP_POST_FILES/\$_FILES/g' {} \;

from https://forum.directadmin.com/threads/multiple-php-versions.41451/#post-209294