{"issue":{"state":"open","created_at":"2011-11-29T21:11:42Z","updated_at":"2011-11-29T21:11:45Z","user":{"gravatar_id":"9994df352157ae1b778b792744bdbf05","id":1073273,"url":"https://api.github.com/users/aschempp","avatar_url":"https://secure.gravatar.com/avatar/9994df352157ae1b778b792744bdbf05?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"aschempp"},"comments":3,"body":"In Revision 641 (branches/contao-2.10), you changed the `combiner()` function to use reverse sorting. However, this will result in non-working palette names when having an even number of selectors. Unfortunately, there is no description or reference to a ticket why you changed that. Here is an example (from Isotope eCommerce):\n\n```\n'__selector__' => array('type', 'variant_option'),\n```\n\nOld result:\n\n```\nArray\n(\n    [0] => \n    [1] => variant_option\n    [2] => imageselectvariant_option\n    [3] => imageselect\n)\n```\n\nNew result:\n\n```\nArray\n(\n    [0] => imageselect\n    [1] => imageselectvariant_option\n    [2] => variant_option\n)\n```\n\nAs you can see, the new result will match `imageselect` (field \"type\") before matching `imageselectvariant_option` (type + checkbox name).\n\nI googled for another approach to combining, and found the following site: http://docstore.mik.ua/orelly/webprog/pcook/ch04_25.htm\nUsing the example as guidance, I came up with this:\n\n```\nprotected function combiner($names)\n{\n\t// initialize by adding the empty set\n\t$return = array(array());\n\t\n\tforeach ($names as $element)\n\t{\n\t\tforeach ($return as $combination)\n\t\t{\n\t\t\tarray_push($return, array_merge($combination, array($element)));\n\t\t}\n\t}\n\t\n\t$return = array_reverse($return);\n\t$return = array_map('implode', $return);\n\n\treturn array_filter($return);\n}\n```\n\nThe function will return:\n\n```\nArray\n(\n    [0] => imageselectvariant_option\n    [1] => variant_option\n    [2] => imageselect\n)\n```\n\nRegarding Ticket #189, according to the mentioned site (and my knowledge), PHP keeps an internal copy of an array when using foreach, therefore altering the array will not affect foreach.\n\nRelated issues: #189\n\n--- _Originally created on July 11th, 2011, at 03:11pm (ID 3253)_","assignee":{"gravatar_id":"87d2e5aefadcb310f9155df28c2b3582","id":1192057,"url":"https://api.github.com/users/leofeyer","avatar_url":"https://secure.gravatar.com/avatar/87d2e5aefadcb310f9155df28c2b3582?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"leofeyer"},"number":3253,"id":2393163,"labels":[{"name":"backend","color":"e6e6e6","url":"https://api.github.com/repos/contao/import/labels/backend"},{"name":"Defect","color":"bd2c00","url":"https://api.github.com/repos/contao/import/labels/Defect"}],"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"title":"Issue in DataContainer::combiner() since Rev.641","closed_at":null,"html_url":"https://github.com/contao/import/issues/3253","url":"https://api.github.com/repos/contao/import/issues/3253","milestone":{"state":"open","created_at":"2011-11-29T15:29:54Z","closed_issues":199,"due_on":null,"creator":{"gravatar_id":"87d2e5aefadcb310f9155df28c2b3582","id":1192057,"url":"https://api.github.com/users/leofeyer","avatar_url":"https://secure.gravatar.com/avatar/87d2e5aefadcb310f9155df28c2b3582?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"leofeyer"},"number":32,"title":"2.10.0","description":"Contao 2.10.0 (minor release)","url":"https://api.github.com/repos/contao/import/milestones/32","open_issues":1}},"action":"created","comment":{"created_at":"2011-11-29T21:11:45Z","updated_at":"2011-11-29T21:11:45Z","user":{"gravatar_id":"87d2e5aefadcb310f9155df28c2b3582","id":1192057,"url":"https://api.github.com/users/leofeyer","avatar_url":"https://secure.gravatar.com/avatar/87d2e5aefadcb310f9155df28c2b3582?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"leofeyer"},"body":"Ach so, die Erklärung für die Änderung: Die bisherige Sortierung hat dafür gesorgt, dass bei einem Benutzer, der nachträglich zum Admin gemacht wurde, weiterhin die Gruppenfelder etc. angezeigt wurden. Es wurde in diesem Fall zuerst das Feld `inherit` berücksichtigt und dann erst das Feld `admin`, obwohl die Reihenfolge im Selector-Array genau anders ist. In der neuen Version wird die Reihenfolge der Selector-Felder im Selector-Array berücksichtigt.\n\n--- _Originally created on July 27th, 2011, at 06:57pm_","id":2948623,"url":"https://api.github.com/repos/contao/import/issues/comments/2948623"}}