Try to write a bride for CMS Made Simple but get an error in Subs-Db-mysql.php

Started by pmw, February 23, 2012, 06:39:47 AM

Previous topic - Next topic

pmw

I try to write a bridge for CMS Made Simple and SMF 2 but I have already problems to include the index.php of SMF2.

include(cms_join_path(dirname(__FILE__), 'smf', 'index.php'))

Leads to a fatal error:

QuoteFatal error: Unsupported operand types in smf/Sources/Subs-Db-mysql.php on line 53

I have compared my code with the bridge for Mambo and SMF 2. But this bridge does quite the same as I do (it uses require() instead of include() but this is not the cause for the fatal error).

Update 1:

If I make the variable "$smcFunc" global in the index.php of SMF 2, this error will be fixed but a few methods later I will get a similar fatal error. There I must declare "$sourcedir" as global and so on. Has anyone an idea what my CMS could make wrong with global variables? Is there a php setting I have to change?


Update 2:

The cause for the problem is that CMS Made Simple is object-oriented. I have create two little php scripts (without any dependency on CMS Made Simple) to reproduce the problem.

This one is working:

<?php
include(dirname(__FILE__) . '/smf/index.php');
?>


But this one will fail:

<?php
class MyClass
{
public function show()
{
include(dirname(__FILE__) . '/smf/index.php');
}
}
$clazz = new MyClass();
$clazz->show();
?>


How can include the index.php of SMF 2 in a method of a class?

Advertisement: