Skip to content

Conversation

benja-M-1
Copy link
Contributor

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets ~
License MIT
Doc PR ~

@benja-M-1 benja-M-1 changed the title Remove the query string and the anchor of the uri of a link [DomCrawler] Remove the query string and the anchor of the uri of a link Jun 21, 2014
@@ -129,7 +121,7 @@ public function getUri()

// absolute path
if ('/' === $uri[0]) {
return $baseUri.$uri;
return $this->cleanUri($baseUri).$uri;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be done before the preg_replace call a few lines above actually ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on your comment I refactored a bit the code.

@benja-M-1
Copy link
Contributor Author

@fabpot do you want me to squash the first commit and the second in which I renamed the method?

@fabpot
Copy link
Member

fabpot commented Jun 25, 2014

👍


// anchor or query string
if ('#' === $uri[0] || '?' === $uri[0]) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is wrong. In case the link is an anchored link, the query string should not be removed from the current URI, only the fragment

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, this case is missing from the testsuite

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hum you are right. I didn't thought about this case. I will change this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please also add a test covering the combination of query string and fragment for both types of links

*
* @param $uri
*
* @return array
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this returns a string

@stof
Copy link
Member

stof commented Jun 30, 2014

once the phpdoc is fixed, 👍

@stof
Copy link
Member

stof commented Jul 3, 2014

Thank you @benja-M-1.

stof added a commit that referenced this pull request Jul 3, 2014
… uri of a link (benja-M-1)

This PR was squashed before being merged into the 2.3 branch (closes #11194).

Discussion
----------

[DomCrawler] Remove the query string and the anchor of the uri of a link

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | ~
| License       | MIT
| Doc PR        | ~

Commits
-------

fe5d2d1 [DomCrawler] Remove the query string and the anchor of the uri of a link
@stof stof closed this Jul 3, 2014
stof added a commit that referenced this pull request Jul 3, 2014
This PR was merged into the 2.3 branch.

Discussion
----------

[DomCrawler] Fix Link docblocks and formatting

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

re #11194

Commits
-------

5cbe13e [DomCrawler] Fix docblocks and formatting.
@benja-M-1 benja-M-1 deleted the hotfix/dom-crawler-link branch July 5, 2014 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants