phpSPO and passing null to strlen

Viewed 18

I need to get a file from SharePoint using phpSPO.

I use this code:

$authCtx = new AuthenticationContext('https://xxxxxxxx.sharepoint.com');

$authCtx->acquireTokenForUser($username,$password);
$ctx = new ClientContext('https://xxxxxxxx.sharepoint.com/sites',$authCtx);
  
require('settings.php');

$sourceFileUrl = "/path/to/excel.xlsx";
$targetPath = "/files/excel.xlsx";

$fileContent = Office365\SharePoint\File::openBinary($ctx, $sourceFileUrl);

But I get this error:

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/www.mydomain.dk/vendor/vgrem/php-spo/src/Runtime/Http/Requests.php on line 137

Isn't phpSPO ready for php 8.0 or what could be wrong?

1 Answers

A deprecation is not an error. It's a hint to the author of the code that they will need to fix the code "soon" (i.e. within the next few years, when PHP 9.0 is expected to ship) so that it doesn't become an error.

If you want to identify what needs changing and contribute a fix, I'm sure the maintainer will appreciate the help.

If not, it is perfectly safe to completely ignore the message. If necessary, change your error configuration to ignore deprecations, or to ignore them within the "vendor" directory where third-party code lives, using something similar to this answer.

Related