Skip to content

Commit fd24ca5

Browse files
committed
use realpath to check files that be loaded through realpath
1 parent 97ad7f9 commit fd24ca5

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

‎src/Cryptography/Keys/EcdsaPrivateKey.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class EcdsaPrivateKey
2424
*/
2525
public function __construct(string $key, string $passphrase = '', ?string $id = null)
2626
{
27-
$content = file_exists($key) ? file_get_contents(realpath($key)) : $key;
27+
$content = realpath($key) ? file_get_contents(realpath($key)) : $key;
2828

2929
$this->resource = openssl_pkey_get_private($content, $passphrase);
3030
if ($this->resource === false) {

‎src/Cryptography/Keys/EcdsaPublicKey.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class EcdsaPublicKey
2323
*/
2424
public function __construct(string $key, ?string $id = null)
2525
{
26-
$content = file_exists($key) ? file_get_contents(realpath($key)) : $key;
26+
$content = realpath($key) ? file_get_contents(realpath($key)) : $key;
2727

2828
$this->resource = openssl_pkey_get_public($content);
2929
if ($this->resource === false) {

‎src/Cryptography/Keys/RsaPrivateKey.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class RsaPrivateKey
2424
*/
2525
public function __construct(string $key, string $passphrase = '', ?string $id = null)
2626
{
27-
$content = file_exists($key) ? file_get_contents(realpath($key)) : $key;
27+
$content = realpath($key) ? file_get_contents(realpath($key)) : $key;
2828

2929
$this->resource = openssl_pkey_get_private($content, $passphrase);
3030
if ($this->resource === false) {

‎src/Cryptography/Keys/RsaPublicKey.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class RsaPublicKey
2323
*/
2424
public function __construct(string $key, ?string $id = null)
2525
{
26-
$content = file_exists($key) ? file_get_contents(realpath($key)) : $key;
26+
$content = realpath($key) ? file_get_contents(realpath($key)) : $key;
2727

2828
$this->resource = openssl_pkey_get_public($content);
2929
if ($this->resource === false) {

0 commit comments

Comments
 (0)