Make WordPress Core

Ticket #48316: 48316-minimal-realpath-fix.diff

File 48316-minimal-realpath-fix.diff, 788 bytes (added by mpcube, 5 years ago)

Minimal fix using realpath(): Just for UPLOADS constant, not for option 'siteurl', as siteurl can be absolute. Just for directory, nor for URL, as '../' in URL ist ugly, but nor a showstopper

  • wp-includes/functions.php

     
    23082308         * We also sometimes obey UPLOADS when rewriting is enabled -- see the next block.
    23092309         */
    23102310        if ( defined( 'UPLOADS' ) && ! ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) ) {
    2311                 $dir = ABSPATH . UPLOADS;
     2311                $dir = realpath( ABSPATH . UPLOADS );
    23122312                $url = trailingslashit( $siteurl ) . UPLOADS;
    23132313        }
    23142314
     
    23522352                        if ( defined( 'BLOGUPLOADDIR' ) ) {
    23532353                                $dir = untrailingslashit( BLOGUPLOADDIR );
    23542354                        } else {
    2355                                 $dir = ABSPATH . UPLOADS;
     2355                                $dir = realpath( ABSPATH . UPLOADS );
    23562356                        }
    23572357                        $url = trailingslashit( $siteurl ) . 'files';
    23582358                }