jbelien / oauth2-openstreetmap

OpenStreetMap OAuth 2.0 support for the PHP League's OAuth 2.0 Client
MIT License
3 stars 2 forks source link

Cannot access private property JBelien\OAuth2\Client\Provider\OpenStreetMap::$dev #4

Closed sgrossberndt closed 2 years ago

sgrossberndt commented 2 years ago

Hi! I tried to use your provider, but setting the dev option does not work:

$OpenStreetMapProvider = new \JBelien\OAuth2\Client\Provider\OpenStreetMap([
    'clientId'     => 'yourId',          // The client ID assigned to you by OpenStreetMap.org
    'clientSecret' => 'yourSecret',      // The client password assigned to you by OpenStreetMap.org
    'redirectUri'  => 'yourRedirectUri',  // The return URL you specified for your app on OpenStreetMap.org
    'dev' => true
]);

results in an error Cannot access private property JBelien\OAuth2\Client\Provider\OpenStreetMap::$dev using league/oauth2-client v2.6.0, in oauth2-client/src/Tool/GuardedPropertyTrait.php line 45 due to

        foreach ($options as $option => $value) {
            if (property_exists($this, $option) && !$this->isGuarded($option)) {
                $this->{$option} = $value;
            }
        }
    }

Changing the visibility for $dev from private to protected solves the issue:

    protected $dev = false;
jbelien commented 2 years ago

Good catch ! πŸ‘

jbelien commented 2 years ago

New release 0.1.2 πŸš€

sgrossberndt commented 2 years ago

Thanks for the fast merge and release! 😍