From:  pear-qa@lists.php.net ("kyra@existing.me")
Date:  19 Feb 2017 08:31:31 Hong Kong Time
Newsgroup:  news.php.net/php.pear.bugs
Subject:  

[PEAR-BUG] Bug #21182 [Com]: Uncaught Crypt_GPG_Exception: Unknown error getting GnuPG version information

NNTP-Posting-Host:  null

Edit report at https://pear.php.net/bugs/bug.php?id=21182&edit=1

 ID:               21182
 Comment by:       kyra@existing.me
 Reported By:      kyra at existing dot me
 Summary:          Uncaught Crypt_GPG_Exception: Unknown error getting
                    GnuPG version information
 Status:           Open
 Type:             Bug
 Package:          Crypt_GPG
 Operating System: Linux (Xubuntu)
 Package Version:  1.6.0b3
 PHP Version:      Irrelevant
 Roadmap Versions: 
 New Comment:

When I run the GPG command in a terminal I get this:

--- START---
$ /usr/bin/gpg2 --status-fd '3' --command-fd '4' --no-secmem-warning
--no-tty --no-default-keyring --no-options --always-trust
--ignore-time-conflict --ignore-valid-from --homedir
'/home/username/.gnupg' --version
gpg (GnuPG) 2.1.11
libgcrypt 1.6.5
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later

This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: /home/username/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
        CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2
--- END---

When I run this code and ONLY this code in a file I get the following
error:

---START---
 '/usr/bin/gpg-agent',
    'binary'  => '/usr/bin/gpg2',
    'debug'   => true,
    'homedir' => '/home/anon/.gnupg'
]);
$cryptGpg->getVersion();
---END---

Error:

---START---
Crypt_GPG DEBUG: OPENING GPG SUBPROCESS WITH THE FOLLOWING COMMAND:
Crypt_GPG DEBUG: /usr/bin/gpg2 --status-fd '3' --command-fd '4'
--no-secmem-warning --no-tty --no-default-keyring --no-options
--always-trust --ignore-time-conflict --ignore-valid-from --homedir
'/home/username/.gnupg' --version
Crypt_GPG DEBUG: BEGIN PROCESSING
Crypt_GPG DEBUG: selecting streams
Crypt_GPG DEBUG: => got 3
Crypt_GPG DEBUG: GPG output stream ready for reading
Crypt_GPG DEBUG: => about to read 65536 bytes from GPG output
Crypt_GPG DEBUG: => read 584 bytes
Crypt_GPG DEBUG: GPG error stream ready for reading
Crypt_GPG DEBUG: => about to read 65536 bytes from GPG error
Crypt_GPG DEBUG: => read 0 bytes
Crypt_GPG DEBUG: GPG status stream ready for reading
Crypt_GPG DEBUG: => about to read 65536 bytes from GPG status
Crypt_GPG DEBUG: => read 0 bytes
Crypt_GPG DEBUG: selecting streams
Crypt_GPG DEBUG: => got 1
Crypt_GPG DEBUG: GPG output stream ready for reading
Crypt_GPG DEBUG: => about to read 65536 bytes from GPG output
Crypt_GPG DEBUG: => read 0 bytes
Crypt_GPG DEBUG: END PROCESSING
Crypt_GPG DEBUG: CLOSING GPG SUBPROCESS
PHP Fatal error:  Uncaught Crypt_GPG_Exception: Unknown error getting
GnuPG version information. Please use the 'debug' option when creating
the Crypt_GPG object, and file a bug report at
http://pear.php.net/bugs/report.php?package=Crypt_GPG in
./vendor/pear/crypt_gpg/Crypt/GPG/Engine.php on line 1782
#0 ./vendor/pear/crypt_gpg/Crypt/GPG/Engine.php(1782):
Crypt_GPG_ProcessHandler->throwException(-1)
#1 ./vendor/pear/crypt_gpg/Crypt/GPG/Engine.php(837):
Crypt_GPG_Engine->_closeSubprocess()
#2 ./vendor/pear/crypt_gpg/Crypt/GPG/Engine.php(988):
Crypt_GPG_Engine->run()
#3 ./vendor/pear/crypt_gpg/Crypt/GPGAbstract.php(308):
Crypt_GPG_Engine->getVersion()
#4 ./test.php(11): Crypt_GPGAbstract->getVersion()
#5 {main}
thrown in ./vendor/pear/crypt_gpg/Crypt/GPG/ProcessHandler.php on line
560

Process finished with exit code 255
---END---


Previous Comments:
------------------------------------------------------------------------

[2017-02-17 11:28:22] alec

Oh, I forgot. You could also check a change of if() statement in
https://github.com/pear/Crypt_GPG/blob/master/Crypt/GPG/Engine.php#L1763
line to:
if ($exitCode > 0) {

------------------------------------------------------------------------

[2017-02-17 11:15:22] alec

What happens if you run the specified gpg command out of PHP? Also, try
to execute only this simple code:

$cryptGpg = new Crypt_GPG([ 'agent' => '/usr/bin/gpg-agent', 'binary' =>
'/usr/bin/gpg2', 'debug' => true, 'homedir' => '/home/username/.gnupg'
]);
$cryptGpg->getVersion();

Also, what if you do not use strict_types?

------------------------------------------------------------------------

[2017-02-17 10:35:45] kyrad

@alec Is there any additional info I should provide to get this worked
on and fixed? =o)

------------------------------------------------------------------------

[2017-02-14 08:46:00] kyrad

-Status: Bogus
+Status: Open
re-opening as the bug you referenced has since been deleted and this is
thus no longer a dupe.

------------------------------------------------------------------------

[2017-02-13 08:22:31] kyrad

It says "The user who submitted this bug has not yet confirmed their
email address."

I was having issues with submitting the form and getting a confirmation
email. I know I accidentally opened 21181 and I closed it as a dupe when
I found out. If I had erroneously submitted additional ones please
invalidate them. From my understanding 21180 will expire in 24hrs
anyways, thus making this bug the primary one. I apologize for the
confusion.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://pear.php.net/bugs/bug.php?id=21182

-- 
Edit this bug report at https://pear.php.net/bugs/bug.php?id=21182&edit=1