Details:
--------
Hosting provider: gigahost.dk
Domain: schmidt-petersen.dk
OS: Debian Linux 5.0
Webserver: Apache 2
PHP:
Version: 5.3
register_globals: off
safe_mode: off
Database:
Type: MySQL
Version: 5.0
Drupal:
Old version: 6.2
Modules:
adsense
advanced_blog
backup_migrate
captcha
ckeditor
diggthis
google_analytics
html2book
htmltidy
image
quotes
recaptcha
recipe
shift_scheduler-6-x-2-0
Themes:
evening
flexible
iui
ocadia
painted
purple_beauty
rootcandy
sharepoint-like
spreadfirefox
New version: 7.0
Modules:
Themes:
Path: www.schmidt-petersen.dk
Language: EN, DA
After upgrading from Drupal 6.20 to 7.0 I receive the following error on every page:
Fatal error: Cannot access empty property in modules/field/field.attach.inc on line 317
For some reason the template are not loading and I am not able to run cron.
When I check the logfile the following 3 errors appears constantly:
Message Notice: Undefined index: in _field_invoke_multiple() (line 300 of modules/field/field.attach.inc).
Message Notice: Undefined index: field_name in _field_invoke_multiple() (line 299 of modules/field/field.attach.inc).
Message Notice: Undefined index: field_id in _field_invoke_multiple() (line 298 of modules/field/field.attach.inc).
During the upgrade all extra modules and themes was disabled and the whole /sites/all folder was deleted so that the previous modules could not damage anything.
I've tried deleting the whole installation, flushing the database and even deleted the database and installed again from scratch. When I install a clean version it works like a charm.
I then tried deleting the whole installation, deleting the database, installing 6.20, importing backup from backup_migrate-module, removing backup_migrate-module and upgrade to 7.0. Now the issue comes again.
I even tried upgrading from PHP 5.2 to PHP 5.3 but this didn't resolve the issue either.
What can cause an issue like this? And how do I resolve it?
| Comment | File | Size | Author |
|---|---|---|---|
| #29 | entity_extract_ids.txt | 1.27 KB | yched |
| #23 | field_attach_debug-1028230-23.patch | 1.6 KB | yched |
| #9 | field_attach_debug.patch | 869 bytes | yched |
| #11 | field_debug_info.txt | 22.71 KB | nils.destoop |
| #10 | field_debug_info.txt | 51.04 KB | jonaswouters |
Comments
Comment #1
mollerz commentedI tried to run a complete test from http://schmidt-petersen.dk/admin/config/development/testing/ but the result was:
An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging information follows. Path: /batch?id=4&op=do StatusText: OK ResponseText: Additional uncaught exception thrown while handling exception.OriginalPDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'rudbeck_schmidt-petersen.simpletest866289semaphore' doesn't exist: SELECT expire, value FROM {semaphore} WHERE name = :name; Array ( [:name] => locale_cache_da ) in lock_may_be_available() (line 165 of /home/www/schmidt-petersen.dk/includes/lock.inc).AdditionalPDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'rudbeck_schmidt-petersen.simpletest866289watchdog' doesn't exist: INSERT INTO {watchdog} (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => php [:db_insert_placeholder_2] => %type: !message in %function (line %line of %file). [:db_insert_placeholder_3] => a:6:{s:5:"%type";s:12:"PDOException";s:8:"!message";s:243:"SQLSTATE[42S02]: Base table or view not found: 1146 Table 'rudbeck_schmidt-petersen.simpletest866289semaphore' doesn't exist: SELECT expire, value FROM {semaphore} WHERE name = :name; Array ( [:name] => locale_cache_da ) ";s:9:"%function";s:23:"lock_may_be_available()";s:5:"%file";s:47:"/home/www/schmidt-petersen.dk/includes/lock.inc";s:5:"%line";i:165;s:14:"severity_level";i:3;} [:db_insert_placeholder_4] => 3 [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => http://schmidt-petersen.dk/batch?id=4&op=do [:db_insert_placeholder_7] => http://schmidt-petersen.dk/batch?op=start&id=4 [:db_insert_placeholder_8] => 87.50.21.66 [:db_insert_placeholder_9] => 1295124642 ) in dblog_watchdog() (line 155 of /home/www/schmidt-petersen.dk/modules/dblog/dblog.module).Uncaught exception thrown in shutdown function.PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'rudbeck_schmidt-petersen.simpletest866289semaphore' doesn't exist: DELETE FROM {semaphore} WHERE (value = :db_condition_placeholder_0) ; Array ( [:db_condition_placeholder_0] => 7437997384d3208a3c518a8.03165683 ) in lock_release_all() (line 247 of /home/www/schmidt-petersen.dk/includes/lock.inc).Uncaught exception thrown in session handler.PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'rudbeck_schmidt-petersen.simpletest866289sessions' doesn't exist: SELECT 1 AS expression FROM {sessions} sessions WHERE ( (sid = :db_condition_placeholder_0) AND (ssid = :db_condition_placeholder_1) ) FOR UPDATE; Array ( [:db_condition_placeholder_0] => 9b536f198bea06fc9bfb34a14db8583f [:db_condition_placeholder_1] => ) in _drupal_session_write() (line 204 of /home/www/schmidt-petersen.dk/includes/session.inc).
Output from the resultpage is:
Results
0 passes, 1 fail, and 1 exception
Hide Actions executing in a potentially infinite loopTests actions executing in a loop, and makes sure they abort properly.
0 passes, 1 fail, and 1 exception
Message Group Filename Line Function Status
Message Group Filename Line Function Status
The test did not complete due to a fatal error. Completion check actions.test 86 ActionLoopTestCase->testActionLoop()
Trying to get property of non-object Notice session.inc 176 _drupal_session_write()
*EDIT*
Please note that the site is in maintenance-mode while I'm troubleshooting.
Comment #2
mollerz commentedI can't imagine that nobody has any qualified help.
Please! :-)
Changed the status from normal to critical as described in the handbook since the upgrade to Drupal 7 has rendered my system unusable.
Comment #3
vm commentedComment #4
droplet commented1. set to garland before update
2. Fatal error: Cannot access empty property in modules/field/field.attach.inc on line 317 isn't error isn't a critical error, unless you sure you have lost data.
3. Undefined index, it's can be normal issues, never broken your daily usage
#2: #1015042: Simpletest tables are not created
Needs more info.. like fresh D6.20 to fresh D7, to see if same problem.. so we can know that come from modules or core
Comment #5
mollerz commented#3
My Drupalversion is 7.0 - not 7.x-dev;
It was downloaded from http://ftp.drupal.org/files/projects/drupal-7.0.tar.gz which in my opinion makes it a 7.0 and not a 7.x-dev. :-)
Here's a copy/paste from: http://schmidt-petersen.dk/admin/reports/status
Drupal 7.0
OK - Access to update.php - Protected
OK - Configuration file - Protected
Warning - Cron maintenance tasks - Last run 1 week 2 days ago
Cron has not run recently. For more information, see the online handbook entry for configuring cron jobs. You can run cron manually.
To run cron from outside the site, go to http://schmidt-petersen.dk/cron.php?cron_key=kFFHCMceZ2dDm4rSGKHtR-maSkA...
OK - Database system - MySQL, MariaDB, or equivalent
OK - Database system versio -n 5.0.32-Debian_7etch12-log
OK - Database updates - Up to date
Warning - Drupal core update status - No update data available
No update information available. Run cron or check manually.
OK - File system - Writable (private download method)
OK - GD library PNG support - bundled (2.0.34 compatible)
OK - GD library rotate and desaturate effects - bundled (2.0.34 compatible)
OK - Node Access Permissions - Disabled
If the site is experiencing problems with permissions to content, you may have to rebuild the permissions cache. Rebuilding will remove all privileges to content and replace them with permissions based on the current modules and settings. Rebuilding may take some time if there is a lot of content or complex permission settings. After rebuilding has completed, content will automatically use the new permissions. Rebuild permissions
OK - PHP - 5.3.0 (more information)
OK - PHP DOMDocument class - Enabled
OK - PHP extensions - Enabled
OK - PHP memory limit - 128M
OK - PHP open_basedir restriction - Disabled
OK - PHP register globals - Disabled
OK - Unicode library - PHP Mbstring Extension
OK - Update notifications - Enabled
Info - Upload progress - Not enabled
Your server is capable of displaying file upload progress, but does not have the required libraries. It is recommended to install the PECL uploadprogress library (preferred) or to install APC.
OK - Web server - Apache/2.2.3 (Debian)
OK - cURL - Enabled
OK - hash - Enabled
#4
1. I disabled all extra themes and set the theme to Garland before upgrading.
2. I've not lost data but my site is unusable when the themes are not working, cronjobs cannot be executed and the site is failing to function.
3. Tried installing a fresh 6.20 on another domain at the same webhost, made two pages with an Lorem Ipsum-text and upgraded to 7.0. The upgrade went flawless but when I try to access the Administration-menu I receive the following error:
Administration - Primary tabs - Tasks(active tab)Index. -
•Notice: Undefined property: stdClass::$content in include() (line 10 of /home/www/fuckd.dk/themes/garland/block.tpl.php).
•Notice: Undefined property: stdClass::$content in include() (line 10 of /home/www/fuckd.dk/themes/garland/block.tpl.php).
•Notice: Undefined property: stdClass::$content in include() (line 10 of /home/www/fuckd.dk/themes/garland/block.tpl.php).
•Notice: Undefined property: stdClass::$content in include() (line 10 of /home/www/fuckd.dk/themes/garland/block.tpl.php).
•Notice: Undefined property: stdClass::$content in include() (line 10 of /home/www/fuckd.dk/themes/garland/block.tpl.php).
•Notice: Undefined property: stdClass::$content in include() (line 10 of /home/www/fuckd.dk/themes/garland/block.tpl.php).
I can't really see what I am doing wrong. Could it be a corrupt download or a bad hosting provider or? What am I doing wrong?
Comment #6
droplet commented@mollerz,
bug report should always test against Dev version.
"•Notice: Undefined property: stdClass::$content in include() (line 10 of /home/www/fuckd.dk/themes/garland/block.tpl.php)."
It's error in garland block.tpl.php, which this tpl is not there by default. so I guess there is an old file and old codes inside the file cause the problem.
Comment #7
chx commentedComment #8
mollerz commented#6
I've now tried to upgrade both systems to the latest dev-release but this hasn't resolved the issue. How would you suggest that I continue?
I need my system back online with all the data intact.
Comment #9
yched commentedThis is difficult to track down.
@mollerz and anyone getting similar errors :
- Please apply the debug patch attached below. It will hide (but not fix) the fatal error, and more importantly display some debug information that should help pinning this down.
- Report the output here (might be large, please upload in a .txt file)
[edit : see patch #23 instead]
Comment #10
jonaswouters commentedApplied patch, went to content/media tab and got this error:
Fatal error: Cannot access empty property in /drupal7/modules/field/field.attach.inc on line 725
The original error was:
Fatal error: Cannot access empty property in /drupal7/modules/field/field.attach.inc on line 677
Attached the requested debug info.
You can find me on irc if you want more help.
Comment #11
nils.destoop commentedSame error like #10
Comment #12
berdirDo all of those who are seing this error have media.module installed?
Try to disable it...
Comment #13
jonaswouters commentedYes it is related to the media module. (at least for me)
I'm here via #1015580: Media entities : Cannot access empty property in field.attach.inc line 677
Comment #14
yched commentedThanks folks.
#10 and #11 are both caused by Media module calling Field API with $entities where we cannot extract a bundle. I bumped #1015580: Media entities : Cannot access empty property in field.attach.inc line 677 back to the Media issue queue.
I'd be interested to get the same data from @mollerz, since his case doesn't seem to involve Media module.
Comment #15
yched commentedMore generally, those errors are bound to come back on a regular basis (modules handing ill-formed entities without a bundle to the Field API).
We don't babysit broken code, but as is, those cases trigger cryptic errors in Field API and will flood the core queue while the error lies upstream. Same thing happened in CCK, until we added an explicit check to silently bypass nodes without a 'type'.
Pondering for now :
When those cases happen
- break with a fatal error / an exception, or fail silently ?
- how do we provide meaningful info on the actual source of the error - at least we'd need the entity type, possiby the callstack.
Comment #16
JackLynch commentedI get the exact same errors as the initial poster, after an upgrade from 6.20 to 7.0. I only have Drupal 7.0 core installed, i.e. no contributed modules.
Comment #17
yched commented@JackLynch : then could you follow the instructions in #9 ? Would help us identify the issue. Thanks !
Comment #18
cartagena commentedSubscribing. I'm going to try and follow the #9 instructions...but I've never applied a patch before so we'll see what happens. Thanks
Comment #19
mollerz commentedHi again
I'm sorry that I haven't been able to reply before now. I've been stuck with a lot of work.
Since my installation is a hosted one it was kind of tricky to apply the patch. Eventually I figured it out by using GnuWin32 Patch-2.5.9. I patched the file and reuploaded it but the issue persists. I still get the error: "Fatal error: Cannot access empty property in /home/www/schmidt-petersen.dk/modules/field/field.attach.inc on line 317" and the theme is still messed up.
I've put my site online so you're able to see for yourself.
I don't really know how to paste the debug-log? If you can provide me some information on how to do so I will be happy to provide the information.
Comment #20
mollerz commentedYched: Ready to continue? :-)
Comment #21
yched commented@mollerz : sorry, dropped off my radar.
It's strange that you still get the error. The debug patch in #9 should "hide" it and display debug message at the top of the 'content' area of the page instead.
Can you manually double check in the code the patch got applied correctly ?
Other than that, you can send me the url of the live site through my contact form (along with the url of a page triggering the error) ?
Comment #22
EmpireNM commentedI'm getting the same error as well, after an upgrade from 6 to 7. I hope I applied the patch in #9 correctly, as I do it manually. But I get:
Fatal error: Cannot access empty property in /mysite.com/modules/field/field.multilingual.inc on line 276
Comment #23
yched commentedOK, there are many places where an incoming $entity without a bundle property can break.
We need to catch those earlier on.
@mollerz, EmpireNM, and anyone getting similar errors :
Can you try with the attached debug patch instead ? (if you applied patch #9 previously, you probably want to revert it, but it makes no real difference). This should break with an error message providing information on where the malformed $entity object comes from.
If the error message mentions "entity type: media", then head over to #1015580: Media entities : Cannot access empty property in field.attach.inc line 677.
If the entity type is something else, please report here.
Comment #24
3rdLOF commentedNotice: Undefined index: field_name in field_attach_load() (line 673 of /Users/biss/Sites/drupal7/modules/field/field.attach.inc).
Notice: Undefined index: field_id in field_attach_load() (line 674 of /Users/biss/Sites/drupal7/modules/field/field.attach.inc).
Notice: Undefined index: field_name in field_attach_load() (line 673 of /Users/biss/Sites/drupal7/modules/field/field.attach.inc).
Notice: Undefined index: field_id in field_attach_load() (line 674 of /Users/biss/Sites/drupal7/modules/field/field.attach.inc).
No modules selected.
Notice: Undefined index: field_name in field_attach_load() (line 673 of /Users/biss/Sites/drupal7/modules/field/field.attach.inc).
Notice: Undefined index: field_id in field_attach_load() (line 674 of /Users/biss/Sites/drupal7/modules/field/field.attach.inc).
Notice: Undefined index: field_name in field_attach_load() (line 673 of /Users/biss/Sites/drupal7/modules/field/field.attach.inc).
Notice: Undefined index: field_id in field_attach_load() (line 674 of /Users/biss/Sites/drupal7/modules/field/field.attach.inc).
No modules selected.
Notice: Undefined index: field_name in field_attach_load() (line 673 of /Users/biss/Sites/drupal7/modules/field/field.attach.inc).
Notice: Undefined index: field_id in field_attach_load() (line 674 of /Users/biss/Sites/drupal7/modules/field/field.attach.inc).
Notice: Undefined index: field_name in field_attach_load() (line 673 of /Users/biss/Sites/drupal7/modules/field/field.attach.inc).
Notice: Undefined index: field_id in field_attach_load() (line 674 of /Users/biss/Sites/drupal7/modules/field/field.attach.inc).
Notice: Undefined index: field_name in field_attach_load() (line 673 of /Users/biss/Sites/drupal7/modules/field/field.attach.inc).
Notice: Undefined index: field_id in field_attach_load() (line 674 of /Users/biss/Sites/drupal7/modules/field/field.attach.inc).
Exception: Encountered an entity without a bundle property (entity type: media, callstack: entity_extract_ids, field_attach_load, attachLoad, load, entity_load, media_load, media_save_attached_file, media_file_update, call_user_func_array, module_invoke_all, [...]). in entity_extract_ids() (line 7369 of /Users/biss/Sites/drupal7/includes/common.inc).
Comment #25
yched commented@kannary : thanks. In your case that's dealt with in #1015580: Media entities : Cannot access empty property in field.attach.inc line 677.
I edited the instructions in #23. We're searching whether this happens on other entity types than 'media'.
Comment #26
EmpireNM commentedThanks for the help yched,
Here's the error I got after applying your new patch:
Exception: Encountered an entity without a bundle property (entity type: node, callstack: entity_extract_ids, _field_invoke_multiple, field_attach_prepare_view, node_build_content, node_view, _node_index_node, node_update_index, call_user_func_array, module_invoke, search_cron, [...]). in entity_extract_ids() (line 7300 of /mysite.com/includes/common.inc).
Comment #27
3rdLOF commentedThanks yched
Comment #28
mollerz commentedHi!
During the last couple of hours I've been struggling to apply the patch. I've downloaded 5 or 6 different applications to try to patch the file but no matter which application I use I get an error either that the patch was unsuccesful or that the application shut down unexpectedly.
As a result I've tried to patch the file manually. My logic tells me to look in the includes/common.inc file:
diff --git includes/common.inc includes/common.inc
index ea0a4ae..740fcac 100644
--- includes/common.inc
+++ includes/common.inc
@@ -7352,9 +7352,29 @@
So I've manually added the lines and replaced the function
function entity_extract_ids($entity_type, $entity) {
$info = entity_get_info($entity_type);
// Objects being created might not have id/vid yet.
$id = isset($entity->{$info['entity keys']['id']}) ? $entity->{$info['entity keys']['id']} : NULL;
$vid = ($info['entity keys']['revision'] && isset($entity->{$info['entity keys']['revision']})) ? $entity->{$info['entity keys']['revision']} : NULL;
// If no bundle key provided, then we assume a single bundle, named after the
// entity type.
$bundle = $info['entity keys']['bundle'] ? $entity->{$info['entity keys']['bundle']} : $entity_type;
return array($id, $vid, $bundle);
}
with the function in the patch.
I don't know if that is how it's done?
Anyway. After uploading the new common.inc file I get the following errors:
•Notice: Undefined variable: info in entity_extract_ids() (line 7308 of /home/www/schmidt-petersen.dk/includes/common.inc).
•Notice: Undefined variable: info in entity_extract_ids() (line 7309 of /home/www/schmidt-petersen.dk/includes/common.inc).
•Notice: Undefined variable: info in entity_extract_ids() (line 7312 of /home/www/schmidt-petersen.dk/includes/common.inc).
Fatal error: Unsupported operand types in /home/www/schmidt-petersen.dk/modules/node/node.module on line 1299
Probably I'm just retarted but how do I proceed?
Comment #29
yched commented@mollerz: probably something wrong with the way you edited the function, although I can't spot it in the code you pasted above. Here is the patched version of the function.
@EmpireNM : thanks, will look into this
Comment #30
mollerz commentedHi Yched
This certainly changed a lot!
This is the output on top of the page:
- Nothing changed there.
However the fatal error on the bottom of the page has changed to the following:
I guess this is what you were asking for? :-)
Comment #31
yched commented@mollerz: thanks. So your case is the same as the one reported by @EmpireNM in #26.
The issue here is in fact completely unrelated to Field API - it so happens that Field API is the only part that severely breaks on it.
_node_index_node() tries to manipulate a $node that hasn't loaded properly. In fact, the "Trying to get property of non-object in _node_index_node()" error on line 2624 (which tries to access $node->changed) seems to indicate that the node_load() on the previous line returned FALSE.
Now, what's strange is that the nid that we try to load comes from a direct query on the {node} table in node_update_index(). So the nid should definitely exist.
Debug this is a little tough:
- You guys would need to identify the nid that fails to load correctly, for instance by modifying the beginning of _node_index_node() this way :
- Then we need to find what's wrong with the node(s) - first of all, check if the corresponding records in the {node} table look wrong.
- Then we need to identify what causes the wrongness, and whether _node_index_node() should be bullet proofed against that.
Anyway, bumping this thread out of the Field API queue.
I'll open a separate issue to get the patch in #23 committed, so that Field API fails in a tale-telling way when it is fed with an invalid $entity object.
Comment #32
yched commented#1067750: Let Field API fail in a tale-telling way on invalid $entity
Comment #33
mollerz commented@yched
Thanks a lot. I suddenly feel very close to a solution! :-D
The status now is:
1) I am able to access schmidt-petersen.dk
2) The site loads and the theme loads as well
3) Content loads
4) We get some (for you) useful errors. :-)
To continue on with the errors the following entries is to be found in the admin/reports/event/ (don't be confused about the different domainnames - I got several domains pointing at the same site)
I don't know how much information you need so.. I just copy/paste :-)
By the way - cron is now able to run!! :-D
Comment #34
yched commented@mollerz: the interesting part is the "Failed to load nid 21" message.
Something's wrong with your node 21. Can you take a look at the corresponding record in the 'node' table (using phpMyAdmin or equivalent), and see if you notice something off ?
Comment #35
mollerz commentedNothing jumps right at me.
This is the values of the node:
nid: 21
vid: 21
type: Blog
title: New from a stranger
uid: 1
status: 1
created: 1218575270
changed: 1218575270
comment: 0
promote: 1
moderate: 0
sticky: 0
language: und
tnid: 0
translate: 0
As far as I can tell node 21 looks like any other of the +600 nodes.
Do you think that it would change anything to delete the note completely from the table?
Comment #36
yched commented'Blog' or 'blog' ? If that's capitalized, that doesn't look right.
Also: maybe check the node_revision table ?
Comment #37
mollerz commentedAhh, sorry..
I was not capitalized. The value is 'blog'. :-)
As far as I can see nid 21 is not represented in the node_revision table. Should it be?
*EDIT*
Okay.. I've been troubleshooting and found something rather strange.
The nid 21 is represented in the node-table but it is nowhere else to be found in the database. I've gone through the entire field_data_body and field_data_comment_body tables but there is no trace of the nid.
Would it be safe to just delete nid 21 from the node-table? (I've got an old backup of the database which holds the content of the node).
Comment #38
yched commentedNo correspondig record in the node_revision table is wrong.
Deleting the record for node 21 is probably the best thing to do. It doesn't provide any clue as to what put your db in that state, though.
It would be interesting to check if you have other broken nodes in there :
SELECT * FROM node WHERE nid NOT IN (SELECT nid FROM node_revision)
(in phpMyAdmin)
Comment #39
mollerz commentedThere was no corresponding record in the node_revision table.
I ran the query and it returned nothing else than the nid 21 in the node-table.
Anyway.. I've now deleted the node entirely. After deleting the nid 21 I was chocked to see that the theme still did not load.
I then checked the dblog (admin/reports/dblog) but found no errors, warnings, noticed, etc. NOTHING!
I thought that it might be because that the site had not loaded the theme properly so I went to admin/appearance/settings/garland and hit "Save configuration". This solved the issue and everything seems to be working like a charm now!
I will begin installing my modules one at a time and will report back with the status after the modules has been installed. :-)
*EDIT*
Okay.. I've now tried adding several modules but every single one of them (except the recipes-module) causes errors in several files (including field-, node- and common.inc).
I'll continue on. Eventually I'll copy/paste all my nodes (approx. 700) from this site to a fresh one. That may be the end of this story! :-)
Comment #40
chi commentedI followed the instructions in #23 and get:
Now i have fatal error on every page.
Cannot access empty property in /home/public/modules/field/field.attach.inc on line 317
Comment #41
chi commentedI get other errors form my site on localhost (winXP):
Comment #42
davidsanger commentedNotice: Undefined index: field_name in field_attach_load() (line 673 of /xxxxxxxxx/html/modules/field/field.attach.inc).
Notice: Undefined index: field_id in field_attach_load() (line 674 of /xxxxxxxxx/html/modules/field/field.attach.inc).
Checking the database with phpMyadmin and SELECT * FROM node WHERE nid NOT IN (SELECT nid FROM node_revision) returns no rows, so the database is not corrupt, yet I stil get the error
Now when I go to Content>Media I get
Fatal error: Cannot access empty property in /xxxxxxxxx/html/modules/field/field.attach.inc on line 677
Drupal 7.0 Media Module
Following http://drupal.org/node/1015580 now. seems to be the issue
Comment #43
greta_drupal commentedI got this error after trying to access a node with a comment. I do NOT have Media module installed. And, the error is occurring on a fresh D7 release install, with few contrib modules. Breaks the whole node. Had to rollback the freakin' database to resolve the problem. I previously reported a problem with D7 core comment module (issue pretty much ignored).
Comment #44
yched commented@greta_drupal : please
- apply patch #23 above (or replace the entity_extract_ids() function with the code provided in #29),
- and report the error message you get (the one that starts with "Exception: Encountered an entity without a bundle property...")
Comment #45
Mick Cagney commentedComplete newbie here so please bear with me.
I'm using 1and1 hosting to host my Drupal 7 site. I am trying to enable users to post audio recordings of our general meetings. I installed Media 7.x-1.0-beta3 and Audiofield 7.x-1.0-beta1. I am getting similar errors as above.
When I click on the 'Media' tab of the 'Content' page I get:
Fatal error: Cannot access empty property in /homepages/19/d311504504/htdocs/live/dd/modules/field/field.attach.inc on line 677
clicking the back button gives:
Notice: Undefined index: field_name in field_attach_load() (line 673 of /homepages/19/d311504504/htdocs/live/dd/modules/field/field.attach.inc).
Notice: Undefined index: field_id in field_attach_load() (line 674 of /homepages/19/d311504504/htdocs/live/dd/modules/field/field.attach.inc).
Notice: Undefined index: field_name in field_attach_load() (line 673 of /homepages/19/d311504504/htdocs/live/dd/modules/field/field.attach.inc).
Notice: Undefined index: field_id in field_attach_load() (line 674 of /homepages/19/d311504504/htdocs/live/dd/modules/field/field.attach.inc).
I saw the patch above in post #23 but haven't the slightest clue how to apply it. I saw the page 'http://drupal.org/patch/apply' but don't know how to get a command prompt, is there another way?
thanks...
Comment #46
yched commented@Mick Cagney : you want to read this issue : #1015580: Media entities : Cannot access empty property in field.attach.inc line 677
In short : you need to install the current Media 7.x-1.x-dev, this should be fixed in there.
Comment #47
mstrelan commentedI had the same problem as @greta_drupal in #43 after an upgrade from 5 to 6 to 7.
The comments table looks fine except the language is not set to "und", it is just blank. Deleting all comments allows the node to be displayed again, and I can add a comment (as user 1). Adding a comment as anonymous adds the comment to the database table, but the comment does not appear in the approval queue. The local menu task for Unapproved comments shows the correct comment count (2) but then states "No comments available". There is also a pager with 79 pages. The error log shows Notice: Undefined index: group in _date_views_fields() (line 61 of E:\www\sites\all\modules\date\date_views\includes\date_views_fields.inc). Heading to comment/COMMENT-ID/edit returns 404 not found.
After an hour or two of debugging I found that the anonymous user had a UID of 443 instead of 0. This is quite common when moving databases around. Solution: edit the users table and set the anonymous UID to 0.
Comment #48
yched commentedI got a separate report from markfinney by my contact form, exactly the same as @Chi's #41,
(see #41 for the exact sequence of errors)
This happens during the indexation of contents for the search index, which usually happen on cron, but might randomly happen on regular page views, since cron tasks are automatically triggered from time to time if the server crontabs are not configured.
The error in this case seems to lie in comment_node_update_index() :
For some reason the comment_load_multiple($cids) call fails to load the comments and returns NULL, which the rest of the code doesn't expect, and triggers all the chain of errors reported.
Now, markfinney tells me that the comments had been manually imported in his database from an earlier core version, so I'm not sure we can call a core bug in his case. I'd be interested to know if that was also the case for @Chi ?
Comment #49
yched commented+ we'd really need to get #1028230: Fatal error: Cannot access empty property in field.attach.inc in. This thread is hardly manageable, since people rightfully report the same error for various and completely unrelated underlying bugs.
Comment #50
chi commentedIn my case comments also had been imported from an earlier core version via custom PHP-CLI script.
Comment #51
chi commentedI've fixed it with this code in comment_prepare_thread(). But now after rollbacking I cannot reproduce bug.
Comment #52
yched commentedThanks for the feedback, @Chi. I'm not sure this qualifies as a core bug, then. I guess we'd want to find out exactly what's wrong with your manually edited db that causes comment_load_multiple() to fail, but I'm not sure I can help with that.
I'm not even sure we'd want to make that code snippet stronger when the comment_load_multiple() fails. At least the errors act as a smoke sign that something is wrong in the db, failing silently would just hide the problem.
Then I guess we have covered all cases of "Cannot access empty property in field.attach.inc" reported so far... We still really need #1028230: Fatal error: Cannot access empty property in field.attach.inc so that possible later reports can be easily sorted in separate issues.
Comment #53
Håvard commentedThis is perhaps a silly example, but it fixed my problem with the"Fatal error: Cannot access empty property in modules/field/field.attach.inc on line 317"
I had 3 content types in same display in views, and one field was not in all of the content types. Silly mistake, which took up a lot of time.
Comment #54
yched commented@havard : which version of views are you using ?
Comment #55
Håvard commented@yched, views dev from april 25
Comment #56
yched commented@havard : odd - Views listing nodes of several different types, where some fields are not present on all node types, is definitely a valid case and should work flawlessly. I don't get any "Fatal error: Cannot access empty property in field.attach.inc" when I test such a case.
Comment #57
mcduarte2000 commentedI am also having this error on 7.0, applied the patch refered on the #23 and my errors were:
Notice: Trying to get property of non-object in block_block_view() (line 246 of /home/uranus_root/bestlovepoems.net/modules/block/block.module).
Notice: Trying to get property of non-object in block_block_view() (line 246 of /home/uranus_root/bestlovepoems.net/modules/block/block.module).
Notice: Undefined variable: key in comment_prepare_thread() (line 897 of /home/uranus_root/bestlovepoems.net/modules/comment/comment.module).
Notice: Undefined property: stdClass::$node_type in entity_extract_ids() (line 7286 of /home/uranus_root/bestlovepoems.net/includes/common.inc).
Warning: Cannot modify header information - headers already sent by (output started at /home/uranus_root/bestlovepoems.net/includes/common.inc:2561) in drupal_send_headers() (line 1040 of /home/uranus_root/bestlovepoems.net/includes/bootstrap.inc).
Exception: Encountered an entity without a bundle property (entity type: comment, callstack: entity_extract_ids, _field_invoke_multiple, field_attach_prepare_view, comment_view_multiple, comment_node_update_index, call_user_func_array, module_invoke_all, _node_index_node, node_update_index, call_user_func_array, [...]). in entity_extract_ids() (line 7298 of /home/uranus_root/bestlovepoems.net/includes/common.inc).
Error
The website encountered an unexpected error. Please try again later.
Comment #58
mcduarte2000 commentedIf I apply instead the patch on #9, what I get is:
Notice: Trying to get property of non-object in block_block_view() (line 246 of /home/uranus_root/bestlovepoems.net/modules/block/block.module).
Notice: Trying to get property of non-object in block_block_view() (line 246 of /home/uranus_root/bestlovepoems.net/modules/block/block.module).
Fatal error: Cannot access empty property in /home/uranus_root/bestlovepoems.net/modules/field/field.multilingual.inc on line 276
PS: Is there a way of hidding the message "Fatal error: Cannot access empty property in /home/uranus_root/bestlovepoems.net/modules/field/field.attach.inc on line 317", while the problem is not solved? None of the patches or selecting "Error messages to display=none", hides this erros to my users... :(
Comment #59
yched commented@mcduarte2000 : all similar reports so far happened on sites where the comment table has been manually tampered with (comments manually imported in the db, for instance). See #48 #50 #52. Is that also the case for your site ?
Comment #60
mcduarte2000 commented@yched: No, I upgraded from a previous version of Drupal and I didn't have this error after the upgrade (soon after the 7.0 launch), it appeared recently. Also, I get this error on every page of the site, even on administration pages and pages without any comment...
Comment #61
Håvard commented@yched : One of my content types was a group content type and the field that caused the error was group audience. The error disapeared immediently when I deleted this field.
Comment #62
yched commented@havard : then it's probably something wrong / not bulletproof in og_field_formatter_view().
You should probably report that case in the OG queue.
Comment #63
davidseth commentedFollowing the suggestion in #42 of
returned several nodes which I deleted and the errors went away. Thanks.
Comment #64
mcduarte2000 commentedI just tried that, but I just get "MySQL returned an empty result set (i.e. zero rows).", so its not my problem...
Comment #65
sunComment #66
steinmb commentedHi
Drupal 7.2 upgraded from 6.22.
PHP 5.3.x
I also see thins when I enable "group by" in Views 3.dev. (3 June), trigger a
PHP Fatal error: Cannot access empty property in /drupal-7.2/modules/field/field.attach.inc on line 317. Turning off the Media-module (not uninstalling) changes nothing.SELECT * FROM node WHERE nid NOT IN (SELECT nid FROM node_revision)returns null.Applied patch from #23:
Comment #67
inekew commentedThis did it for me! Thnx, found an obsolete node
Comment #68
catchMoving back to 8.x, we fix bugs in the highest affected version then backport.
Comment #69
glottus commentedsubscribing
Comment #70
smscotten commentedSubscribing. I'm in the same boat as mcduarte2000. I made the change in #51 and that has gotten my site (admin pages, nodes, etc) back but I'd like to get to the bottom of this issue.
Comment #71
yched commentedSo, as a summary : those errors happen when some code somewhere calls Field API on a malformed $entity object (no 'bundle' property). There's nothing Field API can do about the error, the calling code needs to be identified and fixed.
Latest D7-dev (post 7.7) includes #1067750: Let Field API fail in a tale-telling way on invalid $entity, which now dies with an Exception when such error conditions happen.
The exception message includes the type of entity that creates the error. We'd still need #1158322: Add backtrace to all errors to be able to point the erroneous calling code precisely, but at least the entity type can help direct the bug report to the faulty module.
Therefore, putting this thread to rest.
Comment #72
endrus commentedI am sorry for reopening this thread, but I can't find ANY information anywhere online how the error can be resolved. I have upgraded from D6.24 to D7.12 (the same happened when I tried to upgrade from D6.22 to D7.10).
This is what I get on a node that containes one comment:
If a node contains more than one comment, no error is shown, but only one comment is displayed, others are not.
Before upgrading I disabled and uninstalled all non-core modules.
Trying to fix this error, I uninstalled the comment module and installed it back again. But when anonymous comment is posted, the same error occurs again: the page is broken and the abovementioned error is displayed.
Is there anyway how this could be resolved? I would be very grateful for any assistance! Thanks!
Comment #73
xjm#72: I recommend opening a separate issue, with explicit steps to reproduce your issue, starting from "Install Drupal 7.x." If one of the steps to reproduce is to install a contributed module, then the issue should be filed against that module's queue.
Comment #74
togarashi commentedJust want to provide some extra insight into this issue. We experienced a similar problem, but when utilising the search module.
Searches on our site for certain terms were giving the same error messages as seen above.
It turns out the problem is (sort of) to do with comments that were migrated in to D7 from a D6 database.
It turns out the admins of the D6 site which we upgraded to D7 had deleted some users from the user table. In turn, this means there are comments in the comments table that have uids, but there is no corresponding user in the users table as it was deleted in the D6 system.
If you do manually import comments and are getting this error, check that you have got users that correspond to all comments. This is a good sql statement to use to check this:
SELECT * FROM `comment` WHERE uid NOT IN (SELECT uid FROM users)
If you get results, you can just update them to the anon user with this and it fixes the issue:
UPDATE `comment` SET uid = 0 WHERE uid NOT IN (SELECT uid FROM users)
Comment #75
dkeays commentedI ran into this in Drupal seven too, but under different circumstances than the OP. I had created a theme for a new content-type that contained additional fields. Everything worked well until several weeks later I added some simple pages for privacy policies, etc.
The problem was that the preprocess_node function int the Template.php file manipulated fields that didn't exist in all content types. So it worked fine sometimes, but as soon as I did anything else it crashed.
The solution was to qualify the content-type for the fields I was manipulating.
For example:
Comment #76
dalegrebey commented#53
Posted by havard on April 28, 2011 at 2:08pm
Fixed this error for me. I had failed to set a filter to say that I only wanted a specific content type to load that view. When it tried to load other views (that I had created later), that did not have the image field, it broke the site as it could not find that field when trying to load the view.
Thanks.
Comment #77
MartijnB commentedFYI: I was running into this issue with media module installed and found out, after too much debugging, that an update of the media module (to 7.x-2.0-alpha3) added a media browser field to the file type "image". This broke my site in a lot of places. Deleting that field resolved the problem.