Fix type for CURLOPT_POSTFIELDS#1777
Closed
VincentLanglet wants to merge 2 commits intophpstan:1.8.xfrom
Closed
Conversation
staabm
reviewed
Sep 30, 2022
| } | ||
|
|
||
| if (defined('CURLOPT_POSTFIELDS') && $curlOpt === CURLOPT_SSL_VERIFYHOST) { | ||
| return new UnionType([new StringType(), new ArrayType(new MixedType(), new MixedType())]); |
Contributor
There was a problem hiding this comment.
Can the array key/value types be more precise then mixed?
Contributor
Author
There was a problem hiding this comment.
Honestly, I dunno.
Doc say
The full data to post in a HTTP "POST" operation. This parameter can either be passed as a urlencoded string like 'para1=val1¶2=val2&...' or as an array with the field name as key and field data as value. If value is an array, the Content-Type header will be set to multipart/form-data. Files can be sent using [CURLFile](https://www.php.net/manual/en/class.curlfile.php) or [CURLStringFile](https://www.php.net/manual/en/class.curlstringfile.php), in which case value must be an array.
So, value can be string, arrays, but maybe others things...
And keys, it's string. But I'm kinda worried bout the int keys.
$a[0] = 'foo';
$a[1] = 'bar';
which could be considered as '0=foo&1=bar'. (since '0' key would still be casted to int...)
ondrejmirtes
requested changes
Sep 30, 2022
Member
ondrejmirtes
left a comment
There was a problem hiding this comment.
1.8.x base branch is correct.
| return new UnionType([new ConstantIntegerType(0), new ConstantIntegerType(2)]); | ||
| } | ||
|
|
||
| if (defined('CURLOPT_POSTFIELDS') && $curlOpt === CURLOPT_SSL_VERIFYHOST) { |
Member
There was a problem hiding this comment.
Copy paste error most likely here. Would be nice to verify also when a wrong type is passed when setting CURLOPT_POSTFIELDS.
41d9d39 to
322d19d
Compare
Member
|
Superseded by #1782 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #8065
Should I target 1.8.x (bugfix) or 1.9.x (since it's maybe the next release ?)