Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work when xdebug extension is enabled #10

Open
nask0 opened this issue Apr 18, 2021 · 1 comment
Open

Doesn't work when xdebug extension is enabled #10

nask0 opened this issue Apr 18, 2021 · 1 comment

Comments

@nask0
Copy link

nask0 commented Apr 18, 2021

Hello,
This is not really a bug in hidden-string library, I just wanted to point out that when xdebug extension is enabled, it simply ignores __debugInfo() and dumps HiddenString object. Consider the following snippet:

require_once realpath(dirname(__DIR__)) . '/vendor/autoload.php';

$hs = new \ParagonIE\HiddenString\HiddenString('some string');
var_dump($hs); 

Output with xdebug enabled:

class ParagonIE\HiddenString\HiddenString#4 (3) {
  protected string $internalStringValue =>
  string(11) "some string"
  protected bool $disallowInline =>
  bool(true)
  protected bool $disallowSerialization =>
  bool(true)
}

Output with xdebug disabled:

object(ParagonIE\HiddenString\HiddenString)#4 (2) {
  ["internalStringValue"]=>
  string(1) "*"
  ["attention"]=>
  string(82) "If you need the value of a HiddenString, invoke getString() instead of dumping it."
}

Maybe it's good idea to point out that in documentation, or better, just throw an exception if extension is enabled. Maintener
of Xdebug state's that this is intended behavior and won't be changed.
I know that this fact is pointed out in HiddenString::__debugInfo() method comments, but not everyone reads the code :)

@paragonie-security
Copy link
Contributor

Thanks for reporting this. Our clients don't use Xdebug in production, so we haven't encountered this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants