Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Openssl error string #3698

Closed
wants to merge 1 commit into from

2 participants

@Maks3w
Collaborator

No description provided.

@Maks3w
Collaborator

@CrisMKM for remove the unrelated commits do the following steps:

  • checkout the PR branch
  • git rebase -i HEAD~3
  • remove unrelated commits, save and quit
  • git rebase --continue
  • push your branch to your fork with the same name
@ghost

ok, that worked. Thanks a lot.

@weierophinney weierophinney commented on the diff
library/Zend/Crypt/PublicKey/Rsa.php
@@ -136,6 +136,19 @@ public function getOptions()
}
/**
+ * Return last openssl error(s)
+ *
+ * @return string
+ */
+ public function getOpensslErrorString()
+ {
+ $msg='';
+ while ($msg .= openssl_error_string())
+ $msg .= "\n";
@weierophinney Owner

Loops require braces, per our CS. Rewrite to:

while ($msg .= openssl_error_string()) {
    $msg .= "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@weierophinney weierophinney referenced this pull request from a commit
@weierophinney weierophinney [#3698] CS and logic fixes
- Use braces for all loops
- infinite loop condition, as $msg would be non-empty if any messages were
  found. Assigned results of openssl_error_message to temp variable, and did
  strict test against boolean false before concatenating
- trim the result
- use descriptive variable names
0da08d4
@weierophinney weierophinney referenced this pull request from a commit
@weierophinney weierophinney Merge branch 'hotfix/3698' into develop
Forward port #3698
e38f0ae
@weierophinney weierophinney was assigned
@ghost Unknown referenced this pull request from a commit
@weierophinney weierophinney [#3698] CS and logic fixes
- Use braces for all loops
- infinite loop condition, as $msg would be non-empty if any messages were
  found. Assigned results of openssl_error_message to temp variable, and did
  strict test against boolean false before concatenating
- trim the result
- use descriptive variable names
6267f52
@ghost Unknown referenced this pull request from a commit
@weierophinney weierophinney Merge branch 'hotfix/3698'
Close #3698
e331832
@ghost Unknown referenced this pull request from a commit
@weierophinney weierophinney Merge branch 'hotfix/3698' into develop
Forward port #3698
1c1d999
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 2 deletions.
  1. +15 −2 library/Zend/Crypt/PublicKey/Rsa.php
View
17 library/Zend/Crypt/PublicKey/Rsa.php
@@ -136,6 +136,19 @@ public function getOptions()
}
/**
+ * Return last openssl error(s)
+ *
+ * @return string
+ */
+ public function getOpensslErrorString()
+ {
+ $msg='';
+ while ($msg .= openssl_error_string())
+ $msg .= "\n";
@weierophinney Owner

Loops require braces, per our CS. Rewrite to:

while ($msg .= openssl_error_string()) {
    $msg .= "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ return $msg;
+ }
+
+ /**
* Sign with private key
*
* @param string $data
@@ -158,7 +171,7 @@ public function sign($data, Rsa\PrivateKey $privateKey = null)
);
if (false === $result) {
throw new Exception\RuntimeException(
- 'Can not generate signature; openssl ' . openssl_error_string()
+ 'Can not generate signature; openssl ' . $this->getOpensslErrorString()
);
}
@@ -221,7 +234,7 @@ public function verify(
);
if (-1 === $result) {
throw new Exception\RuntimeException(
- 'Can not verify signature; openssl ' . openssl_error_string()
+ 'Can not verify signature; openssl ' . $this->getOpensslErrorString()
);
}
Something went wrong with that request. Please try again.