#1 Private key not properly set

closed-fixed
nobody
None
5
2002-08-12
2002-07-29
Anonymous
No

Perhaps this is really how you wanted it to work, but to me it
seems like it should work otherwise.

In your base class
constructor (version 2.5 - haven't checked other versions), the
following code can be found:

if ($environment) {
$this-
>environment = strtoupper($environment);
$this-
>PRIVATE_KEY = $this->{$this-
>environment.'_PRIVATE_KEY'};
}

This means
that the private key only gets set when the environment value is
passed to the constructor. This of course means that any script
wishing to use the class must pass along the environment
variable, rather than relying on the value stored in the client
extension class.

If a script does not pass along the
environment itself, openSRS returns an error message about a
"missing private key" because the constructor didn't set this
correctly.

With several different files using the class, it's
impractical to change the environment in all of them, when it only
should be changed once in the client extension
class.

So, I would propose the simple fix:

if
($environment)
$this->environment =
strtoupper($environment);

$this->PRIVATE_KEY =
$this->{$this-
>environment.'_PRIVATE_KEY'};

which sets the
private key regardless of whether or not the environment is
passed to the constructor. If nothing is passed in, it sets the key
according to the existing value of environment.

I hope
that helps you. I'm glad you've chosen to spend time and
resources developing this product, as it is a convenient way to
access the openSRS registry.

Thanks,

Jim
Cottrell
jcott33@hotmail.com

Discussion

  • Colin Viebrock

    Colin Viebrock - 2002-08-12
    • labels: 103160 -->
    • status: open --> open-fixed
     
  • Colin Viebrock

    Colin Viebrock - 2002-08-12

    Logged In: YES
    user_id=22560

    Sorry ... I so rarely use the SF website, I didn't even
    notice this bug report.

    Needless to say, that's an excellent suggestion. I've
    committed it to CVS and it'll be in the next release.

    - Colin

     
  • Colin Viebrock

    Colin Viebrock - 2002-08-12
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.