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
Fix type for CURLOPT_POSTFIELDS #1777
Conversation
@@ -515,6 +515,10 @@ private static function getCurlOptValueType(int $curlOpt): ?Type | |||
return new UnionType([new ConstantIntegerType(0), new ConstantIntegerType(2)]); | |||
} | |||
|
|||
if (defined('CURLOPT_POSTFIELDS') && $curlOpt === CURLOPT_SSL_VERIFYHOST) { | |||
return new UnionType([new StringType(), new ArrayType(new MixedType(), new MixedType())]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the array key/value types be more precise then mixed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.8.x base branch is correct.
@@ -515,6 +515,10 @@ private static function getCurlOptValueType(int $curlOpt): ?Type | |||
return new UnionType([new ConstantIntegerType(0), new ConstantIntegerType(2)]); | |||
} | |||
|
|||
if (defined('CURLOPT_POSTFIELDS') && $curlOpt === CURLOPT_SSL_VERIFYHOST) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
Superseded by #1782 |
Closes #8065
Should I target 1.8.x (bugfix) or 1.9.x (since it's maybe the next release ?)