Community Documentation

Possible Cause: Duplicated PHP in block or node body

Last updated November 12, 2009. Created by forestmonster on November 12, 2009.
Log in to edit this page.

Possible Cause: Duplicated PHP in block or node body
In this case, PHP code may have been inserted into the body of a block, or is contained in a node's "body" field. This code declares the function in question more than once, producing the conflict. For example,

Fatal error: Cannot redeclare getnodecount() (previously declared in /var/www/sites/site.org/htdocs/includes/common.inc(1685) : eval()'d code:3) in /var/www/sites/site.org/htdocs/includes/common.inc(1685) : eval()'d code on line 9

Fix:
You can search your node_revisions table for the node IDs containing the offending code with something like:

SELECT nid
FROM node_revisions
WHERE body LIKE '%getnodecount%';

Then examine those nodes through Drupal's administrative interface, ensuring that each function is declared in only one place.

Page status

No known problems

Log in to edit this page

About this page

Drupal version
Drupal 4.5.x or older, Drupal 4.6.x, Drupal 4.7.x, Drupal 5.x, Drupal 6.x, Drupal 7.x
Audience
Developers and coders, Site administrators

Reference

Drupal’s online documentation is © 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.
nobody click here