Make WordPress Core

Ticket #44416: 44416.2.diff

File 44416.2.diff, 10.2 KB (added by desrosj, 6 years ago)
  • .travis.yml

     
    1414  include:
    1515  - php: 7.1
    1616    env: WP_TRAVISCI=travis:js
     17  - php: 7.3
    1718  - php: 7.2
    1819  - php: 7.1
    1920  - php: 7.0
     
    3031  - php: nightly
    3132  allow_failures:
    3233  - php: nightly
     34  - php: 7.3
    3335before_install:
    3436- |
    3537  if [[ "$WP_TRAVISCI" == "travis:phpunit" ]]; then
     
    6365  # Install the specified version of PHPUnit depending on the PHP version:
    6466  if [[ "$WP_TRAVISCI" == "travis:phpunit" ]]; then
    6567    case "$TRAVIS_PHP_VERSION" in
    66       7.2|7.1|7.0|nightly)
     68      7.3|7.2|7.1|7.0|nightly)
    6769        echo "Using PHPUnit 6.x"
    6870        composer global require "phpunit/phpunit:^6"
    6971        ;;
  • src/wp-includes/class-wp-comment-query.php

     
    633633                $number = absint( $this->query_vars['number'] );
    634634                $offset = absint( $this->query_vars['offset'] );
    635635                $paged = absint( $this->query_vars['paged'] );
     636                $limits = '';
    636637
    637638                if ( ! empty( $number ) ) {
    638639                        if ( $offset ) {
     
    817818                        $this->sql_clauses['where']['post_author__not_in'] = 'post_author NOT IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['post_author__not_in'] ) ) . ' )';
    818819                }
    819820
    820                 $join = '';
     821                $join    = '';
     822                $groupby = '';
    821823
    822824                if ( $join_posts_table ) {
    823825                        $join .= "JOIN $wpdb->posts ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID";
  • src/wp-includes/class-wp-network-query.php

     
    326326                        $orderby = "$wpdb->site.id $order";
    327327                }
    328328
    329                 $number = absint( $this->query_vars['number'] );
    330                 $offset = absint( $this->query_vars['offset'] );
    331 
    332                 if ( ! empty( $number ) ) {
     329                $number = absint( $this->query_vars['number'] );
     330                $offset = absint( $this->query_vars['offset'] );
     331                $limits = '';
     332
     333                if ( ! empty( $number ) ) {
    333334                        if ( $offset ) {
    334335                                $limits = 'LIMIT ' . $offset . ',' . $number;
    335336                        } else {
     
    390391                }
    391392
    392393                $join = '';
     394
     395                $where = implode( ' AND ', $this->sql_clauses['where'] );
     396
     397                $groupby = '';
     398
     399                $pieces = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' );
    393400
    394                 $where = implode( ' AND ', $this->sql_clauses['where'] );
    395 
    396                 $pieces = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' );
    397 
    398401                /**
    399402                 * Filters the network query clauses.
    400403                 *
  • src/wp-includes/class-wp-site-query.php

     
    370370                        $orderby = "blog_id $order";
    371371                }
    372372
    373                 $number = absint( $this->query_vars['number'] );
    374                 $offset = absint( $this->query_vars['offset'] );
    375 
    376                 if ( ! empty( $number ) ) {
     373                $number = absint( $this->query_vars['number'] );
     374                $offset = absint( $this->query_vars['offset'] );
     375                $limits = '';
     376
     377                if ( ! empty( $number ) ) {
    377378                        if ( $offset ) {
    378379                                $limits = 'LIMIT ' . $offset . ',' . $number;
    379380                        } else {
     
    522523                }
    523524
    524525                $join = '';
     526
     527                $where = implode( ' AND ', $this->sql_clauses['where'] );
     528
     529                $groupby = '';
     530
     531                $pieces = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' );
    525532
    526                 $where = implode( ' AND ', $this->sql_clauses['where'] );
    527 
    528                 $pieces = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' );
    529 
    530533                /**
    531534                 * Filters the site query clauses.
    532535                 *
  • src/wp-includes/class-wp-xmlrpc-server.php

     
    35173517
    35183518                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    35193519                do_action( 'xmlrpc_call', 'wp.editComment' );
     3520                $comment = array(
     3521                        'comment_ID' => $comment_ID,
     3522                );
    35203523
    35213524                if ( isset($content_struct['status']) ) {
    35223525                        $statuses = get_comment_statuses();
     
    35243527
    35253528                        if ( ! in_array($content_struct['status'], $statuses) )
    35263529                                return new IXR_Error( 401, __( 'Invalid comment status.' ) );
    3527                         $comment_approved = $content_struct['status'];
     3530
     3531                        $comment['comment_approved'] = $content_struct['status'];
    35283532                }
    35293533
    35303534                // Do some timestamp voodoo
    35313535                if ( !empty( $content_struct['date_created_gmt'] ) ) {
    35323536                        // We know this is supposed to be GMT, so we're going to slap that Z on there by force
    3533                         $dateCreated = rtrim( $content_struct['date_created_gmt']->getIso(), 'Z' ) . 'Z';
    3534                         $comment_date = get_date_from_gmt(iso8601_to_datetime($dateCreated));
    3535                         $comment_date_gmt = iso8601_to_datetime($dateCreated, 'GMT');
     3537
     3538                        $dateCreated                 = rtrim( $content_struct['date_created_gmt']->getIso(), 'Z' ) . 'Z';
     3539                        $comment['comment_date']     = get_date_from_gmt( iso8601_to_datetime( $dateCreated ) );
     3540                        $comment['comment_date_gmt'] = iso8601_to_datetime( $dateCreated, 'GMT' );
    35363541                }
    35373542
    3538                 if ( isset($content_struct['content']) )
    3539                         $comment_content = $content_struct['content'];
     3543                if ( isset($content_struct['content']) ) {
     3544                        $comment['comment_content'] = $content_struct['content'];
     3545                }
    35403546
    3541                 if ( isset($content_struct['author']) )
    3542                         $comment_author = $content_struct['author'];
     3547                if ( isset($content_struct['author']) ) {
     3548                        $comment['comment_author'] = $content_struct['author'];
     3549                }
    35433550
    3544                 if ( isset($content_struct['author_url']) )
    3545                         $comment_author_url = $content_struct['author_url'];
     3551                if ( isset($content_struct['author_url']) ) {
     3552                        $comment['comment_author_url'] = $content_struct['author_url'];
     3553                }
    35463554
    3547                 if ( isset($content_struct['author_email']) )
    3548                         $comment_author_email = $content_struct['author_email'];
     3555                if ( isset($content_struct['author_email']) ) {
     3556                        $comment['comment_author_email'] = $content_struct['author_email'];
     3557                }
    35493558
    3550                 // We've got all the data -- post it:
    3551                 $comment = compact('comment_ID', 'comment_content', 'comment_approved', 'comment_date', 'comment_date_gmt', 'comment_author', 'comment_author_email', 'comment_author_url');
    3552 
    35533559                $result = wp_update_comment($comment);
    35543560                if ( is_wp_error( $result ) )
    35553561                        return new IXR_Error(500, $result->get_error_message());
     
    49894995                        $post_name = $content_struct['wp_slug'];
    49904996
    49914997                // Only use a password if one was given.
    4992                 if ( isset($content_struct['wp_password']) )
     4998                if ( isset($content_struct['wp_password']) ) {
    49934999                        $post_password = $content_struct['wp_password'];
     5000                } else {
     5001                        $post_password = '';
     5002                }
    49945003
    49955004                // Only set a post parent if one was provided.
    4996                 if ( isset($content_struct['wp_page_parent_id']) )
     5005                if ( isset($content_struct['wp_page_parent_id']) ) {
    49975006                        $post_parent = $content_struct['wp_page_parent_id'];
     5007                } else {
     5008                        $post_parent = 0;
     5009                }
    49985010
    49995011                // Only set the menu_order if it was provided.
    5000                 if ( isset($content_struct['wp_page_order']) )
     5012                if ( isset($content_struct['wp_page_order']) ) {
    50015013                        $menu_order = $content_struct['wp_page_order'];
     5014                } else {
     5015                        $menu_order = 0;
     5016                }
    50025017
    50035018                $post_author = $user->ID;
    50045019
     
    53085323
    53095324                $this->escape($postdata);
    53105325
    5311                 $ID = $postdata['ID'];
    5312                 $post_content = $postdata['post_content'];
    5313                 $post_title = $postdata['post_title'];
    5314                 $post_excerpt = $postdata['post_excerpt'];
    5315                 $post_password = $postdata['post_password'];
    5316                 $post_parent = $postdata['post_parent'];
    5317                 $post_type = $postdata['post_type'];
    5318                 $menu_order = $postdata['menu_order'];
     5326                $ID             = $postdata['ID'];
     5327                $post_content   = $postdata['post_content'];
     5328                $post_title     = $postdata['post_title'];
     5329                $post_excerpt   = $postdata['post_excerpt'];
     5330                $post_password  = $postdata['post_password'];
     5331                $post_parent    = $postdata['post_parent'];
     5332                $post_type      = $postdata['post_type'];
     5333                $menu_order     = $postdata['menu_order'];
     5334                $ping_status    = $postdata['ping_status'];
     5335                $comment_status = $postdata['comment_status'];
    53195336
    53205337                // Let WordPress manage slug if none was provided.
    53215338                $post_name = $postdata['post_name'];
  • src/wp-includes/comment.php

     
    29772977 */
    29782978function wp_handle_comment_submission( $comment_data ) {
    29792979
    2980         $comment_post_ID = $comment_parent = 0;
     2980        $comment_post_ID = $comment_parent = $user_ID = 0;
    29812981        $comment_author = $comment_author_email = $comment_author_url = $comment_content = null;
    29822982
    29832983        if ( isset( $comment_data['comment_post_ID'] ) ) {
  • src/wp-includes/post.php

     
    33743374                $post_parent = 0;
    33753375        }
    33763376
     3377        $new_postarr = array_merge(
     3378                array(
     3379                        'ID' => $post_ID,
     3380                ),
     3381                compact( array_diff( array_keys( $defaults ), array( 'context', 'filter' ) ) )
     3382        );
     3383
    33773384        /**
    33783385         * Filters the post parent -- used to check for and prevent hierarchy loops.
    33793386         *
     
    33843391         * @param array $new_postarr Array of parsed post data.
    33853392         * @param array $postarr     Array of sanitized, but otherwise unmodified post data.
    33863393         */
    3387         $post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ID, compact( array_keys( $postarr ) ), $postarr );
     3394        $post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ID, $new_postarr, $postarr );
    33883395
    33893396        /*
    33903397         * If the post is being untrashed and it has a desired slug stored in post meta,
  • tests/phpunit/tests/dependencies/scripts.php

     
    819819         * @covers wp_enqueue_code_editor()
    820820         */
    821821        public function test_wp_enqueue_code_editor_when_generated_array_by_compact_will_be_passed() {
     822                $file                   = '';
    822823                $wp_enqueue_code_editor = wp_enqueue_code_editor( compact( 'file' ) );
    823824                $this->assertNonEmptyMultidimensionalArray( $wp_enqueue_code_editor );
    824825