[PEAR-BUG] Bug #21182 [Com]: Uncaught Crypt_GPG_Exception: Unknown error getting GnuPG version information
[email protected] ("
[email protected]")
Sun, 19 Feb 2017 15:04:04 -0500 (EST)
| Newsgroups |
php.pear.bugs |
| Message-ID |
<[email protected]> |
Edit report at https://pear.php.net/bugs/bug.php?id=21182&edit=1
ID: 21182
Comment by: [email protected]
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:
No more error when making that last code change, and I can now access
the fingerprint too.
So is the solution going to be to just ignore this error code, or do we
want to dig deeper and find out why it's returning that code?
Previous Comments:
------------------------------------------------------------------------
[2017-02-19 14:45:39] alec
Oh, indeed. There's another place to do a similiar modification. See
https://github.com/pear/Crypt_GPG/blob/master/Crypt/GPG/ProcessHandler.php#L542
------------------------------------------------------------------------
[2017-02-19 12:27:04] kyrad
The results I posted above were after I changed that line of code you
asked to change. I just double checked and ran a die statement in the IF
block and it gets triggered without the change, and then no longer
triggers after the change. However, both instances still produce the
error about "Unknown error getting GnuPG version information"
------------------------------------------------------------------------
[2017-02-19 02:52:50] alec
proc_close() returns -1 for some reason, but maybe we might just ignore
this case. That's why I asked in another comment for test with small
code change.
------------------------------------------------------------------------
[2017-02-18 19:31:31] kyrad
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
<http://gnu.org/licenses/gpl.html>
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---
<?php
include __DIR__ . '/vendor/autoload.php';
$cryptGpg = new Crypt_GPG([
'agent' => '/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---
------------------------------------------------------------------------
[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) {
------------------------------------------------------------------------
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