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

The bug related to storing keys in a singleton pattern. #161

Open
zhichao-poper opened this issue Nov 20, 2023 · 1 comment
Open

The bug related to storing keys in a singleton pattern. #161

zhichao-poper opened this issue Nov 20, 2023 · 1 comment
Assignees

Comments

@zhichao-poper
Copy link

Code like this:

// keys A
$keys[] = [
        'omise_public' => 'pkey_test_A',
        'omise_secret' => 'skey_test_A',
];
// keys B
$keys[] = [
        'omise_public' => 'pkey_test_B',
        'omise_secret' => 'skey_test_B',
];
$omiseKey = $keys[0];
OmiseSchedule::retrieve('schd_test_A', $omiseKey['omise_public'], $omiseKey['omise_secret']);
$omiseKey = $keys[1];
OmiseSchedule::retrieve('schd_test_B', $omiseKey['omise_public'], $omiseKey['omise_secret']);

will get

OmiseNotFoundException

schedule schd_test_B was not found

schd_test_A from keys A

schd_test_B from keys B

The issue arises from OmiseSchedule utilizing the singleton pattern to store keys. Consequently, subsequent instances of OmiseSchedule are unable to utilize their own keys for data requests, instead using the keys stored from the previous instance of OmiseSchedule.

Please verify if this is a bug or an issue with my usage.

@aashishgurung
Copy link
Contributor

@zhichao-poper Thanks for reaching out. We will look into this and let you know about our findings.

aashishgurung added a commit that referenced this issue Aug 26, 2024
## Description

Resolve issue of keys passed to method not being used

Related issue: #161
 
## Rollback procedure

`default rollback procedure`
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