Make WordPress Core

Changeset 62437


Ignore:
Timestamp:
05/31/2026 07:19:21 PM (5 months ago)
Author:
westonruter
Message:

Privacy: Correct type of WP_User_Request::$user_id from int to string/numeric-string.

Also adds numeric-string as richer PHPStan type to WP_Post::$post_author and WP_Post::$comment_count.

Developed in ​https://github.com/WordPress/wordpress-develop/pull/12018.
Follow-up to r25086, r43011.

Props masteradhoc, desrosj, garrett-eclipse, johnbillion, westonruter, apermo, SergeyBiryukov, TZ-Media, andizer, javorszky.
See #22324, #25092, #43443, #43985, #64898.
Fixes #44723.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-post.php

    r61789 r62437  
    3737         * @since 3.5.0
    3838         * @var string
     39         * @phpstan-var numeric-string
    3940         */
    4041        public $post_author = '0';
    … …  
    207208         * @since 3.5.0
    208209         * @var string
     210         * @phpstan-var numeric-string
    209211         */
    210212        public $comment_count = '0';
  • trunk/src/wp-includes/class-wp-user-request.php

    r59828 r62437  
    2121         *
    2222         * @since 4.9.6
    23          * @var int
     23         * @var string
     24         * @phpstan-var numeric-string
    2425         */
    25         public $user_id = 0;
     26        public $user_id = '0';
    2627
    2728        /**
Note: See TracChangeset for help on using the changeset viewer.