"Cannot access empty property" causes cron failure

Created on 8 August 2009, over 15 years ago
Updated 4 September 2023, over 1 year ago

Running cron had been failing for 24 hours with a time limit exceeded message displayed in watchdog. Running cron from the command line resulted in this error message: (more or less, forgot to grab a copy)

Fatal error: Cannot access empty property in /www/home/public_html/default/modules/feedapi_mapper/mappers/feedapi_mapper_date.inc on line 117

Examining mappers/feedapi_mapper_date.inc line 116-118 reads:

  if (!isset($node->{$field_name})) {
    $node->$field_name = array($date->value);
  }

I believe it should be:

  if (!isset($node->{$field_name})) {
    $node->field_name = array($date->value);
  }

(eliminating the $ before field_name on line 117)

I believe it has been this line of code causing my cron run to fail routinely on perhaps badly formatted RSS entries, but instead of handling the error the entire cron run fails. In the past I would manually update every RSS feed until I got past the offending entry.

Making the change above allowed my cron to complete for the first time in 24 hours so I'm quite confident this little $ has been the cause of my consistently broken website. *crosses fingers*

Since I have had this problem many times I am curious if others have experienced it. I do believe the code structure used worked in PHP4, but is no longer workable with PHP5.

🐛 Bug report
Status

Closed: outdated

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    I am closing this issue because is for a branch that is now not supported. Only branches compatible with Drupal 7, Drupal 9, or Drupal 10 are now supported.

Production build 0.71.5 2024