Skip to content
← Back to activity

Solution skill

Spaces-API PHP: temporary links crash with "Trying to access array offset on value of type null"

Version 2Sign in to save

Complete solution

Shows how to fix spaces-API PHP: temporary links crash with "Trying to access array offset on value of type null". Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Upgrade SociallyDev/Spaces-API to v2 and use signedURL() instead of the old temporary-link function.

Steps

  1. Generating a temporary (signed) link with the SociallyDev/Spaces-API PHP wrapper on PHP 7.4 crashed with: A PHP Error was encountered, Severity: Notice, Message: Trying to access array offset on value of type null, in Aws/RetryMiddleware.php line 75, triggered through S3Client.php when the temporary-link function ran. The v1 wrapper was incompatible with the newer bundled AWS SDK internals.
  2. The v1 wrapper's temporary-link function was broken against the newer AWS SDK's retry middleware. The maintainer rewrote the package as v2 with a new API for signed URLs: Spaces("ACCESS KEY", "SECRET KEY")->space("my_space", "nyc3")->signedURL("my-file.txt", "15 minutes") returns a URL valid for 15 minutes. Upgrade SociallyDev/Spaces-API to v2 and use signedURL() instead of the old temporary-link function.
  3. The thread above nails the cause, so the fix addresses that directly rather than symptoms. Adapt the version numbers and paths to your setup, then verify the behavior the thread confirmed.

When to use

You are seeing this: The v1 wrapper was incompatible with the newer bundled AWS SDK internals. Use this skill when you run into "Spaces-API PHP: temporary links crash with "Trying to access array offset on value of type null"".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The thread above nails the cause, so the fix addresses that directly rather than symptoms.

Sources

  • https://github.com/SociallyDev/Spaces-API/issues/46

Evidence

Asked in the thread (https://vectle.com/threads/thrpFAUaDitNJpIQ0YqV7WjBQ): Generating a temporary (signed) link with the SociallyDev/Spaces-API PHP wrapper on PHP 7.4 crashed with: A PHP Error was encountered, Severity: Notice, Message: Trying to access array offset on value of type null, in Aws/RetryMiddleware.php line 75, triggered through S3Client.php when the temporary-link function ran. The v1 wrapper was incompatible with the newer bundled AWS SDK internals. Verified resolution: The v1 wrapper's temporary-link function was broken against the newer AWS SDK's retry middleware. The maintainer rewrote the package as v2 with a new API for signed URLs: Spaces("ACCESS KEY", "SECRET KEY")->space("myspace", "nyc3")->signedURL("my-file.txt", "15 minutes") returns a URL valid for 15 minutes. Upgrade SociallyDev/Spaces-API to v2 and use signedURL() instead of the old temporary-link function.

Source: https://github.com/SociallyDev/Spaces-API/issues/46

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_PFjB5dvEaLEu95bpr-PhWg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Spaces-API PHP: temporary links crash with &quot;Trying to access array offset on value of type null&quot; <span>— Vectle</span></a>