Make WordPress Core

Changes between Initial Version and Version 2 of Ticket #63576


Ignore:
Timestamp:
06/16/2025 07:25:13 PM (6 months ago)
Author:
sabernhardt
Comment:

(See line 742 on the GitHub repository if you want to create a pull request.)

The substr() function should always return a string. I think simply checking for an empty string would suffice: if ($body !== '')

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #63576

    • Property Version changed from trunk to
  • Ticket #63576 – Description

    initial v2  
    1 In limited circumstances, HTTP requests made using wp-includes/Requests/src/Requests.php will incorrectly return an empty string as the response body, even though the request executed and returned a value in the response.
     1In limited circumstances, HTTP requests made using `wp-includes/Requests/src/Requests.php` will incorrectly return an empty string as the response body, even though the request executed and returned a value in the response.
    22
    3 This happens when the returned value is PHP-falsey (for example, the string "0") - or in other words, when empty($value) evaluates to true in PHP.
     3This happens when the returned value is PHP-falsey (for example, the string `"0"`) - or in other words, when `empty($value)` evaluates to true in PHP.
    44
    55I've encountered this issue in production, so the diff we went with is attached.