few arrays in Drupal defined same array keys twice, for example:

$elements['checkbox']['element'] = array(
'#title' => $this->randomName(),  // <<< ~~~~~~~ SAME KEY
'#type' => 'checkbox',
'#required' => TRUE,
'#title' => $this->randomName()  // <<< ~~~~~~~  SAME KEY
);
Files: 
CommentFileSizeAuthor
#29 duplicate_array_key-1599618-29.patch3.75 KBAlbert Volkman
PASSED: [[SimpleTest]]: [MySQL] 39,253 pass(es).
[ View ]
#26 duplicate_array_key-1599618-26.patch666 bytesAlbert Volkman
PASSED: [[SimpleTest]]: [MySQL] 37,259 pass(es).
[ View ]
#26 duplicate_array_key-all-changes-do-not-test.patch4.25 KBAlbert Volkman
#15 1599618-duplicate_array_key-14.patch4.27 KByurtboy
PASSED: [[SimpleTest]]: [MySQL] 36,827 pass(es).
[ View ]
#14 1599618-duplicate_array_key-14.patch4.27 KByurtboy
PASSED: [[SimpleTest]]: [MySQL] 36,841 pass(es).
[ View ]
#7 1599618-duplicate_array_key-7.patch4.17 KBdroplet
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1599618-duplicate_array_key-7.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#5 1599618-duplicate_array_key2.patch4.28 KBdroplet
PASSED: [[SimpleTest]]: [MySQL] 36,652 pass(es).
[ View ]
kill_duplcate_array_key.patch15.36 KBdroplet
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch kill_duplcate_array_key.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Comments

Component:base system» book.module

This isn't the base system.

Component:book.module» other

kill_duplcate_array_key.patch queued for re-testing.

Status:Needs review» Needs work
Issue tags:+Quick fix, +needs backport to D7

The last submitted patch, kill_duplcate_array_key.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new4.28 KB
PASSED: [[SimpleTest]]: [MySQL] 36,652 pass(es).
[ View ]

Looks good to me, except maybe for:

+++ b/core/modules/system/lib/system/Tests/Batch/PercentagesUnitTest.phpundefined
@@ -55,9 +55,6 @@ class PercentagesUnitTest extends UnitTestBase {
-      // Regardless of number of digits we're using, 100% should always just be
-      // 100%.

Maybe we should remove the 100 => 3/3 test case instead, since the 200/200 testcase tests specifically for numbers with more digits.

StatusFileSize
new4.17 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1599618-duplicate_array_key-7.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

The last submitted patch, 1599618-duplicate_array_key-7.patch, failed testing.

Status:Needs work» Needs review
Issue tags:+Quick fix, +needs backport to D7

#7: 1599618-duplicate_array_key-7.patch queued for re-testing.

Title:Remove duplicate array keyRemove duplicate array keys
Status:Needs review» Reviewed & tested by the community

Looks good to me, nice clean-up!

Patch doesn't seem to apply:

vortex:drupal-head dries$ git apply ../f.patch
error: core/modules/system/tests/form.test: No such file or directory

Asking for a re-test.

Status:Reviewed & tested by the community» Needs work
Issue tags:+Quick fix, +needs backport to D7

The last submitted patch, 1599618-duplicate_array_key-7.patch, failed testing.

StatusFileSize
new4.27 KB
PASSED: [[SimpleTest]]: [MySQL] 36,841 pass(es).
[ View ]

Applied patch but it failed but then I modified it to pass locally

Checking patch core/modules/book/book.module...
Checking patch core/modules/file/file.field.inc...
Checking patch core/modules/language/lib/Drupal/language/Tests/LanguageBrowserDetectionUnitTest.php...
Checking patch core/modules/system/lib/Drupal/system/Tests/Batch/PercentagesUnitTest.php...
Checking patch core/modules/system/tests/form.test...
error: core/modules/system/tests/form.test: No such file or directory

After modifications

Checking patch core/modules/book/book.module...
Checking patch core/modules/file/file.field.inc...
Checking patch core/modules/language/lib/Drupal/language/Tests/LanguageBrowserDetectionUnitTest.php...
Checking patch core/modules/system/lib/Drupal/system/Tests/Batch/PercentagesUnitTest.php...
Checking patch core/modules/system/lib/Drupal/system/Tests/Form/FormTest.php...
Hunk #1 succeeded at 75 (offset 2 lines).
Applied patch core/modules/book/book.module cleanly.
Applied patch core/modules/file/file.field.inc cleanly.
Applied patch core/modules/language/lib/Drupal/language/Tests/LanguageBrowserDetectionUnitTest.php cleanly.
Applied patch core/modules/system/lib/Drupal/system/Tests/Batch/PercentagesUnitTest.php cleanly.
Applied patch core/modules/system/lib/Drupal/system/Tests/Form/FormTest.php cleanly.

It applied cleanly at
HEAD is now at 4bd1231 - Patch #1630108 by cosmicdreams: improper reference to Drupal\Database\Query\AlterableInterface.

Title:Remove duplicate array keysRemove duplicate array keys (take two)
Status:Needs work» Needs review
StatusFileSize
new4.27 KB
PASSED: [[SimpleTest]]: [MySQL] 36,827 pass(es).
[ View ]

seems I did not need a take two. I just misunderstood that status message after the comment was posted.

Title:Remove duplicate array keys (take two)Remove duplicate array keys
Status:Needs review» Reviewed & tested by the community

#15 okay.

Status:Reviewed & tested by the community» Needs work

Thank you for contributing to core but what is going on here?? I see test changes, a new persistent variable introduced, a CSS class changing... omnibus patch :)

