johnbillion / query-monitor

The developer tools panel for WordPress
https://querymonitor.com
GNU General Public License v2.0
1.59k stars 208 forks source link

`pre_http_request` hook will cause PHP Warning #811

Open devhaozi opened 1 year ago

devhaozi commented 1 year ago

If the pre_http_request hook is used by some plugin, query-monitor will cause the PHP warning as follows:

image

The earlier query-monitor plugin did not have this problem. It may have been introduced in an update in the last two years.

johnbillion commented 1 year ago

Thank you for the report @devhaozi. Can you let me know which plugin is using the pre_http_request hook? If it's not a public plugin, can you let me know what the callback on this hook does please? A link to the code for the callback would be great.

devhaozi commented 1 year ago

Thank you for the report @devhaozi. Can you let me know which plugin is using the pre_http_request hook? If it's not a public plugin, can you let me know what the callback on this hook does please? A link to the code for the callback would be great.

See github.com/litepress/wp-china-yes.

kkmuffme commented 2 months ago

Another use case is when the external request is blocked by a security plugin (and it returns e.g. a WP_Error on that hook) or if the request is overwritten with partial response data for whatever reason.

Tons of notices:

query-monitor\collectors\http.php on line 335

Undefined array key ...someurl

query-monitor\collectors\http.php on line 340

Undefined array key args

query-monitor\collectors\http.php on line 340

Trying to access array offset on null

query-monitor\collectors\http.php on line 378

Undefined array key args

query-monitor\collectors\http.php on line 382

Undefined array key info

query-monitor\output\html\http.php on line 164

Trying to access array offset on null

query-monitor\output\html\http.php on line 276

Trying to access array offset on null