php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71919 openssl_pkey_get_private/public() require 2 calls to openssl_pkey_free()
Submitted: 2016-03-29 12:32 UTC Modified: 2017-10-30 12:37 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: gelenkig at runbox dot com Assigned: bukka (profile)
Status: Closed Package: OpenSSL related
PHP Version: 5.5.33 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
35 - 16 = ?
Subscribe to this entry?

 
 [2016-03-29 12:32 UTC] gelenkig at runbox dot com
Description:
------------
This code works as expected:

  $r = openssl_pkey_new();
  // passes
  assert(is_resource($r));
  openssl_pkey_free($r);
  // passes
  assert(!is_resource($r));



Test script:
---------------
This code works wrong:

  $r = openssl_pkey_new();
  openssl_pkey_export($r, $pem);
  openssl_pkey_free($r);
  $r = openssl_pkey_get_private($pem);
  // passes
  assert(is_resource($r));
  openssl_pkey_free($r);
  // assertion below must not pass but it does pass
  assert(is_resource($r));
  openssl_pkey_free($r);
  // passes
  assert(!is_resource($r));

Same wrong behaviour for openssl_pkey_get_public().

Expected result:
----------------
  // either that or openssl_pkey_get_public()
  $r = openssl_pkey_get_private($pem);
  // passes
  assert(is_resource($r));
  openssl_pkey_free($r);
  // passes (in reality DOES NOT)
  assert(is_resource($r));



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-10-30 12:37 UTC] bukka@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: bukka
 [2017-10-30 12:37 UTC] bukka@php.net
This was fixed in 7.0 when extension was ported and is no longer an issue. It is still present in 5.6 but that's just for security related fixes. So closing.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 23 06:01:35 2024 UTC