My site uses many views and cck field, and i18n
I've just upgrade from CCK 2-rc10 to CCK 2.0, and it works on my wamp, which has php 5.2.4. Both English and French works.
Then I uploaded to my CentOS 5 server, which has php 5.1.6. English is still fine, but the French site goes blank page, the error is:
PHP Fatal error: Cannot access empty property in sites/all/modules/cck/includes/views/handlers/content_handler_field.inc on line 162,
After some investigation I find that sometimes $this->aliases[$attributes['column']] was empty and that makes $values->{$this->aliases[$attributes['column']]} having PHP fatal error, in PHP 5.1.6.
I've try to debug this and find $this->aliases[$attributes['column']] has a value in many cases, but when it's empty the blank page error occurs. Maybe it's just a single improperly written cck module, but the whole site is down.
I'm not sure if it is a i18n problem or cck problem, but I write a workaround patch. As attached.
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | cck_views_fatal_error-331033-15.patch | 1.04 KB | yched |
| #13 | view.txt | 7.62 KB | spopovits |
| #12 | view-export.php_.txt | 7.23 KB | corneverbruggen |
| #12 | view-debug-info.txt | 4.26 KB | corneverbruggen |
| #11 | 20081109_view_def_working.txt | 1.73 KB | tech4him |
Comments
Comment #1
yched commentedHm - hard for me to tell if this belongs to i18n, Views or CCK.
- Could you export your view and attach it as a text file ?
- also please temporarily add the following lines before the foreach :
Then visit both your english and french page logged in as user 1 and report the messages you get (regular users won't be affected)
Earl, if you're reading this and have suggestions ?
Comment #2
yched commentededit : make that
Thx :-)
Comment #3
yched commentedComment #4
corneverbruggen commentedsubscribing
Comment #5
jaredonline commentedFatal error: Cannot access empty property in /var/www/vhosts/drupal6.bookmanstestbed.com/sites/all/modules/cck/includes/views/handlers/content_handler_field.inc on line 162
I'm getting the same issue and rolled back to rc10.
Subscribing.
Comment #6
yched commented@jaredonline: This doesn't help. As you see in the original post, yang_yi_cn is seeing this in a rather specific case, and he provides detailed information about it.
If you're seing this as well, you need to provide the maximum details as well, so that we can try to spot a pattern.
Besides, I asked for additional information in comments #3 / #4, why not try providing those ?
Just saying 'me too' is meaningless. You need to help us help you, folks.
Comment #7
corneverbruggen commentedI have this problem (that is: the same error message) when using a multilingual taxonomy term as an argument in a view. This was not the case in the last rc.
The view has two arguments. The first is the language (nl, en or de), the second is a taxonomy term. When using this argument in combination with the 'en' or 'de' language, the error occurres. Default language of the site is 'nl'.
Attached an export of the view.
The error also happens when running cron when the search module is enabled, so something goes wrong when indexing content.
Comment #8
yched commentedOK, for all people seeing this - we need the following informations to be able to move on :
- Provide an export of the view that raises the error (thks farbridges)
- Specify whether or not you use i18n module
- Rename the attached file below to 'content_handler_field.inc' and use it to replace the one in the cck/includes/views/handlers/ folder.
Then display your view, and please report the messages that are displayed (be sure to be logged in as user 1, regular users won't see them).
Thanks, we won't be able to fix properly this without your help.
Comment #9
eagereyes commentedI'm getting the same message, but under different conditions: my view shows a list of nodes that are referenced through a CCK nodereference field that I added to the Story type. When the current page has related pages, it works. When it doesn't, I get the error message. I also get the error on pages that are not Story nodes (like Biblio, etc.). I'm not using i18n.
The exported view is attached.
When using yched's content-hander-field.inc on a node without a related field, the problem simply shifts: Cannot access empty property in [...]/sites/all/modules/views/modules/node/views_handler_field_node.inc on line 45
When viewing my frontpage, I get this:
Array ( [vid] => node_vid [type] => node_type )
Array ( [vid] => Array ( [table] => node [field] => vid ) [type] => Array ( [table] => node [field] => type ) )
stdClass Object ( [nid] => 237 [node_vid] => 237 [node_type] => biblio [type] => biblio [build_mode] => 0 )
I can't make it show me the debug information on any other page - I've turned off my block cache and cleared the caches, but I don't see it on any other pages. Any idea how I can get it to show up again?
Comment #10
tech4him commentedAnother report of the same error. Not multilingual in my case. Attached I believe is what you are requesting, the view debug output as well as the view definition. Hope that helps. Thanks for the great work!
No I do not use the i18n module.
Comment #11
tech4him commentedHmmm...updated my View definition and simplified by removing the three fields that were taxonomies and voila, the view is now working with the regular content_handler_field.inc file. Attached is the working view def.
Comment #12
corneverbruggen commentedI am using i18n.
I also have a nodereference field in the view. When I remove it, the error disappears. And - as said - the error only happens when using the taxonomy argument in the view.
Attached the required files. I attached the views export again as well.
Yched, when using the content_handler_field.inc_.debug, the error disappears! (without removing the nodereference field or taxonomy term argument). I guess, this debug code has already some sort of patches in it?
Thanks for all your work.
Comment #13
spopovits commentedThis is my view that does not work with same error. Not using i18n, not using multilanguage.
I have two similar views one works one doesnt. The one that doesnt has empty file_field the one that works has values.
I hope this gives you more information.
I get the same error PHP Fatal error: Cannot access empty property in sites/all/modules/cck/includes/views/handlers/content_handler_field.inc on line 162
my site is http://www.screenprocess.com
Comment #14
spopovits commentedI removed the FileField from the view and the view works. It appears that as long as there were some values in the FileField the view works if not the fatal error occurs.
Comment #15
yched commentedOK, I tried with the example provided by eagereyes in #9 (simplest one), couldn't reproduce at first, and after a little head-scratching, managed to figure it out.
Happens with empty multiple fields, when there is no 'NULL' row for the node in the field's table. content_handler_field_multiple::render() needlessly deferred to content_handler_field::render(), which doesn't find the values it expects.
Fixed this in latest -dev.
Before closing this and rolling a new release, I'd appreciate if the various reporters above confirmed that it does fix their own case.
Attached is the patch I committed, so that people can test without waiting for the -dev tarball to be refreshed.
Obviously, this should be tested with the original content_handler_field.inc file, NOT the debug one I provided in #8 :-)
Comment #16
yang_yi_cn commented#15 fixed the issue for me.
Comment #17
eagereyes commentedWorks for me too, thanks for the quick fix!
Comment #18
spopovits commentedI do not know how to do the patches do I assume that the - in the patch is remove the line and + is to add the line.
I am willing to manually change the code in the file to test if you could just clarify the fix for me.
Comment #19
yched commented@spopovits ; that's it.
The patch just replaces
with
in content_handler_field_multiple.inc
More generally, see http://drupal.org/patch/apply for more informations on how to apply patches.
Comment #20
garbanzito commentedjust reporting that i too observed this same error message upon upgrading to 6.x-2.0; i have so many views it was hard to pin down, so i just applied the patch from #15 and it resolved the error on my site, and i could then see it was probably a view involving a nodereference field
Comment #21
corneverbruggen commentedThe patch solved to problem for me. Perfect!
Thanks!
Comment #22
yched commentedOK, I think we can consider this fixed :-)
Thanks all.
I just released CCK 2.1.