Join the community today
Register Now

PHP-FPM Anyone with issues logging into Wordpress after upgrading to PHP 7.4.2?

Discussion in 'Install & Upgrades or Pre-Install Questions' started by BamaStangGuy, Jan 24, 2020.

  1. BamaStangGuy

    BamaStangGuy Premium Member Premium Member

    637
    187
    43
    May 25, 2014
    Ratings:
    +258
    Local Time:
    4:49 AM
    • Informative Informative x 1
  2. pamamolf

    pamamolf Premium Member Premium Member

    3,697
    357
    83
    May 31, 2014
    Ratings:
    +688
    Local Time:
    12:49 PM
    Nginx-1.17.x
    MariaDB 10.3.x
    Now for such a serious issue you must wait a month for the next release 7.4.3 ? :(

    Hope that issue doesn't exist on 7.1, 7.2, 7.3 ...
     
  3. eva2000

    eva2000 Administrator Staff Member

    43,132
    9,792
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,122
    Local Time:
    8:49 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    not using PHP 7.4 with my wordpress installs right now just PHP 7.3.14

    are you using a Tor browser or privacy first browser session which disabled/blocked cookies ? but that wouldn't explain PHP 7.4.1 working.
     
  4. BamaStangGuy

    BamaStangGuy Premium Member Premium Member

    637
    187
    43
    May 25, 2014
    Ratings:
    +258
    Local Time:
    4:49 AM
    The specific issue I linked to was only "fixed" in PHP 7.4.
    No, just normal Chrome. Each upgrade to PHP 7.4.2 breaks Wordpress login. Downgrade to PHP 7.4.1 fixes.
     
  5. eva2000

    eva2000 Administrator Staff Member

    43,132
    9,792
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,122
    Local Time:
    8:49 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
  6. pamamolf

    pamamolf Premium Member Premium Member

    3,697
    357
    83
    May 31, 2014
    Ratings:
    +688
    Local Time:
    12:49 PM
    Nginx-1.17.x
    MariaDB 10.3.x
    Fixed but will be added in the next version? 7.4.3 ?

    Does it exist for the other php versions?
     
  7. BamaStangGuy

    BamaStangGuy Premium Member Premium Member

    637
    187
    43
    May 25, 2014
    Ratings:
    +258
    Local Time:
    4:49 AM
    Sorry, I haven't explained it well. What I linked to was a bug that was fixed in 7.4.2 but I believe that the bug fix has caused an issue with Wordpress.
     
    • Informative Informative x 1
  8. eva2000

    eva2000 Administrator Staff Member

    43,132
    9,792
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,122
    Local Time:
    8:49 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    PHP 7.4.2 change is in main/php_variables.c according to commit history for that file php/php-src specific commit is Fix #78929: plus signs in cookie values are converted to spaces · php/[email protected]

    diff compare of PHP 7.4.2 left to 7.4.1 right
    Code:
    diff -u php-7.4.2/main/php_variables.c php-7.4.1/main/php_variables.c
    --- php-7.4.2/main/php_variables.c      2020-01-21 11:35:21.000000000 +0000
    +++ php-7.4.1/main/php_variables.c      2019-12-17 16:35:59.000000000 +0000
    @@ -479,9 +479,6 @@
            var = php_strtok_r(res, separator, &strtok_buf);
     
            while (var) {
    -               size_t val_len;
    -               size_t new_val_len;
    -
                    val = strchr(var, '=');
     
                    if (arg == PARSE_COOKIE) {
    @@ -500,25 +497,29 @@
                    }
     
                    if (val) { /* have a value */
    +                       size_t val_len;
    +                       size_t new_val_len;
     
                            *val++ = '\0';
    -
    -                       if (arg == PARSE_COOKIE) {
    -                               val_len = php_raw_url_decode(val, strlen(val));
    -                       } else {
    -                               val_len = php_url_decode(val, strlen(val));
    +                       php_url_decode(var, strlen(var));
    +                       val_len = php_url_decode(val, strlen(val));
    +                       val = estrndup(val, val_len);
    +                       if (sapi_module.input_filter(arg, var, &val, val_len, &new_val_len)) {
    +                               php_register_variable_safe(var, val, new_val_len, &array);
                            }
    +                       efree(val);
                    } else {
    -                       val     = "";
    -                       val_len =  0;
    -               }
    +                       size_t val_len;
    +                       size_t new_val_len;
     
    -               val = estrndup(val, val_len);
    -               php_url_decode(var, strlen(var));
    -               if (sapi_module.input_filter(arg, var, &val, val_len, &new_val_len)) {
    -                       php_register_variable_safe(var, val, new_val_len, &array);
    +                       php_url_decode(var, strlen(var));
    +                       val_len = 0;
    +                       val = estrndup("", val_len);
    +                       if (sapi_module.input_filter(arg, var, &val, val_len, &new_val_len)) {
    +                               php_register_variable_safe(var, val, new_val_len, &array);
    +                       }
    +                       efree(val);
                    }
    -               efree(val);
     next_cookie:
                    var = php_strtok_r(NULL, separator, &strtok_buf);
            }
     
  9. eva2000

    eva2000 Administrator Staff Member

    43,132
    9,792
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,122
    Local Time:
    8:49 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    @BamaStangGuy try this manual patch/reverting of main/php_variables.c to the PHP 7.4.1 version to see if PHP 7.4.2 update works for wordpress logins
    1. update local centmin mod 123.09beta01 code to latest via cmupdate command
    2. use cmdir alias command to change to /usr/local/src/centminmod directory where centmin mod code is installed
    3. download via wget cmm-php742-cookie.patch patch file to patch /usr/local/src/centminmod/inc/php_patch.inc include routine which will only patch revert main/php_variables.c file from PHP 7.4.2 version to PHP 7.4.1 version when PHP 7.4.2 detected on centmin.sh menu option 5 upgrade routines. This reverts the PHP 7.4.2 fix for bug #78929 php/php-src
    4. run patch to patch inc/php_patch.inc
    Code (Text):
    cmupdate
    cmdir
    wget -O cmm-php742-cookie.patch https://gist.github.com/centminmod/220cfa7e5e786474e40714c7f9371f86/raw/cmm-php742-cookie.patch
    patch -p1 < cmm-php742-cookie.patch
    

    run centmin.sh menu option 5 to update to PHP 7.4.2
    Code (Text):
    centmin
    

    after exiting centmin.sh from php update run command to find PHP patch file log which records every PHP patch applied during centmin.sh menu option 5 runs
    Code (Text):
    ls -lahrt /root/centminlogs/ | grep patch_php | tail -1
    

    example output
    Code (Text):
    ls -lahrt /root/centminlogs/ | grep patch_php | tail -1
    -rw-r--r--   1 root root  653 Jan 24 23:53 patch_php_240120-235235.log

    contents of /root/centminlogs/patch_php_240120-235235.log via command
    Code (Text):
    cat /root/centminlogs/patch_php_240120-235235.log

    Code (Text):
    revert PHP 7.4.2 main/php_variables.c to PHP 7.4.1 version
    https://community.centminmod.com/posts/81184/
    --2020-01-24 23:53:09--  https://raw.githubusercontent.com/php/php-src/PHP-7.4.1/main/php_variables.c
    Resolving raw.githubusercontent.com... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...
    Connecting to raw.githubusercontent.com|151.101.0.133|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 25713 (25K) [text/plain]
    Saving to: ‘main/php_variables.c’
    
        0K .......... .......... .....                           100% 1.85M=0.01s
    
    2020-01-24 23:53:10 (1.85 MB/s) - ‘main/php_variables.c’ saved [25713/25713]
     
  10. Andy

    Andy Active Member

    456
    73
    28
    Aug 6, 2014
    Ratings:
    +101
    Local Time:
    5:49 AM
    updated to latest nginx and php 7.4.2 and have no problem with log into wordpress.
     
    • Informative Informative x 1
  11. BamaStangGuy

    BamaStangGuy Premium Member Premium Member

    637
    187
    43
    May 25, 2014
    Ratings:
    +258
    Local Time:
    4:49 AM
    Fixed it. Running 7.4.2 now with that patch with no issues.
     
  12. eva2000

    eva2000 Administrator Staff Member

    43,132
    9,792
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,122
    Local Time:
    8:49 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Thanks Andy for chiming in. Seems it could be dependent on plugins too ?

    Strange Andy didn't have any problems. Google search had some folks saying wp plugin related as well so who knows.
     
  13. BamaStangGuy

    BamaStangGuy Premium Member Premium Member

    637
    187
    43
    May 25, 2014
    Ratings:
    +258
    Local Time:
    4:49 AM
    Did you mean to search for nginx patches with your command above?
     
  14. BamaStangGuy

    BamaStangGuy Premium Member Premium Member

    637
    187
    43
    May 25, 2014
    Ratings:
    +258
    Local Time:
    4:49 AM
    What search brought up plugins and what were they? I have another Wordpress site that does not have an issue as well but this site is easily reproducible and this patch fixes it.
     
  15. eva2000

    eva2000 Administrator Staff Member

    43,132
    9,792
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,122
    Local Time:
    8:49 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Don't have the links off the top of my head. Have you compared what type of cookie values are set for both your wordpress sites ? maybe they differ too ?

    you can compare wp plugin list via
    Code (Text):
    cd /home/nginx/domains/yourdomain.com/public
    wp plugin status
     
  16. eva2000

    eva2000 Administrator Staff Member

    43,132
    9,792
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,122
    Local Time:
    8:49 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
  17. BamaStangGuy

    BamaStangGuy Premium Member Premium Member

    637
    187
    43
    May 25, 2014
    Ratings:
    +258
    Local Time:
    4:49 AM
    Are you using WP Rocket by chance?
     
  18. BamaStangGuy

    BamaStangGuy Premium Member Premium Member

    637
    187
    43
    May 25, 2014
    Ratings:
    +258
    Local Time:
    4:49 AM
    Just ran into this on a fresh CentminMod install with 7.4.2 and a brand new Wordpress install. After Wordpress installed and new user created, unable to log in with the same issue as above.

    Just going to use latest 7.3 until issue is resolved.
     
  19. eva2000

    eva2000 Administrator Staff Member

    43,132
    9,792
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,122
    Local Time:
    8:49 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    hmm should report the bug to php folks. For now I might just apply the patch fix to PHP 7.4.2 as it's a security release
     
  20. eva2000

    eva2000 Administrator Staff Member

    43,132
    9,792
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,122
    Local Time:
    8:49 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x