aliyun / aliyun-oss-php-sdk

Aliyun OSS SDK for PHP
MIT License
997 stars 346 forks source link

php8.1报错.strlen(): Passing null to parameter #1 ($string) of type string is deprecated #289

Closed bkkkd closed 9 months ago

bkkkd commented 9 months ago

php8.1报错. strlen(): Passing null to parameter #1 ($string) of type string is deprecated `

    if (strlen($credentials->getSecurityToken()) > 0) {
        $request->add_header("x-oss-security-token", $credentials->getSecurityToken());
    }`

建议修改为 if (strlen($credentials->getSecurityToken()?:'') > 0)

byan commented 9 months ago

直接 !empty($credentials->getSecurityToken()) 即可,请尽快修复。大部分情况都是通过角色控制权限的。

bkkkd commented 9 months ago

直接 !empty($credentials->getSecurityToken()) 即可,请尽快修复。大部分情况都是通过角色控制权限的。

都可以.尽快修复吧.

ShaBaoFa commented 9 months ago
50f03d7ace328929b7d67e799b81fa3 2b29aad9fbd66c1596e5803262f0559

只能说写java sdk和php sdk 的代码哲学不太一样。

bkkkd commented 9 months ago

@huiguangjun @yangzong18 有空修复一下?

huiguangjun commented 9 months ago

https://github.com/aliyun/aliyun-oss-php-sdk/commit/efca2592105d9425ce32a46215b51a2273ead222