Make WordPress Core

Ticket #39120: 39120.comment-query.2.patch

File 39120.comment-query.2.patch, 1.1 KB (added by birgire, 7 years ago)

Default as null instead of empty string for $default.

  • src/wp-includes/class-wp-comment-query.php

     
    11431143                        return 'DESC';
    11441144                }
    11451145        }
     1146
     1147        /**
     1148         * Retrieve query variable.
     1149         *
     1150         * @since 4.9.0
     1151         *
     1152         * @access public
     1153         *
     1154         * @param  string $query_var Query variable key.
     1155         * @param  mixed  $default   Optional. Value to return if the query variable is not set. Default null.
     1156         * @return mixed             Contents of the query variable.
     1157         */
     1158        public function get( $query_var, $default = null ) {
     1159                if ( isset( $this->query_vars[ $query_var ] ) ) {
     1160                        return $this->query_vars[ $query_var ];
     1161                }
     1162
     1163                return $default;
     1164        }
     1165
     1166        /**
     1167         * Set query variable.
     1168         *
     1169         * @since 4.9.0
     1170         * @access public
     1171         *
     1172         * @param string $query_var Query variable key.
     1173         * @param mixed  $value     Query variable value.
     1174         */
     1175        public function set($query_var, $value) {
     1176                $this->query_vars[$query_var] = $value;
     1177        }
    11461178}