Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Deprecated GuzzleHttp\Psr7 function API seems to be used and it doesn't work anymore #299

Open
timelapse999 opened this issue Jul 2, 2021 · 12 comments

Comments

@timelapse999
Copy link

timelapse999 commented Jul 2, 2021

Which service(blob, file, queue, table) does this issue concern?

Any one of them using Guzzle\Psr7. Issue experienced with for example blob service.

Which version of the SDK was used?

"microsoft/azure-storage-blob": 1.5.2

What's the PHP/OS version?

PHP 7.3.28
Debian Buster

What problem was encountered?

For example:

Error: Call to undefined function GuzzleHttp\\Psr7\\stream_for() in /microsoft/azure-storage-blob/src/Blob/BlobRestProxy.php:1837

It seems azure-storage-php is still using a function API for Guzzle PSR-7, but that has been removed and replaced with static API.

The code on that line, which doesn't work:

$body = Psr7\stream_for($content);

Using this works:

$body = Utils::streamFor($content);

(after importing GuzzleHttp\Psr7\Utils;)

Have you found a mitigation/solution?

Not backwards compatible solution: Migrate to static API by using a migration table found here: Guzzle PSR-7 Upgrading from Function API

@timelapse999 timelapse999 changed the title Deprecated GuzzleHttp\Psr7 function API is being used and it doesn't work anymore. Please migrate to static API Deprecated GuzzleHttp\Psr7 function API seems to be used and it doesn't work anymore Jul 2, 2021
@timelapse999
Copy link
Author

timelapse999 commented Jul 2, 2021

This happens if guzzlehttp/guzzle 7.0 is used and guzzlehttp/psr7 is upgraded to 2.0, because function API is removed in that version. Static API has been introduced in guzzlehttp/psr7 1.7.0.

@balasta75
Copy link

Hi,

When do you will update the code to be able to use new version of guzzlehttp/psr-7 ?

Thanks

@balasta75
Copy link

Or can you update your composer.json to use the good versions of Guzzle ?

@ScottHelme
Copy link

Registering our interest in this issue too, we're currently experiencing the same issue.

@spaze
Copy link
Contributor

spaze commented Jul 13, 2021

FYI, there's an attempted fix in #302 by @galvani.

The problem can be also worked around by locking PSR2 to ^1.7 (or even ^1.0, latest 1.x will be installed anyway) in composer.json like

"guzzlehttp/psr7": "^1.7",

@reconstrukt
Copy link

Same problem here. +1
But, can confirm that the workaround from @spaze above does work as a temp solve for now

@dpow-hrs
Copy link

Same problem here, after composer update: Upgrading guzzlehttp/psr7 (1.8.2 => 2.0.0)

Error message:
Call to undefined function GuzzleHttp\Psr7\build_query() at /app/vendor/microsoft/azure-storage-common/src/Common/Internal/ServiceRestProxy.php:309

Work around:
As per spaze suggestion above, we have now also limited guzzlehttp/psr7 to 1.8 explicitly in composer.json to keep things working.
"guzzlehttp/psr7": "^1.8",

@galvani
Copy link

galvani commented Jul 19, 2021

it is fixed here: #302

@neoacevedo
Copy link

@galvani I'm sorry but it isn't fixed yet. Just today, I ran the composer update and I got this issue.

@mfpx
Copy link

mfpx commented Sep 12, 2021

Not fixed, still ongoing on our client's project.

@spaze
Copy link
Contributor

spaze commented Sep 12, 2021

@mfpx @neoacevedo The fix has not been released yet. In fact, there was no release since December 2020, check the Releases page. You can "Watch" the repository to be informed about new releases (and you can select Releases only under Custom).

@jeffpaul
Copy link

jeffpaul commented Oct 1, 2021

@spaze @katmsft we're utilizing this library as part of the Microsoft Azure Storage for WordPress plugin (see source) and are currently blocked by getting this issue closed via a release for the already merged PR #302. Any ETA you can provide for an upcoming release will help us plan our downstream communications to users within the WordPress ecosystem. Many thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants