Commit 842feee1c3 for wordpress.org

commit 842feee1c37a84c149df8d3819dd9e52ff10af59
Author: SergeyBiryukov <sergeybiryukov@git.wordpress.org>
Date:   Fri Oct 2 23:30:46 2026 +0000

    Code Quality: Resolve `variable.undefined` errors in `wp-mail.php` and `wp-trackback.php`.

    1. **`src/wp-mail.php`**: Initialize `$subject = '';` alongside the other per-message variables (`$bodysignal`, `$boundary`, `$charset`, etc.) before the `foreach ( $message as $line )` loop. Without this, `$subject` is only assigned when a line matches `/Subject: /i`, so PHPStan correctly flags it as potentially undefined when the loop completes without a match.

    2. **`src/wp-trackback.php`**: Add `global $wpdb, $posts;` with `@global` docblocks in file scope. `$wpdb` is used four times (two `prepare` calls, one `get_results`, one `insert_id`) and `$posts` once (`$posts[0]->ID`), all reachable after `require wp-load.php`.

    3. **`tests/phpstan/baselines/variable.undefined.neon`**: Remove the three resolved suppression entries (6 errors total).

    Developed in https://github.com/WordPress/wordpress-develop/pull/13880.

    Follow-up to r51850, r53719.

    Props therssoftware, mukesh27.
    See #65817.
    Built from https://develop.svn.wordpress.org/trunk@64072


    git-svn-id: http://core.svn.wordpress.org/trunk@63231 1a063a9b-81f0-0310-95a4-ce76da25c4cd

diff --git a/wp-includes/version.php b/wp-includes/version.php
index 1b78cbbbbc..2a150893c9 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.2-alpha-64071';
+$wp_version = '7.2-alpha-64072';

 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
diff --git a/wp-mail.php b/wp-mail.php
index ffa51b7fd2..dfd9410389 100644
--- a/wp-mail.php
+++ b/wp-mail.php
@@ -83,15 +83,16 @@ for ( $i = 1; $i <= $count; $i++ ) {
 	$message = $pop3->get( $i );

 	$bodysignal                = false;
-	$boundary                  = '';
 	$charset                   = '';
 	$content                   = '';
 	$content_type              = '';
 	$content_transfer_encoding = '';
+	$boundary                  = '';
+	$subject                   = '';
 	$post_author               = 1;
 	$author_found              = false;
-	$post_date                 = null;
-	$post_date_gmt             = null;
+	$post_date                 = '';
+	$post_date_gmt             = '';

 	foreach ( $message as $line ) {
 		// Body signal.
diff --git a/wp-trackback.php b/wp-trackback.php
index c666c13e8b..fe9b4702e8 100644
--- a/wp-trackback.php
+++ b/wp-trackback.php
@@ -91,6 +91,12 @@ $title     = wp_slash( $title );
 $excerpt   = wp_slash( $excerpt );
 $blog_name = wp_slash( $blog_name );

+/**
+ * @global wpdb      $wpdb  WordPress database abstraction object.
+ * @global WP_Post[] $posts Array of post objects.
+ */
+global $wpdb, $posts;
+
 if ( is_single() || is_page() ) {
 	$post_id = $posts[0]->ID;
 }