I have 3-levels taxonomy (country-region-city).
When I select 1 or 2 level - I have empty selectbox (see picture) and following errors:
Location (all errors): http://xn--80adxhks.xn--80adxhks.xn----7sblvlgns.xn--p1ai/hierarchical_s...
Notice: Undefined offset: 2 in _hierarchical_select_hierarchy_validate() (line 1972 of /DATA/home-sites/lib/modules_common/for_all_projects/hierarchical_select/hierarchical_select.module).
Notice: Undefined offset: 2 in _hierarchical_select_hierarchy_validate() (line 1975 of /DATA/home-sites/lib/modules_common/for_all_projects/hierarchical_select/hierarchical_select.module).
Notice: Undefined offset: 3 in _hs_process_render_hs_selects() (line 1168 of /DATA/home-sites/lib/modules_common/for_all_projects/hierarchical_select/hierarchical_select.module).
Warning: Invalid argument supplied for foreach() in _hierarchical_select_options() (line 390 of /DATA/home-sites/lib/modules_common/for_all_projects/hierarchical_select/includes/theme.inc).
It is right after I install 18 november dev.
Comment | File | Size | Author |
---|---|---|---|
#15 | hierarchical_select-multiselect-2382655-15.patch | 636 bytes | stefan.r |
#8 | hierarchical_select-test.patch | 1.67 KB | stefan.r |
screen.png | 1.91 KB | super_romeo |
Comments
Comment #1
super_romeo CreditAttribution: super_romeo commentedMore. It works OK every second select time: Not works, works, not works, works...
Comment #2
stefan.r CreditAttribution: stefan.r commented@super_romeo do you still have this issue in the latest dev version?
Also see #2382287: Hierarchical Select Taxonomy
Comment #3
super_romeo CreditAttribution: super_romeo commentedHi! Thanks for attention.
No changes.
And one more thing.
I have 4 websites with same error (on same LINUX server).
BUT on 2 different local computers (windows) it works fine!
Same DB dump and code.
I'm impressed.
Server:
Linux: gentoo
nginx 1.7.6
php 5.5.18
mysql 5.5.40
Comment #4
super_romeo CreditAttribution: super_romeo commentedCheck it: http://сдай-лом.рф/en/node/add/ads-sell
AND. Now I use "Save term lineage" and if select "Save only the deepest term" all is OK. But I need lineage.
Comment #5
calculus CreditAttribution: calculus commentedKind of same issue here.
In order to fix "update button" problem i tried patch below
#828418-41: Drupal.attachBehaviors() used with an incorrect context?
I just replaced
Drupal.attachBehaviors(Drupal.HierarchicalSelect.context);
with
Drupal.attachBehaviors($('#hierarchical-select-' + hsid + '-wrapper').parents('div.form-item'));
It worked locally (windows) but i had offset notices at a linux server.
I applied the patch to alpha6 and alpha8. Same behavior. Probably there is nothing to do with the security update.
I have not tried with dev version.
Comment #6
super_romeo CreditAttribution: super_romeo commentedThanks, calculus!
1. But, there is no "update button" problem in my case :)
2. I can't find "Drupal.attachBehaviors(Drupal.HierarchicalSelect.context);" string in code...
Comment #7
calculus CreditAttribution: calculus commentedI am not sure how those two problems are connecting... I m guessing its a javascript problem.
I just informed stefan.r that changing the javascript code, leads to the same behavior as yours. Empty boxes, offset notices and "working - not working" behavior.
Btw look at hierarchical_select.js
Comment #8
stefan.r CreditAttribution: stefan.r commented@super_romeo, I see the issue on your site but I cannot reproduce it locally. The string is not in the code because the patch @calculus mentions is already in the dev version. It suggests that patch may cause the issue somehow. Possibly by referring to incorrect HSIDs, which in turn is possibly introduced by the patch committed from this issue: #1349868: Issues when Hierarchecal Select is inside Field Collection.
These are all just wild guesses though, so perhaps you can send me a dump of a stripped down dump of a site with this issue (without any extra modules/themes, ideally just 1 simple content type with this issue and a vocabulary). You can contact me through my user profile. Alternatively I would need a way to reproduce this issue on a fresh drupal install.
Lastly, just to see whether it really is this patch causing the issue, does the odd behavior disappear when you apply the attached patch?
Comment #9
stefan.r CreditAttribution: stefan.r commentedAs to the windows/linux issue, just to see whether the problem might be the PHP version, are you using the same php version on windows (ie 5.5?)
Comment #10
super_romeo CreditAttribution: super_romeo commentedLocal server:
Windows: 8.1
Apache: 2.4
php 5.5
mysql 5.5
I've apply patch on latest dev (5 dec) - no result.
I'll send you access to my website in private massage.
Comment #11
super_romeo CreditAttribution: super_romeo commentedСalculus, thanks!
Comment #12
dode CreditAttribution: dode commentedI have the same problem,
When I change the 'Level choice' option from 'Force the user to choose a term from a deepest level' to 'Allow the user to choose a term from any level' in field 'Widget Type' settings, it's work ok for me without warnings and error.
I miss the 'help-text' which should be underneath the 'update' button.
thaknks,
Martin
Comment #13
stefan.r CreditAttribution: stefan.r commentedComment #14
stefan.r CreditAttribution: stefan.r commentedAs to the windows/linux issue - this seems to be due to different PHP versions.
With PHP 5.3.34 I don't have the issue and with PHP 5.4.34/5.5.18 I do have it.
Comment #15
stefan.r CreditAttribution: stefan.r commentedSo the issue seems to be that after after removing an index from the end of the $selections array using unset() in
_hierarchical_select_hierarchy_validate()
, the next index value will still be what it would have been.Later on we do
$hierarchy->lineage = $selection;
, and in newer versions of PHP the same will apply to $hierarchy->lineage, ie the next index value will be what it would have been in $selection.Ie:
In newer versions of PHP this would give:
We'd need the index for the new element to be 2, not 3. The attached patch should fix this.
Comment #16
stefan.r CreditAttribution: stefan.r commentedComment #19
stefan.r CreditAttribution: stefan.r commentedComment #20
coolman7 CreditAttribution: coolman7 commentedI'm using 7.x-3.0-alpha9 version and PHP 5.5.9-1ubuntu4.5. And I still have problems with multi level taxonomy terms. I can only select first level of terms.
Comment #21
stefan.r CreditAttribution: stefan.r commented@coolman7, that's another issue. You have the same problem with Alpha8?
Comment #22
coolman7 CreditAttribution: coolman7 commentedyes. I had same issue with alpha8.
Comment #23
coolman7 CreditAttribution: coolman7 commentedIs there any solution for this issue? Or is there any open case for that one? So I should post to correct issue.
Comment #25
kristiaanvandeneyndeI just spent somewhere between 2 and 3 hours debugging this and came to the same conclusion as stefan.r in #15: The line
$lineage[] = $first_child;
in_hierarchical_select_hierarchy_enforce_deepest()
causes an index jump every other time it's run.Using
array_values()
is the proper fix here, although it's kind of concerning that the code relies on the order of a numerical index. Especially given how "volatile" these are, q.e.d.