PDA

View Full Version : Modx Issue


tazzydemon
11-11-2009, 10:12 AM
Dear All

I have been to integrate modx (v0.9.6) with Quercus. There have been a few issues including the isset($_SESSION['variable']) bug

I have uncovered another wierd one though. When logging into the manager it fails with the following error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'bitstream_skinspec``' at line 1 [mysql_select_db]

I speny a while trying to figure this one out and then noticed the double backticks in the db name above. This is the definition in config.inc.php which is written by modx during install

$dbase = '`bitstream_skinspec`';

And the simple code that fails on L23 of login.processor.php:

mysql_select_db($dbase);

For some reason the backticks are currupting quercus and even being moved. Such backticks are common in mysql table definitions and are certainly part of the modx core. It would be nice to see this remedied and have them treated as just parentheses.

Please refer to http://dev.mysql.com/doc/refman/5.0/en/identifiers.html
and
http://stackoverflow.com/questions/261455/using-backticks-around-field-names

Its a pain in the proverbial I know, but it should be fixed for mysql.

Julian

emil
11-11-2009, 07:31 PM
Hi Julian,

I've fixed the issue for Resin/Quercus version 4.0.2, which should be available within a week or so.

What's actually happening is that modx is selecting a database in a way that even php doesn't allow, but php doesn't complain about it. You can see in manager/index.php that modx actually strips out the backticks when it uses a database. The login.connection.php call to mysql_select_db fails for both Quercus and the C implementation of php. The "fix" is for Quercus to stop issuing a warning.

Emil

tazzydemon
11-12-2009, 09:34 AM
Dear Emil,

Thanks for the reply. You appear to be familiar with Modx but I cannot see where the quotes are stripped out in index.php. The quote stripping happens before the database config is loaded.

Perhaps you would be kind enough to tell me what's wrong with the way the database is called (other than it not being java style!). I am not knowledgeable enough in this area..

Julian