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

OauthCacheFile constructor doesn't work #98

Open
thomas2411 opened this issue Aug 21, 2018 · 1 comment
Open

OauthCacheFile constructor doesn't work #98

thomas2411 opened this issue Aug 21, 2018 · 1 comment

Comments

@thomas2411
Copy link

thomas2411 commented Aug 21, 2018

I try to set file Cache for OAuth like this:
OpenPayU_Configuration::setOauthTokenCache(new OauthCacheFile('/home/user/domains/mydomain.com/public_html/var/payu_cache'));

But I got error like this:

Cache directory [/home/user/domains/mydomain.com/public_html/vendor/openpayu/openpayu
/lib/OpenPayU/Oauth/Cache/../../../Cache] not exist or not writable 

So it seems like the code doesn't take $directory into account.

See the code of OauthCacheFile :

public function __construct($directory = null)
    {
        //1
        if ($directory === null) {
            $directory = dirname(__FILE__).'/../../../Cache';
        }
        //2
        if (!is_dir($directory) || !is_writable($directory)) {
            //3
            throw new OpenPayU_Exception_Configuration('Cache directory [' . $directory . '] not exist or not writable.');
        }

        $this->directory = $directory . (substr($directory, -1) != '/' ? '/' : '');
    }

I have echoed $directory and in:
1 it is OK,
2 it is OK,
3 it is OK

and then OpenPayU_Exception_Configuration throws error like this:

Cache directory [/home/user/domains/mydomain.com/public_html/vendor/openpayu/openpayu /lib/OpenPayU/Oauth/Cache/../../../Cache] not exist or not writable

Why this is not working? How on earth OpenPayU_Exception_Configuration takes default $directory as a parameter of the error message instead of the one passed as constructor parameter?

@matisiekpl
Copy link

Any updates?

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