Skip to content

changing scheme is silently broken. #14

Description

@nyamsprod

I received the followubg bug report on league/uri=polyfill. The package uses the latest version of the library.

<?php

require 'vendor/autoload.php';

var_dump((new Uri\WhatWg\Url('https://example.com/path'))->withScheme('http')->toAsciiString());
var_dump((new Uri\WhatWg\Url('https://user@example.com/path'))->withScheme('http')->toAsciiString());
var_dump((new Uri\WhatWg\Url('https://user:pass@example.com/path'))->withScheme('http')->toAsciiString());

behind the scene the polyfill uses the URL-parser. I tracked down the issue to the following snippet.

$url = new Rowbot\URL\URL('https://user:pass@example.com/path');
$url->protocol = 'http';
echo $url->toString(), PHP_EOL;
// expected 'http://user:pass@example.com/path'
// but got 'https://user:pass@example.com/path'
// with a silent error InvalidCredential

see thephpleague/uri-src#204

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions