Bug with global $TABLE_PREFIX - please confirm

4 posts by 2 authors in: Forums > CMS Builder
Last Post: February 25, 2008   (RSS)

By webdude - February 22, 2008

Hi There,

I just noticed that when I call getListRows($options) from a different scope (eg within a function) that the table prefix doesn't automatically get prepended producing an error like this: List Viewer (news): MySQL Error: Table 'cmsbuilder.news' doesn't exist It should be looking for the table cmsbuilder.cms_news and not cmsbuilder.news

I traced it back to the CMS Builder source code. It looks like CMS Builder wasn't properly setting $TABLE_PREFIX internally. I found a quick solution...

The original line 91 of lib/init.php:
$TABLE_PREFIX =& $SETTINGS['mysql']['tablePrefix'];

FIX by changing line 91 of lib/init.php to this:
$TABLE_PREFIX = $SETTINGS['mysql']['tablePrefix'];

I was hoping to get an official response from support to confirm that this won't break something else. Perhaps the =& in the code wasn't really intentional.

Thanks for the amazing product BTW!

Re: [Dave] Bug with global $TABLE_PREFIX - please confirm

By webdude - February 22, 2008

OK thanks Dave I sent you an email with code to reproduce!

Re: [webdude] Bug with global $TABLE_PREFIX - please confirm

By Dave - February 25, 2008

Thanks for that, I've replied to your email and applied that fix to the next version.

So for anyone else who runs into this. It's fixed in v1.10 (upcoming).
Dave Edis - Senior Developer
interactivetools.com