Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't send file from stream_type MEMORY #411

Closed
bscheshirwork opened this issue Apr 7, 2021 · 2 comments
Closed

Can't send file from stream_type MEMORY #411

bscheshirwork opened this issue Apr 7, 2021 · 2 comments

Comments

@bscheshirwork
Copy link

PHP version: 7.3.27 (hint: php --version)

Description

Undefined index: uri in /app/vendor/guzzlehttp/psr7/src/Utils.php:320

\stream_get_meta_data($resource) return

array (
  'timed_out' => false,
  'blocked' => true,
  'eof' => false,
  'stream_type' => 'MEMORY',
  'mode' => 'rb',
  'unread_bytes' => 0,
  'seekable' => true,
)

How to reproduce

  1. read 0 bytes from bytea field of table with ActiveRecord yii2
    (as resource from \PDOStatement::execute(); \PDOStatement::fetch(); see https://www.php.net/manual/en/class.pdostatement.php )
  2. send as multipart file this resource

Possible Solution

                $metaData = \stream_get_meta_data($resource);
                if (array_key_exists('uri', $metaData) && $metaData['uri'] === 'php://input') {

or

                if (\stream_get_meta_data($resource)['uri'] ?? '' === 'php://input') {

Additional context

@stale
Copy link

stale bot commented Aug 5, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 2 weeks if no further activity occurs. Thank you for your contributions.

@stale stale bot added the lifecycle/stale label Aug 5, 2021
@stale stale bot closed this as completed Aug 19, 2021
@GrahamCampbell
Copy link
Member

Fixed in 1.8.2 and 2.0.0.

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

Successfully merging a pull request may close this issue.

2 participants