Closed (duplicate)
Project:
Send
Version:
master
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Oct 2009 at 19:15 UTC
Updated:
4 Feb 2010 at 01:33 UTC
When updating to HEAD version, I get the following error:
An error occurred. (...)/update.php?id=10&op=do <br /> <b>Fatal error</b>: Cannot use object of type stdClass as array in <b>(...)/sites/all/modules/send/send.install</b> on line <b>530</b><br />
$templates = array();
while ($row = db_fetch_object($res)) {
$format = send_value('template_format', $row->module, $row->nodetype, $row->nid);
// Don't create a bunch of duplicate entries.
$hash = md5($row->body . $format);
if (!isset($templates[$hash])) {
$template = (object) array(
'name' => '',
'status' => 1,
'body' => $row->value,
'format' => $format,
'rows' => array(),
);
$templates[$hash] = $template; // note 1
}
$templates[$hash]['rows'][] = $row; // note 2
At note 1 it's assumed $templates[$hash] is an array of objects, but at note 2 $template['$hash'] is an array of arrays. Note 2, and once more below it, should instead be:
$templates[$hash]->rows[] = $row;
Patch attached.
| Comment | File | Size | Author |
|---|---|---|---|
| send-install-object-array-error-rp.20091022.patch | 907 bytes | Ryan Palmer |
Comments
Comment #1
Ryan Palmer commentedThis patch is contributed by TP1 Internet 360, a Montreal-based Drupal web studio.
Comment #2
jerdavisCommitted this fix today after reviewing http://drupal.org/node/646580, thanks!