Skip to content

Commit

Permalink
Fixed wrong parameter number for openssl_open
Browse files Browse the repository at this point in the history
  • Loading branch information
lookyman authored and ondrejmirtes committed Oct 26, 2017
1 parent 3c3ebdf commit da31968
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Reflection/FunctionReflection.php
Expand Up @@ -196,6 +196,17 @@ public function getParameters(): array
true
);
}

if (
$this->reflection->getName() === 'openssl_open'
&& count($this->parameters) === 5
) {
$this->parameters[4] = new DummyParameter(
'method',
new StringType(),
true
);
}
}

return $this->parameters;
Expand Down
Expand Up @@ -159,6 +159,10 @@ public function testCallToWeirdFunctions()
'Function mysqli_fetch_all invoked with 3 parameters, 1-2 required.',
35,
],
[
'Function openssl_open invoked with 6 parameters, 4-5 required.',
37,
],
]);
}

Expand Down
Expand Up @@ -33,3 +33,5 @@
mysqli_fetch_all(new mysqli_result()); // OK
mysqli_fetch_all(new mysqli_result(), MYSQLI_ASSOC); // OK
mysqli_fetch_all(new mysqli_result(), MYSQLI_ASSOC, true); // should report 3 parameters given, 1-2 required
openssl_open('', $open, '', openssl_get_privatekey('')); // OK
openssl_open('', $open, '', openssl_get_privatekey(''), 'foo', 'bar'); // should report 6 parameters, 4-5 required.

0 comments on commit da31968

Please sign in to comment.