Skip to content

generateUrl drops http scheme #16991

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

Closed
jonathanbull opened this issue Dec 13, 2015 · 3 comments
Closed

generateUrl drops http scheme #16991

jonathanbull opened this issue Dec 13, 2015 · 3 comments

Comments

@jonathanbull
Copy link

The documentation implies that passing true as the third parameter to generateUrl will generate an absolute URL, including the scheme. This works as expected for a https URL, but in the case of a http URL, the scheme gets dropped. As a workaround I'm passing a 0 as the third argument:

foo_route:
    path:  /foo
    defaults: { _controller: FooBundle:Bar:index }
    schemes: [http] 

// Returns: //mydomain.com/foo
$this->generateUrl('foo_route', [], true);

// Returns: http://mydomain.com/foo
$this->generateUrl('foo_route', [], 0);

Is this a bug?

@Tobion
Copy link
Contributor

Tobion commented Dec 13, 2015

See symfony/symfony-docs#6009. You need to use the constant, not true.

@Tobion Tobion closed this as completed Dec 13, 2015
@jonathanbull
Copy link
Author

Great, thanks for the prompt commit/reply.

xabbuh added a commit to symfony/symfony-docs that referenced this issue Dec 14, 2015
This PR was merged into the 2.3 branch.

Discussion
----------

Fix missing constant usage for generating urls

This was forgotten in #5813 as reported in symfony/symfony#16991

Commits
-------

2ecc541 Fix missing constant usage for generating urls
@xabbuh
Copy link
Member

xabbuh commented Dec 14, 2015

The documentation PR has been merged and the changes should be visible by tomorrow.

xabbuh added a commit to symfony/symfony-docs that referenced this issue Feb 17, 2016
…rface::ABSOLUTE_URI (eriwin)

This PR was merged into the 2.3 branch.

Discussion
----------

[Book] [Routing] Fix third param true to UrlGeneratorInterface::ABSOLUTE_URI

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | all
| Fixed tickets | symfony/symfony#16991

This was forgotten in #6009

Commits
-------

ec53faa Updated third param true to UrlGeneratorInterface::ABSOLUTE_URl in text Generating Absolute URLs
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

3 participants