Fixed type crash when URL passed to network request filters is invalid.

Fixes #42
This commit is contained in:
Andrey Savchenko committed 2020-03-11 12:58:12 +02:00
1 parent dc88dcce1e
commit b0584dea0a
2 files changed
+16 -5

No files matched your search

+1
View File
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
- Mustache.php version to resolve issues on PHP 7.4
- type crash when URL passed to network request filters is invalid
## 3.3.1 - 2019-07-02
+15 -5
View File
@@ -43,11 +43,16 @@ class Http_Collector extends Stopwatch_Collector {
* @param string $url The request URL.
*
* @return false|array|\WP_Error
*
* @psalm-suppress RedundantConditionGivenDocblockType
* @noinspection PhpUnusedParameterInspection
*/
public function pre_http_request( $false, array $args, string $url ) {
public function pre_http_request( $false, $args, $url ) {
$this->start( $url, 'http' );
$this->callers[ $url ] = wp_debug_backtrace_summary( __CLASS__, 5 );
if ( $url && is_string( $url ) ) {
$this->start( $url, 'http' );
$this->callers[ $url ] = wp_debug_backtrace_summary( __CLASS__, 5 );
}
return $false;
}
@@ -62,10 +67,15 @@ class Http_Collector extends Stopwatch_Collector {
* @param string $url The request URL.
*
* @return array|\WP_Error
*
* @psalm-suppress RedundantConditionGivenDocblockType
* @noinspection PhpUnusedParameterInspection
*/
public function http_api_debug( $response, string $type, $class, array $args, string $url ) {
public function http_api_debug( $response, $type, $class, $args, $url ) {
$this->stop( $url );
if ( $url && is_string( $url ) ) {
$this->stop( $url );
}
return $response;
}