Home | Products | Consulting | Forums | Support | Order | 1-800-752-0455
  Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder:
Bug with global $TABLE_PREFIX - please confirm

 

 


webdude
User

Feb 22, 2008, 1:57 PM

Post #1 of 4 (360 views)
Shortcut
Bug with global $TABLE_PREFIX - please confirm Can't Post

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:

Code
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:

Code
$TABLE_PREFIX =& $SETTINGS['mysql']['tablePrefix'];


FIX by changing line 91 of lib/init.php to this:

Code
$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!


Dave
Staff / Moderator


Feb 22, 2008, 2:15 PM

Post #2 of 4 (358 views)
Shortcut
Re: [webdude] Bug with global $TABLE_PREFIX - please confirm [In reply to] Can't Post

Hi webdude,

Thanks for the heads up on that. Using = instead of =& shouldn't cause any problems.

I can't reproduce this locally. What version of PHP are you using? Would you mind emailing me (at dave@interactivetools.com) the code in question so I could have a look? I'd like to reproduce and fix it for the next version if possible.

Are you using $TABLE_PREFIX directly anywhere else? I thought the "global $TABLE_PREFIX" at the top of getListRows() would have it access the global. It's strange that it's blanking out for you.

Thanks! :)

Dave Edis - Senior Developer
interactivetools.com


webdude
User

Feb 22, 2008, 4:06 PM

Post #3 of 4 (357 views)
Shortcut
Re: [Dave] Bug with global $TABLE_PREFIX - please confirm [In reply to] Can't Post

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


Dave
Staff / Moderator


Feb 25, 2008, 1:41 PM

Post #4 of 4 (338 views)
Shortcut
Re: [webdude] Bug with global $TABLE_PREFIX - please confirm [In reply to] Can't Post

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

 
 
 


Search for (options)
Products
CMS Builder
Article Manager
Realty Manager
Listings Manager
Order Now
Services
Priority Consulting
Support
Online Documentation
Support Forums
Support Homepage
Company Info
12 reasons to choose us!
Meet the team
Monthly newsletter
Contact Us
Toll Free: 1-800-752-0455
Phone: (604) 689-3347
Sales | Support
Conditions of Use | Privacy Policy | Copyright © interactivetools.com 2008
#201 - 2730 Commercial Drive, Vancouver BC Canada V5N 5P4