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.
Hi,
I installed the latest beta release of your module and everything seemed to be fine for a while; then I added a few more fields to my xls export view and got the following error in the logs:
PHP Fatal error: Call to a member function set_display() on a non-object in /var/www/html/drupal-7.4/sites/all/modules/views_data_export/views_data_export.module on line 148, referer: https://www.classicizingchicago.northwestern.edu/batch?op=start&id=263
The Drupal report registers the following:
Notice: Undefined variable: view in views_data_export_view_retrieve() (line 245 of /var/www/html/drupal-7.4/sites/all/modules/views_data_export/views_data_export.module).
The test page I'm working with is at:
http://www.classicizingchicago.northwestern.edu/all-arch/xls
Is this issue caused by data being too long in the fields?
Thanks!
Comment | File | Size | Author |
---|---|---|---|
#14 | change_data_to_blob-1238586-8282021.patch | 1023 bytes | kehan |
#13 | change_data_to_blob-1238586-8282021.patch | 1023 bytes | kehan |
Comments
Comment #1
Web Assistant CreditAttribution: Web Assistant commentedDid you ever resolve this malinica? I'm getting exactly the same thing (version 7.x-3.0-beta5).
It's really random, sometimes it works, sometimes it doesn't.
Comment #2
Web Assistant CreditAttribution: Web Assistant commentedActually, I added more fields and I get this error all the time now. Also, the Reset button on the exposed View filters triggers the Excel export.
Comment #3
malinica CreditAttribution: malinica commentedNope, still have the same issue. If you get it fixed, please let me know. Thanks!
Comment #4
007pig CreditAttribution: 007pig commentedSubscribed.
Comment #5
ravi.kumar CreditAttribution: ravi.kumar commentedsubscribe....
Comment #6
Ben Coleman CreditAttribution: Ben Coleman commentedI appear to get getting the same thing on csv export. When exporting in batch mode, I get:
An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging information follows. Path: /batch?id=150&op=do StatusText: OK ResponseText: Fatal error: Call to a member function set_display() on a non-object in /home/revo/public_html/sites/all/modules/views_data_export/views_data_export.module on line 148
When I get this, I also see this in the logs:
Notice: unserialize() [function.unserialize]: Error at offset 54486 of 54489 bytes in views_data_export_view_retrieve() (line 243 of /home/revo/public_html/sites/all/modules/views_data_export/views_data_export.module).
line 243 is in this code:
The
$view = unserialize($data->data);
line is line 243.I put a dpm($data) before the if statement, and reran the export. I got 2 $data displays, one with a data field 242179 chars long, and one with a data field 54489 chars long. The latter is obviously the one where the unserialize is failing. The last 4 chars (chars 54486 through 54489, as the unserialize error shows the failure at char 54486) are 's:9:"', which is an incomplete 9 character string specification. The data appears to have been truncated.
Lines 147 and 148 (148 is the point of the first failure message) are:
It appears that what is happening is that, since the unserialize fails, views_data_export_view_retrieve returns a non-object (probably null), and therefore the call to set_display fails. The real problem is that the data in the 'data' field of the views_data_export_object_cache table is truncated.
Does that help anyone track this one down?
Comment #7
Ben Coleman CreditAttribution: Ben Coleman commentedI'm beginning to wonder if this is a problem in drupal_write_record (which is used to write the record to views_data_export_object_cache on line 233). I played with this a bit, and found that, for a given field setup, the unserializable data field was always the same length. Changing the number of fields changed the size of the unserializable data field, but for a given setting, it is still the same length.
The truncation *does* always seem to occur in the same field. I dug through the dpm of the view as it was before being written by drupal_write_record (it's shocking how much redundant data there seems to be in it), and found the field where the truncation occurs. The is at
$_view->localization_plugin->view->query->table_queue['taxonomy_term_data_node']['join']->definition['table formula']
in the $_view variable in views_data_export_view_store. On this site, this field appears (from what's on the dpm) to be a SelectQuery_pgsql object (I ran across this while putting together a patch to enable batch-mode export with PostgreSQL).
Could someone else who is running into this problem on a site running MySQL do a similar test, and see if you come up with the same data? I did this by putting a 'dpm($_view)' just before the drupal_write_record in views_data_export_view_store, and a 'dpm($data)' just before the if in views_data_export_view_retrieve. I then run the failing data export in one browser tab, and when it dies, do a 'recent log messages' on another browser tab. The log message page should pick up the dpm messages from the data export. The last dpm message for $data should allow you to see the contents of the data field. You should also see a log message for the unserialize failure.
For comparison purposes, the last couple of lines at the bottom of my sample $data display was
s:10:"left_table";s:4:"node";s:10:"left_field";s:3:"nid";s:5:"field";s:3:"nid";s:4:"type";s:4:"LEFT";s:13:"table formula";O:17:"SelectQuery_pgsql":19:{s:9:"
If someone else can confirm that this is the issue under MySQL, maybe we can narrow down this issue.
Comment #8
Steven Jones CreditAttribution: Steven Jones commentedCan you upgrade to beta6 and see if you can reproduce this issue?
Comment #9
Steven Jones CreditAttribution: Steven Jones commentedSorry, not had a response for a long time.
Comment #10
kehan CreditAttribution: kehan commentedHi,
I am using postgres and I also am getting hit by this issue. I have 3 views using views_data_export, and two of them work fine in batch mode, but the third one fails as above during export.
I also get the message in my watchdog indicating that the unserialize of the data fails. I'm not sure but I think this might be something to do with the fact that the data is stored as text:big (postgres text) or possibly with drupal_write_record as @ben reports above. Looking in the database the data is cut off after 100348 characters, so the unserialize is failing.
Should we be storing this data in a bytea (blob) as you do with the sandbox for the table views_data_export? I will try to investigate ffurther. Reopening and will try to report back.
K
Comment #11
DrColossos CreditAttribution: DrColossos commentedI have the same issue as mentioned above... When I have time, I will look into it and see if I can provide a patch to make it work on a PG backed site
Comment #12
kehan CreditAttribution: kehan commentedI can confirm that the following change fixes the exports for me. I'm dashing off now and don't have time to make a patch.
Comment #13
kehan CreditAttribution: kehan commentedPatch attached with the above fix against current head / 7.x-3.0-beta7
Comment #14
kehan CreditAttribution: kehan commentedThis time with the patch going in the right direction!!!
Comment #15
DrColossos CreditAttribution: DrColossos commentedThis does indeed fix the problem for us. Thank you!
Comment #17
acbramley CreditAttribution: acbramley commentedI was very happy to see that there's been progress on batch exporting in postgres, then went to test it and hit this Fatal error before the batch process started. After applying the #14, my export ran perfectly and I was able to export 2200 users in under a minute. Thanks a lot!
Comment #18
Jibus CreditAttribution: Jibus commented#14 fixed also my problem ! Thanks !
Comment #19
Steven Jones CreditAttribution: Steven Jones commentedVery cool, thanks for the patch, and thanks for the reviews everyone.