Unable to send large attachment: LargeFileUploadTask and headers
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
Research direction
Start in Microsoft\Kiota\Abstractions\RequestHeaders and inspect the getAll method, especially its array_keys handling of header values. Reproduce or verify the large attachment upload path with PHP 8.4 and confirm that getAll returns string header keys and large attachments can be sent without the Guzzle request deprecation.
Written by the indexing model from the issue text.
Description
Unable to upload large attachment. In the file Microsoft\Kiota\Abstractions\RequestHeaders, the array_keys function is used, which casts a string to a number. PHP 8.4 on x64 does this.
In the getAll method, it is cast and then an error is returned: Since guzzlehttp/psr7 2.11: Passing int to GuzzleHttp\Psr7\Request::__construct() is deprecated; guzzlehttp/psr7 3.0 requires string|string[].
Instead of array_keys, you must use foreach.
A method with array_keys that casts string to int.
public function getAll(): array
{
$result = [];
foreach ($this->headers as $key => $value) {
$result[$key] = array_keys($value);
}
return $result;
}
A method with foreach that works.
public function getAll(): array
{
$result = [];
foreach ($this->headers as $key => $value) {
foreach ($value as $k => $v) {
$result[$key][] = strval($k);
}
//$result[$key] = array_keys($value);
}
return $result;
}
After this change, sending large attachments works.
- Dominant language
- PHP
- Stars
- 669
- Forks
- 150
- Avg merge
- 15h 21m
- Merged PRs (30d)
- 3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoftgraph/msgraph-sdk-php
-
bug: metadata type:bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
microsoftgraph/msgraph-sdk-php#1739 · 6 comments ·
-
status:waiting-for-triage type:bug
Difficulty 1/5 Under an hour Newbie friendliness 68/100
microsoftgraph/msgraph-sdk-php#1643 · 8 comments · 4 reactions ·
-
status:waiting-for-triage
Difficulty 5/5 Over a week Newbie friendliness 35/100
microsoftgraph/msgraph-sdk-php#1800 · 1 reaction ·
-
Now Open
Difficulty 5/5 Over a week Newbie friendliness 1/100
microsoftgraph/msgraph-sdk-php#1799 ·
-
status:waiting-for-triage
Difficulty 4/5 3-5 days Newbie friendliness 45/100
microsoftgraph/msgraph-sdk-php#1792 ·
All issues in microsoftgraph/msgraph-sdk-php
Similar issues
-
priority: p3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
googleapis/librarian#7636 ·
-
0. Needs triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nextcloud/fulltextsearch#1011 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
phpstan/phpstan-doctrine#794 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Automattic/static-site-importer#1767 ·