File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -42,13 +42,14 @@ public function createClient(array $config = [])
42
42
43
43
// Try to resolve curl constant names
44
44
foreach ($ config as $ key => $ value ) {
45
- // If the value starts with 'CURL' we assume it is a reference to a constant.
46
- if (strpos ($ key , 'CURL ' ) === 0 ) {
47
- $ contantValue = constant ($ key );
48
- if ($ contantValue !== null ) {
49
- unset($ config [$ key ]);
50
- $ config [$ contantValue ] = $ value ;
45
+ // If the $key is a string we assume it is a constant
46
+ if (is_string ($ key )) {
47
+ if (null === ($ constantValue = constant ($ key ))) {
48
+ throw new \LogicException (sprintf ('Key %s is not an int nor a CURL constant ' , $ key ));
51
49
}
50
+
51
+ unset($ config [$ key ]);
52
+ $ config [$ constantValue ] = $ value ;
52
53
}
53
54
}
54
55
You can’t perform that action at this time.
0 commit comments