Skip to content

Commit

Permalink
Merge pull request #148 from Kharhamel/opensslException
Browse files Browse the repository at this point in the history
created an opensslException to use openssl_error_string instead of error_get_last
  • Loading branch information
Kharhamel authored Oct 21, 2019
2 parents 2b47e02 + d5b20cf commit b8848b0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
6 changes: 0 additions & 6 deletions generated/Exceptions/OpensslException.php

This file was deleted.

2 changes: 1 addition & 1 deletion generator/tests/GeneratedFilesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function testOpenSslSign()
require_once __DIR__ . '/../../generated/openssl.php';
require_once __DIR__ . '/../../lib/Exceptions/SafeExceptionInterface.php';
require_once __DIR__ . '/../../lib/Exceptions/AbstractSafeException.php';
require_once __DIR__ . '/../../generated/Exceptions/OpensslException.php';
require_once __DIR__ . '/../../lib/Exceptions/OpensslException.php';

\openssl_sign('foo', $signature, file_get_contents(__DIR__ . '/fixtures/id_rsa'));
openssl_sign('foo', $signatureSafe, file_get_contents(__DIR__ . '/fixtures/id_rsa'));
Expand Down
12 changes: 12 additions & 0 deletions lib/Exceptions/OpensslException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php


namespace Safe\Exceptions;

class OpensslException extends \Exception implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new static(\openssl_error_string(), 0);
}
}

0 comments on commit b8848b0

Please sign in to comment.