Status:Needs work» Needs review

@chx,

look at #0 patch with more diff context :)

eg.

+++ b/core/modules/book/book.moduleundefined
@@ -540,13 +540,12 @@ function _book_add_form_elements(&$form, &$form_state, Node $node) {
     '#attributes' => array(
-      'class' => array('book-form'),
+      'class' => array('book-outline-form'),
     ),
     '#attached' => array(
...
-    '#attributes' => array('class' => array('book-outline-form')),

last one overrided previous one

same problem to others.

+++ b/core/modules/system/lib/Drupal/system/Tests/Form/FormTest.phpundefined
@@ -75,7 +75,7 @@ class FormTest extends WebTestBase {
-    $elements['checkbox']['element'] = array('#title' => $this->randomName(), '#type' => 'checkbox', '#required' => TRUE, '#title' => $this->randomName());

2 "#title" here :)

Status:Needs review» Active

Ah so. Thanks.

??

so remove it . anything wrong ?

var_dump( array('a' => 'xyz', 'a' => 'xyz')  === array('a' => 'xyz') );

output:

bool(true)

Status:Active» Reviewed & tested by the community

Erm. Sorry, wrong status.

Version:8.x-dev» 7.x-dev
Status:Reviewed & tested by the community» Patch (to be ported)

All of these seem to make sense (once you read the surrounding code) except:

       'en,en-US;q=0.5,fr;q=0.25' => 'en',
-      'en-US,en;q=0.5,fr;q=0.25' => 'en-US',

One is keyed en,en-US, the other en-US,en, so I'm not sure how these are duplicates. Also, the above code notes:

      // In our test case, 'en' has priority over 'en-US'.

Therefore, I don't think removing this is correct; the similar values seem to be intentional. If this is wrong, feel free to re-open.

Committed and pushed the rest of the patch to 8.x. Nice catches! Will need a port to D7 due to PSR-0.

In the future, though, please make meaningful issue summaries to explain to people what a patch is doing. That ":)" cost me 10-15 minutes of not committing other peoples' patches. :(

Version:7.x-dev» 8.x-dev
Status:Patch (to be ported)» Needs work

There're at different places:

      // Different qvalues.
      'en-US,en;q=0.5,fr;q=0.25' => 'en-US',   // <~~~~~~~~~~~~~~~ THIS ONE
      'fr,en;q=0.5' => 'fr-CA',
      'fr,en;q=0.5,fr-CA;q=0.25' => 'fr',
      // Silly wildcards are also valid.
      '*,fr-CA;q=0.5' => 'en',
      '*,en;q=0.25' => 'fr-CA',
      'en,en-US;q=0.5,fr;q=0.25' => 'en',
      'en-US,en;q=0.5,fr;q=0.25' => 'en-US',  // <~~~~~~~~~~~~~~~ THIS ONE

Issue tags:+Novice

tagging Novice,

D8 Patch:
- remove #24 duplicate array key

D7 Patch:
- reroll all changes

Thanks.

Status:Needs work» Needs review
StatusFileSize
new4.25 KB
new666 bytes
PASSED: [[SimpleTest]]: [MySQL] 37,259 pass(es).
[ View ]

If we revert 7d41f69046999a2e0b90b24c1a24ecc621a978bd, the second patch will apply. First patch includes only changes requested by @droplet.

Status:Needs review» Reviewed & tested by the community

Comment #24 explained why we needed it, patch looks good.

Version:8.x-dev» 7.x-dev
Status:Reviewed & tested by the community» Patch (to be ported)

Ok, thanks.

Committed and pushed to 8.x. Back to 7.x.

Status:Patch (to be ported)» Needs review
StatusFileSize
new3.75 KB
PASSED: [[SimpleTest]]: [MySQL] 39,253 pass(es).
[ View ]

D7 backport.

Status:Needs review» Reviewed & tested by the community

5 same changes. Worked.

Status:Reviewed & tested by the community» Fixed

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Issue summary:View changes

add summary