Skip to content

AuthHelper::getCurrentUrl() doesn't strip out querystring #194

Open
@syosoft

Description

@syosoft

Found a bug in AuthHelper related to getCurrentUrl() (the querystring isn't stripped out). It's easy enough to fix, however - If static::getCurrentUrl() was used in place of self::getCurrentUrl() in \PHPShopify\AuthHelper::createAuthRequest() I could simply:

class PHPShopify_AuthHelper_BugFix extends \PHPShopify\AuthHelper {
        public static function getCurrentUrl() {
                $redirectUrl = parent::getCurrentUrl();

                // Shopify doesn't want a querystring, just the protocol and store host
                // The returned URL *MUST* match one of the app redirect URLs
                return FALSE !== ($qs_pos = strpos($redirectUrl, '?')) ? substr($redirectUrl, 0, $qs_pos) : $redirectUrl;
        }
}

Instead of having to duplicate the \PHPShopify\AuthHelper::createAuthRequest() method in this PHPShopify_AuthHelper_BugFix class just to have my overloaded method called because an inconvenient static scope was used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions