LisaList2

Advanced search  

News:

2019.06.07 fixed NChat for the "Curve" theme, will eventually move it to its own page and add it to the default theme as well. Other plugins are next. see post in the Meta board for details

Pages: [1]   Go Down

Author Topic: NChat bug fixed  (Read 10 times)

rayarachelian

  • Administrator
  • Sr. Member
  • *****
  • Karma: +1/-0
  • Offline Offline
  • Posts: 59
  • "But what's puzzling you is the nature of my game"
    • LisaEm
NChat bug fixed
« on: June 07, 2019, 09:09:03 am »

Found the bug that was keeping NChat from working, so basically this is caused by differences between postgres and mysql.at https://github.com/nvcnvn/NChat/blob/4b4e76959d88156370f2b0f13be5374e5c723393/NChat/NChatHandle.php#L140there is a WHERE clauses that looks for an empty value using double quotes:
Code: [Select]
140                         WHERE online_color <> ""',
However postfgres wants single quotes here. Was hard to track this down, had to turn on javascript console and then post a message to NChat and then click on HTTP response which had an HTML error of 'ERROR: zero-length delimited identifier at or near' - when I googled that error, I ran into https://stackoverflow.com/questions/23165282/error-zero-length-delimited-identifier-at-or-near-line-1-delete-from-regwhich mentioned that it should use single not double quotes.
I fixed the code like so:
Code: [Select]
136         if($onlineColor == NULL){
137                 $request = $smcFunc['db_query']('', '
138                         SELECT id_group, online_color
139                         FROM {db_prefix}membergroups
140                         WHERE online_color <> \'\'',
141                         array(
142                         )
143                 );
which allowed it to work.
NChat is only enabled right now on the "Curve" theme on the main page, so if you'd like to play with it you can switch themes from your Profile > Account Settings > Modify Profile > Look and Layout.
I'll enable it for the default profile as well, though perhaps I'll to add Chat to a different page on the main screen rather than to the Home page.
I suspect there are other such database errors that are caused by postgres being treated as a second class citizen. :( though to be fair, I've no idea if single quotes are ok for mysql in that code. The trouble is these database errors aren't always logged to system logs.
In this case the error was sent back to the web browser as the HTML response, but it turns out that it also made it to the SMF Admin Error log. I've seen other cases where an iPad user could not post that wasn't logged to any log, so I've no way to track it down.  :P :o :(
Perhaps I should have installed this with mysql, but it's too late now.

Logged
Fate whispers to the warrior, 'You can not withstand the storm.'  The warrior whispers back, 'I am the storm.'
Pages: [1]   Go Up