Brand new install of Drupal core 7.10 under RedHat, Apache, PHP 5.3.3 and mySQL 5.1.52. Visiting the webroot index.php or install.php I get:

PHP Fatal error: Cannot redeclare render() in /includes/common.inc on line 5757

I tried a kludged by wrapping the function declaration in if (!function_exists('render')) but that causes other issues post-install.

Comments

nod_’s picture

Category: bug » support
Priority: Critical » Normal

Looks like it wasn't a brand new install after all. If this was the case they'd be another release already.

Did you install in a clean directory too ? looks like you have some leftover files around.

Anonymous’s picture

Category: support » bug
Priority: Normal » Critical

do you have other modules installed? i can't reproduce this on a fresh install from current git 7.x, there is definitely only one render function in core.

that php error often points to where the first declaration of the function lives, like this (where i stuck function render() {} in index.php):

Fatal error: Cannot redeclare render() (previously declared in /var/www/drupal7/webroot/index.php:14) in /var/www/drupal7/webroot/includes/common.inc on line 5834

final stab in the dark - can you reproduce this after restarting apache? i've seen this error from APC sometimes, and restart (or clearing the APC cache) fixes it.

catch’s picture

Category: bug » support
Priority: Critical » Normal

Looks like a crosspost.

ChrisValentine’s picture

It was a completely new install in a completely empty folder - so no leftover files and no other modules. I didn't solve the issue - instead I just copied an existing install of the same version and worked from that.

Interesting about the Apache restart though.

And I've certainly not cross posted this elsewhere.

DamianD’s picture

I managed to fix this error by disabling the graphviz-php extension module

marcoka’s picture

this is definitely caused by graphviz php extension. problem is wel some people need it, so disabling is not a solution.
pretty ugly. any solutions (not disabling the gv.so module)
#1408224: Fatal error: Cannot redeclare render() in /var/www/.../includes/common.inc on line 5757

drupal just defines render() and the gv.so does to. great and BOOK -> WSOD

catch’s picture

Title: Cannot redeclare render() in common.inc » render() conflicts with graphviz PHP extension
Version: 7.10 » 8.x-dev
Category: support » bug
Priority: Normal » Major
Issue tags: +Needs backport to D7

Not sure how this can be backported, but that seems like a major oops to me.

marcoka’s picture

drebroff’s picture

Confirm crash (d7.14) with graphviz php extension.

chx’s picture

Priority: Major » Normal

Won't / can't fix for D7, Twig will fix it for D8. I can't even find this extension and I am not happy about supporting every fly-by php extension someone puts on the Internet. I left this open but unless someone has a really really good argument against this then the fault is at graphviz. Every sane PHP extension namespaces. apc_add. hash_hmac. etc.

marcoka’s picture

detailed info
http://www.graphviz.org/
The php extension of graphviz classes: http://www.graphviz.org/pdf/gv.3php.pdf
Its part of the scripting api that comes as an *.so file to load inside the php.ini.

I get that this can not be fixed in D7 because renaming functions is not possible. If D8 uses namespaces great.

It is not only this special extension. Any lib/extension can be problematic if it uses render(). In my opinion its the fault of both graphviz and drupal for just using render() with no namespace. Graphvizs lib even uses more such "common" names like graph().

Solution

I first tried forking the c++ library, but well ... disaster :). I myself then solved the problem with forking the php graphviz pear package and using this lib instead of directly using the .so lib to directly use graphviz api.

http://pear.php.net/package/Image_GraphViz/

chx’s picture

Status: Active » Closed (won't fix)

Well, then this is a won't fix.

marcoka’s picture

Issue summary: View changes
Status: Closed (won't fix) » Active

its just not a good idea to use just such non specific names. there will be more scripts that will do this.
if everybody does that nothing will be compatible...
in d8 there is namespaces right? if so it is fixed there?

fabianx’s picture

Status: Active » Closed (won't fix)

Unfortunately it was not fixed in the D8 cycle as we still support the phptemplate engine.

marcoka’s picture

great...so still hacking