Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
After update to vieuws 7-3.16 started to get this
Warning: Invalid argument supplied for foreach() in views_join->build_join() (line 1548 of ./sites/all/modules/views/includes/handlers.inc).
After deleting the sort natural in the view the problem is gone
Comment | File | Size | Author |
---|---|---|---|
#19 | 2017-05-28_1629.png | 87.26 KB | generalredneck |
#17 | views_natural_sort-fix_left_join_extras_without_tests-2866668-17-D7.patch | 1.79 KB | generalredneck |
#14 | fix_left_join_extras_2866668_14.patch | 0 bytes | artis |
#6 | natural_sort_2.jpg | 138.11 KB | dotline |
#6 | natural_sort_1.jpg | 222.69 KB | dotline |
Comments
Comment #2
Synflag CreditAttribution: Synflag commentedHi,
I can confirm this. It results in duplicate entries (reduce duplicate entries/pure distinct in views database settings wasn´t helping).
When I turn off natural sort the duplicate entries are gone.
Greetings
Lars
Comment #3
generalredneckLooking into this.
Comment #4
generalredneckYall have any idea on how to reproduce this? when are you seeing the notice? what kinda of entities / content are you sorting naturally?
Comment #5
generalredneckalso see if you have the same issues after upgrading to 2.4
Comment #6
dotline CreditAttribution: dotline commentedHey,
Yes i installed the 2.4 and still have the message on the view page.
Sorting on title of a Taxonomy term view has term
See att for pic
Warning: Invalid argument supplied for foreach() in views_join->build_join() (regel 1548 van /data/sites/web/.../www/sites/all/modules/views/includes/handlers.inc).
Warning: Invalid argument supplied for foreach() in views_join->build_join() (regel 1548 van /data/sites/web/.../www/sites/all/modules/views/includes/handlers.inc).
Warning: Invalid argument supplied for foreach() in views_join->build_join() (regel 1548 van /data/sites/web/.../www/sites/all/modules/views/includes/handlers.inc).
Warning: Invalid argument supplied for foreach() in views_join->build_join() (regel 1548 van /data/sites/web/.../www/sites/all/modules/views/includes/handlers.inc).
Comment #7
generalredneck@dotline
can you do me 2 more favors.
Turn on view query in views settings and screenshot or copy and paste the query here.
Next if you wouldn't mind dumping the views_natural_sort table and attaching it as a .txt that would be cool.
Lastly how many languages does the site have? Is the one you are sorting the main site language?
Comment #8
dotline CreditAttribution: dotline commentedLanguage:
Dutch as default
English active
What do you mean en how dumping the views_natural_sort table
query:
SELECT DISTINCT node.nid AS nid, vns_field_data_title_field.content AS vns_field_data_title_field_content, 'node' AS field_data_field_image_node_entity_type, 'node' AS field_data_title_field_node_entity_type, 'node' AS field_data_field_body_node_entity_type, 'node' AS field_data_body_node_entity_type, 'node' AS field_data_field_link_node_entity_type
FROM
{node} node
LEFT JOIN {field_data_field_product} field_data_field_product ON node.nid = field_data_field_product.entity_id AND (field_data_field_product.entity_type = 'node' AND field_data_field_product.deleted = '0')
LEFT JOIN {commerce_product} commerce_product_field_data_field_product ON field_data_field_product.field_product_product_id = commerce_product_field_data_field_product.product_id
LEFT JOIN {field_data_title_field} field_data_title_field ON node.nid = field_data_title_field.entity_id AND (field_data_title_field.entity_type = 'node' AND field_data_title_field.deleted = '0')
LEFT JOIN {views_natural_sort} vns_field_data_title_field ON field_data_title_field.entity_id = vns_field_data_title_field.eid
WHERE (( (node.status = 1 OR (node.uid = 1 AND 1 <> 0 AND 1 = 1) OR 1 = 1) AND (node.nid IN (SELECT tn.nid AS nid
FROM
{taxonomy_index} tn
WHERE ( (tn.tid = '10') ))) )AND(( (node.type IN ('page', 'licenses_file', 'licenses_role')) )))
ORDER BY vns_field_data_title_field_content ASC
Comment #9
rachelp CreditAttribution: rachelp commentedI have the views natural sort module enabled and also receive this error when my search query is two or more words long and one of the words is less than 3 characters long. For example, I get the error when I search "if only" but no error with "this works"
Comment #10
generalredneckeither show the output of SELECT * from views_natural_sort
Or do a SQL dump of that table
Comment #11
Ryan Osītis CreditAttribution: Ryan Osītis as a volunteer commentedThe issue is due to a fix that was released in the latest version of Views, as discussed here:
https://www.drupal.org/node/1930288
A number of modules, including this one, are experiencing problems due to the change.
https://www.drupal.org/node/2866370
Comment #12
Ryan Osītis CreditAttribution: Ryan Osītis commentedComment #13
artis CreditAttribution: artis at Texas Creative commentedThis issue is being cause by the $extra parameter on the views sort handler for text fields being a string instead of an array.
Replace the 'extra' parameter on lines 34-36 in /handers/views_natural_sort_handler_sort_text_field.inc with:
Patch will follow.
Comment #14
artis CreditAttribution: artis at Texas Creative commentedChanged the Title to be more descriptive of problem.
Attached is patch on 7.x-2.x
Comment #16
generalredneck@artis,
Your patch is 0 bytes. Seems you uploaded an empty file.
Comment #17
generalredneckRolled the patch that was left in #13. Somehow it works without all the mumbo jumbo about having to worry about the VNS alias and what not... Views has gotten smarter over time adding joins it seems. What I would love to see here are tests.
Comment #18
generalredneckBah forgot the Needs Review status.
Comment #19
generalredneckSo I went through and started to make tests. The challenge I'm facing is that for some reason the views_natural_sort handler isn't being applied... but only during the tests. I feel strongly that this is a caching thing... but I can't figure it out thus far. Via my debugging... I've found out that
views_natural_sort_text_field_get_configured_fields()
andviews_natrual_sort_text_get_potential_fields()
are both working in finding the field, but it seems that the hook over in views_natural_sort_text_field.views.inc doesn't seem to be called during tests. Runningdrush en views_natural_sort_text_field_test views_ui; drush eval "views_natural_sort_text_field_test_views_create_test_content();"
and then navigating to admin/structure/views/view/views_natural_sort_text_field_test/edit shows everything sorting correctly.I'll add a seperate issue fixes tests, but rest assure that this is something in the works. You can see this over at http://cgit.drupalcode.org/views_natural_sort/log/?h=7.x-2.x-text_field_...
Comment #21
generalredneckGonna mark this one as fixed and get a new release out so that other people don't have so many problems.
Comment #22
artis CreditAttribution: artis at Texas Creative commentedWell, that's embarrassing (the empty file), but thanks for taking this and running with it.