1 (edited by whatrevolution 2008-12-17 00:29)

Topic: Integration, common.php is [helping me debug!] my application.

[Edit: scroll down to further posts for a good laugh smile ]

I have a (currently) file-based CMS which really does not like PunBB's common.php and I'm stumped at the result.  Without posting the entire source, here are some errors and the relevant lines:

I bring PunBB in during system setup, either in bootstrap.inc.php or init.inc.php.  In either case, the require_once() occurs while other similar work is being done, no output has generated, and no header has been sent to client.  It looks like this:

/**
 * PunBB.
 */
define('FORUM_ROOT', HONEST_APP.'..'.DS.'..'.DS.'subdomain_html'.DS.'forum'.DS);
require_once(HONEST_APP.'..'.DS.'..'.DS.'subdomain_html'.DS.'forum'.DS.'include'.DS.'common.php');

Then without fail, and consistently regardless of where I bring PunBB in, I get plenty of errors in an otherwise working system:

[Tue Dec 16 22:26:26 2008] [error] [client <snip>] PHP Notice:  Undefined variable: require in <snip>/toolbox/honest/bootstrap.inc.php on line 52

That is $require inside a function, erroneously returning undefined in:

function requireOther($name) {
  $available = array(
    'smarty' => 'smarty'.DS.'libs'.DS.'Smarty.class.php',
  );
  if (!empty($available[$name])) $require = TOOLBOX_PHP.$available[$name];
  if (!is_file($require)) $require = TOOLBOX_PHP.$name.'.inc.php';
  if (!is_file($require)) $require = TOOLBOX_PHP.$name.'.php';
  if (is_file($require)) return require_once($require);
}

Off-hand I see an improvement to make in that function, but ignoring that, it now gets worse; look at this:

[Tue Dec 16 22:26:26 2008] [error] [client <snip>] PHP Notice:  Use of undefined constant breadcrumbs - assumed 'breadcrumbs' in <snip>/toolbox/honest/init.inc.php on line 507

That is a case name inside a switch() being parsed as a constant!

  if (is_array($core->getConf('document','print_order'))) {
    foreach ($core->getConf('document','print_order') as $i => $v) {
      switch ($i) {
        case breadcrumbs:
          $markup->printCrumbs();
          break;
        case account:
          $markup->makeLogin();
          break;
        case motd:
          $markup->printMOTD();
          break;
        case page:
          $markup->printPage($page_data);
          break;
        case index:
          $markup->printIndex();
          break;
      }
    }
  }

I have to assume that somewhere in the trail of files PunBB is including, there is a typo/bug that is thoroughly breaking my order of operations; but I don't know the code well enough to see it yet, and I can't be sure that's accurate.  Any ideas on what the hell is happening here?

Re: Integration, common.php is [helping me debug!] my application.

I'm sorry this is not helping, but you're using 'DS' instead of a dash '/', why?

3 (edited by whatrevolution 2008-12-16 23:42)

Re: Integration, common.php is [helping me debug!] my application.

@Garciat:

A little something I picked up from CakePHP (I'm not using CakePHP in this application, btw):

/**
 * Short directory separator.
 */
define('DS', DIRECTORY_SEPARATOR);

/**
 * Short path separator.
 */
define('PS', PATH_SEPARATOR);

Re: Integration, common.php is [helping me debug!] my application.

Oh, that's embarassing.

error_reporting(E_ALL);

They're soft errors, Notices, in my own code. smile

Re: Integration, common.php is [helping me debug!] my application.

smile

Re: Integration, common.php is [helping me debug!] my application.

Sorry, Garciat, I can't see you smiling at me, it's 404.

404

Re: Integration, common.php is [helping me debug!] my application.

Wait till it's 1337 cool