jwt-framework icon indicating copy to clipboard operation
jwt-framework copied to clipboard

better error message

Open jasverix opened this issue 1 year ago • 1 comments

Target branch: 4.x

  • [x] It is a Bug fix
  • [ ] It is a New feature
  • [ ] It is related to dependencies

Includes:

  • [ ] Breaks BC
  • [ ] Deprecations

The error message if a key fails is not very informational. The openssl extension provides more details, so we need that in the exception thrown.

jasverix avatar May 10 '24 11:05 jasverix

Hi,

Many thanks for this PR. Howvever it may send truncated messages or false. An alternative could be as follows:

$opensslMessages = [];
while ($m = openssl_error_string()) {
    $opensslmessages[] = $m;
}
throw new InvalidArgumentException('Unable to load the key.', ['opensslMessages' => $opensslMessages]);

EDIT: to be rebased for 3.4.x

Spomky avatar May 27 '24 05:05 Spomky