summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2016-02-01 10:03:03 (GMT)
committerNathaniel Catchpole2016-02-01 10:03:03 (GMT)
commit9d050abbf0f6012b186d5480dcf5f47afd123580 (patch)
tree1307521df045f03f9afdb2c475737342bc8bb1a9
parent340daaf7f8ba4467f9f75e045fd1b665af98f180 (diff)
Issue #2643274 by swentel, Mac_Weber, amateescu: EntityAutocomplete does not recognize URLs ending with a parenthesis
-rw-r--r--core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php4
-rw-r--r--core/modules/comment/src/Tests/CommentTranslationUITest.php2
-rw-r--r--core/modules/field/src/Tests/EntityReference/EntityReferenceAdminTest.php2
-rw-r--r--core/modules/link/src/Tests/LinkFieldTest.php4
4 files changed, 8 insertions, 4 deletions
diff --git a/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php b/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php
index 4273a41..d94e2b5 100644
--- a/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php
+++ b/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php
@@ -330,11 +330,11 @@ class EntityAutocomplete extends Textfield {
// Take "label (entity id)', match the ID from parenthesis when it's a
// number.
- if (preg_match("/.+\((\d+)\)/", $input, $matches)) {
+ if (preg_match("/.+\s\((\d+)\)/", $input, $matches)) {
$match = $matches[1];
}
// Match the ID when it's a string (e.g. for config entity types).
- elseif (preg_match("/.+\(([\w.]+)\)/", $input, $matches)) {
+ elseif (preg_match("/.+\s\(([\w.]+)\)/", $input, $matches)) {
$match = $matches[1];
}
diff --git a/core/modules/comment/src/Tests/CommentTranslationUITest.php b/core/modules/comment/src/Tests/CommentTranslationUITest.php
index 9b27a3e..1246aa8 100644
--- a/core/modules/comment/src/Tests/CommentTranslationUITest.php
+++ b/core/modules/comment/src/Tests/CommentTranslationUITest.php
@@ -164,7 +164,7 @@ class CommentTranslationUITest extends ContentTranslationUITestBase {
'created' => REQUEST_TIME - mt_rand(0, 1000),
);
$edit = array(
- 'uid' => $user->getUsername() . '(' . $user->id() . ')',
+ 'uid' => $user->getUsername() . ' (' . $user->id() . ')',
'date[date]' => format_date($values[$langcode]['created'], 'custom', 'Y-m-d'),
'date[time]' => format_date($values[$langcode]['created'], 'custom', 'H:i:s'),
);
diff --git a/core/modules/field/src/Tests/EntityReference/EntityReferenceAdminTest.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceAdminTest.php
index 6ed4843..9ee63b0 100644
--- a/core/modules/field/src/Tests/EntityReference/EntityReferenceAdminTest.php
+++ b/core/modules/field/src/Tests/EntityReference/EntityReferenceAdminTest.php
@@ -308,7 +308,7 @@ class EntityReferenceAdminTest extends WebTestBase {
$edit = array(
'title[0][value]' => 'Test',
- 'field_test_entity_ref_field[0][target_id]' => $node1->getTitle() . '(' . $node1->id() . ')'
+ 'field_test_entity_ref_field[0][target_id]' => $node1->getTitle() . ' (' . $node1->id() . ')'
);
$this->drupalPostForm('node/add/' . $this->type, $edit, t('Save'));
$this->assertLink($node1->getTitle());
diff --git a/core/modules/link/src/Tests/LinkFieldTest.php b/core/modules/link/src/Tests/LinkFieldTest.php
index eada494..79c2cbb 100644
--- a/core/modules/link/src/Tests/LinkFieldTest.php
+++ b/core/modules/link/src/Tests/LinkFieldTest.php
@@ -101,6 +101,10 @@ class LinkFieldTest extends WebTestBase {
// strings displayed to the user).
$valid_external_entries = array(
'http://www.example.com/' => 'http://www.example.com/',
+ // Strings within parenthesis without leading space char.
+ 'http://www.example.com/strings_(string_within_parenthesis)' => 'http://www.example.com/strings_(string_within_parenthesis)',
+ // Numbers within parenthesis without leading space char.
+ 'http://www.example.com/numbers_(9999)' => 'http://www.example.com/numbers_(9999)',
);
$valid_internal_entries = array(
'/entity_test/add' => '/entity_test/add',