diff --git a/src/OpenSSL.php b/src/OpenSSL.php index afa7a0b..f8fb8d7 100644 --- a/src/OpenSSL.php +++ b/src/OpenSSL.php @@ -57,7 +57,8 @@ class OpenSSL $ffi = static::getFFI(); $errs = []; while (0 !== ($code = $ffi->ERR_get_error())) { - $errs[] = FFI::string($ffi->ERR_error_string($code, null)); + $ptr = $ffi->ERR_error_string($code, null); + $errs[] = FFI::string($ptr); } return $errs; @@ -68,7 +69,7 @@ class OpenSSL return FFI::cast("long long", $data)->cdata; } - static $caStore = null; + public static $caStore = null; public static function CAStore() { diff --git a/src/OpenSSL/C/CBackedObjectWithOwner.php b/src/OpenSSL/C/CBackedObjectWithOwner.php index c016d66..9773e37 100644 --- a/src/OpenSSL/C/CBackedObjectWithOwner.php +++ b/src/OpenSSL/C/CBackedObjectWithOwner.php @@ -10,7 +10,7 @@ use FFI\CData; class CBackedObjectWithOwner extends CBackedObject { - static private array $known = []; + private static array $known = []; private int $address = -1; protected FFI $ffi; diff --git a/src/OpenSSL/PKCS7/Signed.php b/src/OpenSSL/PKCS7/Signed.php index 6fe4c6c..b770be1 100644 --- a/src/OpenSSL/PKCS7/Signed.php +++ b/src/OpenSSL/PKCS7/Signed.php @@ -15,7 +15,6 @@ class Signed public function getCerts(): X509Stack { - $stack = X509Stack::from($this->ffi, $this->data->cert, $this); $stack->unmanaged(); return $stack; diff --git a/src/OpenSSL/Stack.php b/src/OpenSSL/Stack.php index 104a020..26749b5 100644 --- a/src/OpenSSL/Stack.php +++ b/src/OpenSSL/Stack.php @@ -196,9 +196,9 @@ abstract class Stack extends CBackedObjectWithOwner implements Countable, ArrayA public function __clone() { - $cObj = $this->ffi->sk_dup($this->cObj); + $this->cObj = $this->ffi->sk_dup($this->cObj); - if ($cObj === null) { + if ($this->cObj === null) { throw new RuntimeException("Failed to clone stack"); } @@ -206,7 +206,5 @@ abstract class Stack extends CBackedObjectWithOwner implements Countable, ArrayA foreach ($this as $obj) { $obj->pushRefCount(); } - - return new static($this->ffi, $cObj); } }