Posted by Ryan Palmer on October 22, 2009 at 7:15pm
Jump to:
| Project: | Send |
| Version: | master |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed (duplicate) |
Issue Summary
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 />
<?php
$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:
<?php
$templates[$hash]->rows[] = $row;
?>Patch attached.
| Attachment | Size |
|---|---|
| send-install-object-array-error-rp.20091022.patch | 907 bytes |
Comments
#1
This patch is contributed by TP1 Internet 360, a Montreal-based Drupal web studio.
#2
Committed this fix today after reviewing http://drupal.org/node/646580, thanks!