Skip to content

Commit 1a16d48

Browse files
committed
Fix deprecation: strlen with null
PHP 8.1 logs a deprecation message: > PHP Deprecated: strlen(): Passing null to parameter #1 ($string) > of type string is deprecated > in vendor/vgrem/php-spo/src/Runtime/Http/Requests.php on line 137 We fix that by casting the variable to string. Related: #293
1 parent 1b4e681 commit 1a16d48

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/Runtime/Http/Requests.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ private static function init(RequestOptions $options)
134134
$opt = $options->Method === HttpMethod::Get ? CURLOPT_FILE : CURLOPT_INFILE;
135135
curl_setopt($ch, $opt, $options->StreamHandle);
136136
}
137-
$options->ensureHeader("Content-Length",strlen($options->Data));
137+
$options->ensureHeader("Content-Length",strlen((string) $options->Data));
138138
//custom HTTP headers
139139
if($options->Headers)
140140
curl_setopt($ch, CURLOPT_HTTPHEADER, $options->getRawHeaders());

0 commit comments

Comments
 (0)