There are major, reproducible problems with the FeedsSyndicationParser, but they different than the problems seen for the FeedsSimplePieParser.
For FeedsSimplePieParser, both HubMed feeds and Science feeds were missing timestamps, and required the patch setting the timestamp to the current time in order for them to be displayed. The correct data was stored in the feeds_data_syndication table when the timestamp was 0, but it did not display.
For FeedsSyndicationParser these two feed sources behave differently: HubMed feeds have timestamps, and display without needing a patch. However, Science feeds also have timestamps, but do not display. The correct feed node is created with the correct tite, there is no data stored in the feeds_data_syndication table.
This was consistent for two HubMed feeds (nodes 6 and 8) and two Science feeds (nodes 7 and 9)
The associated URLs used are: shown in the table below.
These results were seen with a completely virgin Managing News 1.0beta5, with Feeds alpha5
NID Timestamp URL
6 1257243592 http://www.hubmed.org/feeds/rss.cgi?q=cytoskeleton%20regulation
7 1257244177 http://www.sciencemag.org/rss/current.xml
8 1257244764 http://www.hubmed.org/feeds/rss.cgi?q=cancer%20regulation
9 1257244976 http://www.sciencemag.org/rss/twis.xml
Comments
Comment #1
velosol commentedI've come across similar behavior (feed nodes created, no feeds_data_syndication items created, even on forced import) in trying to get the common_syndication_parser to work with custom XML. Pseudo-debugging (first code block) pointed to simplexml_load_string() failing and upon investigation (second code block) found that my XML was not coming in completely (died around 30KB) and SimpleXML was complaining that it was missing close tags. I've gotten it to work by reducing the size of my XML file, but it's certainly not a long-term solution. I also checked it with both cURL and drupal_http_request(), PHP mem limit 128MB, exec_limit 180.
I understand that the two feeds you mention are similar in size, but this might be an area to investigate as a possible cause.
Comment #2
mcaudy commented@alex_b: please advise as to how to proceed.
@velosol: thanks for your comments and suggestions. I have taken a different approach:
When I use the FeedsSyndicationParser with the RSS feed from the journal Science, I get:
"HTTP - 500 Internal Server Error
The page you are attempting to load returned an error."
So, I looked in the Apache error_log file and found:
[Thu Nov 05 03:12:43 2009] [error] [client ::1] PHP Fatal error: Cannot use object of type stdClass as array in /Library/WebServer/Documents/managingnews10b5v5/profiles/managingnews/modules/contrib/feeds/libraries/common_syndication_parser.inc on line 276, referer: http://localhost/managingnews10b5v5/node/add/feed
This error occurs at line 276 in the RDF parsing section,
275 // Special handling for the title:
276 $item['title'] = _parser_common_syndication_title($item['title'], $item['description']);
and is apparently due to the code trying to access the the $item object properties using array syntax
Also, googling for this PHP error gave several results that suggested that the problem can be corrected by changing from the array accessor syntax " [ ] ", to object accessor syntax: " -> ",
So, line 276 would become:
276 $item->title = _parser_common_syndication_title($item->title, $item->description);
When I tried this, it worked, but this just kept correcting the immediate line of code, and the same error:
PHP Fatal error: Cannot use object of type stdClass as array
would then show up in a subsequent line of code.
When all of these errors were corrected in the FeedsSyndicationParser file, a proper $parse_source was created for the RDF feed content, but this did not solve the problem, as the same error:
PHP Fatal error: Cannot use object of type stdClass as array
then showed up in the FeedsDataProcessor.inc file at line 22:
When this was corrected, the same error
PHP Fatal error: Cannot use object of type stdClass as array
then showed up in the FeedsParser.inc file on line 79
In addition, it was observed that these changes broke parsing for Nature articles, which had been parsing correctly before.
Note: I did see one claim when I googled for "PHP Fatal error: Cannot use object of type stdClass as array" that this is due to a bug in PHP, which has been fixed in a recent nightly build. However, it is not clear if this person knew what they were talking about, and I don't want to go this direction without more info.
alex_b: please advise as to how to proceed.
Comment #3
mathieu commentedSubscribe.
Comment #4
strr commentedCannot use object of type stdClass as array in feeds/libraries/common_syndication_parser.inc on line 276
I got tons of this error.
Any news on that issue?
Comment #5
mrosas commentedsubscribe
Comment #6
alex_b commentedSome of the format errors occurring on mappings are being addressed by #624088-30: Mapper: ImageField/FileField (formalize feed elements)
Comment #7
alarcombe commentedThe 'Cannot use object of type stdClass as array' seem to be occurring because you have functions such as _parser_common_syndication_RDF10_item returning an object, but these objects are being referred to as arrays in the calling functions. eg in common_syndication_parser.inc line 263 assigns $item to be the return from a call to _parser_common_syndication_RDF10_item(), which is an object.
On line 276 and continuing throughout the rest of the function $item is being treated as an array, eg
$item['title'] = _parser_common_syndication_title($item['title'], $item['description']);
This seems badly b0rked - however it's my first time with this module - anyone have any further comments as to whether this is by design and what the best fix would be? Should they be objects or arrays? Will any decision break anything else?
Comment #8
velosol commentedJust a quick note re: #7 - SimpleXML is convoluted in it's use of objects and arrays as shown below. WRT what you wrote, I wouldn't be surprised if that is (part of) the problem. In fixing it just be aware of the gotchas as below.
If you had a node like:
$parent = simplexml_load_string($raw, NULL);To access 'some value' you'd use
$thisIsSomevalue = $parent->firstChild. To access 'best' you'd useFor 'someAttrib' you'd use
$thisIsSomeAttrib = $parent['attrib'];HTH.
Comment #9
bureado commentedI'm also getting errors such as:
Fatal error: Cannot use object of type stdClass as array in /srv/www/drupal/modules/feeds/libraries/common_syndication_parser.inc on line 276
when parsing feeds such as:
http://rss.gmane.org/gmane.linux.distributions.equinux.general
I assume all Gmane RSS feeds will fail using Feeds. Other feeds such as:
http://wiki.debian.org/RecentChanges?action=rss_rc&unique=1&ddiffs=1
fail with the same message. I'm using latest Drupal and Feeds modules.
Comment #10
bshelden commentedI've run into this bug myself and I have a little more information.
I run into it when running on ubuntu 9.10 i386, but not on amd64. Same version of php (5.2.10.dfsg.1-2ubuntu6.4).
It's literally the same error
An error occurred. /ncceh/batch?id=10&op=do <br /> <b>Fatal error</b>: Cannot use object of type stdClass as array in <b>/var/www/ncceh/sites/all/modules/feeds/libraries/common_syndication_parser.inc</b> on line <b>276</b><br />(That's how it appears when I add a new feed)
Also occurs when I manually compile apache (v2.2.14) and php (v5.2.13) on i386.
Comment #11
bshelden commentedOk, a few code tweaks and it's working now:
I have absolutely no idea why this runs on my amd64 box and not on i386...
Comment #12
anarcat commentedHey, would you look at that, a patch here! ;)
Please format the patch appropriately and change the issue status next time.
Comment #13
dave reidNot critical.
Comment #14
twistor commentedThis is an incredibly old issue. I just tested the science feed in question and it worked fine.
If someone still has a problem, please create a new issue.