Limited-Time Donation Special!
Upgrade to Snow for $20 USD and receive a free copy of Oblivion Light ($5 discount).
Upgrade to +Blizzard for $35 USD and receive a free copy of Oblivion Light ($15 discount).

Please visit the thread below for more details.
CLICK HERE

Contact @Davlin with questions or comments.

Jump to content
  • 0
nuceman

IPS 4.3 Strange DB Error from Gallery

Question

I believe this error has been around for some time, well before I upgraded to 4.3, but I see this in the system logs constantly:

The URL of page the error occurred on was https://www.site.com/gallery/image/1544-l-312e8a50fed7cb1c3c55f828cab5fc66/

IPS\Db\Exception::1064

SELECT COUNT(*) FROM `gallery_images` WHERE image_album_id=48 AND image_id<>1544 AND image_= IS NULL
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'IS NULL' at line 1

#0 /home/user/public_html/system/Db/Select.php(378): IPS\_Db->preparedQuery('/*IPS\\gallery\\_...', Array, true)
#1 /home/user/public_html/system/Db/Select.php(440): IPS\Db\_Select->runQuery()
#2 /home/user/public_html/system/Db/Select.php(361): IPS\Db\_Select->rewind()
#3 /home/user/public_html/applications/gallery/sources/Image/Image.php(898): IPS\Db\_Select->first()
#4 /home/user/public_html/applications/gallery/sources/Image/Image.php(1032): IPS\gallery\_Image->fetchNextOrPreviousImages(1, 'ASC')
#5 /home/user/public_html/uploads/template_15_dd7fa6b771626a3f041bfec4dc0472c8_view.php(971): IPS\gallery\_Image->prevItem()
#6 /home/user/public_html/system/Theme/SandboxedTemplate.php(58): IPS\Theme\Cache\class_gallery_front_view->imageFrame(Object(IPS\gallery\Image))
#7 /home/user/public_html/uploads/template_15_dd7fa6b771626a3f041bfec4dc0472c8_view.php(340): IPS\Theme\_SandboxedTemplate->__call('imageFrame', Array)
#8 /home/user/public_html/system/Theme/SandboxedTemplate.php(58): IPS\Theme\Cache\class_gallery_front_view->image(Object(IPS\gallery\Image), '\n<div data-cont...')
#9 /home/user/public_html/applications/gallery/modules/front/gallery/view.php(326): IPS\Theme\_SandboxedTemplate->__call('image', Array)
#10 /home/user/public_html/system/Dispatcher/Controller.php(96): IPS\gallery\modules\front\gallery\_view->manage()
#11 /home/user/public_html/system/Content/Controller.php(50): IPS\Dispatcher\_Controller->execute()
#12 /home/user/public_html/applications/gallery/modules/front/gallery/view.php(61): IPS\Content\_Controller->execute()
#13 /home/user/public_html/system/Dispatcher/Dispatcher.php(146): IPS\gallery\modules\front\gallery\_view->execute()
#14 /home/user/public_html/index.php(13): IPS\_Dispatcher->run()
#15 {main}

The "AND image_= IS NULL" is breaking the query. I'm not entirely sure what's corrupted here. I was able to upgrade to 4.3.5 without issue.

I've cleared the cache and am using the default template unmodified.

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0
39 minutes ago, nuceman said:

I believe this error has been around for some time, well before I upgraded to 4.3, but I see this in the system logs constantly:

The URL of page the error occurred on was https://www.site.com/gallery/image/1544-l-312e8a50fed7cb1c3c55f828cab5fc66/

IPS\Db\Exception::1064

SELECT COUNT(*) FROM `gallery_images` WHERE image_album_id=48 AND image_id<>1544 AND image_= IS NULL
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'IS NULL' at line 1

#0 /home/user/public_html/system/Db/Select.php(378): IPS\_Db->preparedQuery('/*IPS\\gallery\\_...', Array, true)
#1 /home/user/public_html/system/Db/Select.php(440): IPS\Db\_Select->runQuery()
#2 /home/user/public_html/system/Db/Select.php(361): IPS\Db\_Select->rewind()
#3 /home/user/public_html/applications/gallery/sources/Image/Image.php(898): IPS\Db\_Select->first()
#4 /home/user/public_html/applications/gallery/sources/Image/Image.php(1032): IPS\gallery\_Image->fetchNextOrPreviousImages(1, 'ASC')
#5 /home/user/public_html/uploads/template_15_dd7fa6b771626a3f041bfec4dc0472c8_view.php(971): IPS\gallery\_Image->prevItem()
#6 /home/user/public_html/system/Theme/SandboxedTemplate.php(58): IPS\Theme\Cache\class_gallery_front_view->imageFrame(Object(IPS\gallery\Image))
#7 /home/user/public_html/uploads/template_15_dd7fa6b771626a3f041bfec4dc0472c8_view.php(340): IPS\Theme\_SandboxedTemplate->__call('imageFrame', Array)
#8 /home/user/public_html/system/Theme/SandboxedTemplate.php(58): IPS\Theme\Cache\class_gallery_front_view->image(Object(IPS\gallery\Image), '\n<div data-cont...')
#9 /home/user/public_html/applications/gallery/modules/front/gallery/view.php(326): IPS\Theme\_SandboxedTemplate->__call('image', Array)
#10 /home/user/public_html/system/Dispatcher/Controller.php(96): IPS\gallery\modules\front\gallery\_view->manage()
#11 /home/user/public_html/system/Content/Controller.php(50): IPS\Dispatcher\_Controller->execute()
#12 /home/user/public_html/applications/gallery/modules/front/gallery/view.php(61): IPS\Content\_Controller->execute()
#13 /home/user/public_html/system/Dispatcher/Dispatcher.php(146): IPS\gallery\modules\front\gallery\_view->execute()
#14 /home/user/public_html/index.php(13): IPS\_Dispatcher->run()
#15 {main}

The "AND image_= IS NULL" is breaking the query. I'm not entirely sure what's corrupted here. I was able to upgrade to 4.3.5 without issue.

I've cleared the cache and am using the default template unmodified.

did you try delete the photo and reupload it, it looks to be the id <> as thats not really valid sql imo

Share this post


Link to post
Share on other sites
  • 0

Hi CookieMonster, I believe <> is valid, another way of saying !=

I no longer have the original photos, but the actual images in the gallery are intact. At least they show up in the album view, but not in the lightbox.

Share this post


Link to post
Share on other sites
  • 0
12 hours ago, nuceman said:

Hi CookieMonster, I believe <> is valid, another way of saying !=

I no longer have the original photos, but the actual images in the gallery are intact. At least they show up in the album view, but not in the lightbox.

My apologies your right <> is the same as not equal to as in != (I'm to used to JS so my apologies)

As far as I remember though if you read it this is reading

SELECT COUNT(*) FROM `gallery_images` WHERE image_album_id=48 AND image_id<>1544 AND image_= IS NULL
SELECT AND COUNT EVERYTHING FROM "gallery_images" WHERE image_album_id=48 AND image_id is not equal to 1544 AND image_= IS NULL

normally when writing IS NULL or IS NOT NULL you don't equal it to anything you would just say AND image_ IS NULL

but it reads wierd if its null,  so it might be the problem right there as you can't EQUAL IS NULL

Share this post


Link to post
Share on other sites
  • 0

I'm not sure why a query would end up with "image_=" as there is no column in gallery_images called that. 

If the update went through without problems and I'm using just the default style/template, any ideas where the bad query coming from?

This install has been going for some 6 years dating back to IPS 3.x. 

Share this post


Link to post
Share on other sites
  • 0
1 hour ago, nuceman said:

I'm not sure why a query would end up with "image_=" as there is no column in gallery_images called that. 

If the update went through without problems and I'm using just the default style/template, any ideas where the bad query coming from?

 This install has been going for some 6 years dating back to IPS 3.x. 

would suggest rollback a backup before it on a test server to see if its a local minor version bug on gallery or not

Share this post


Link to post
Share on other sites
  • 0
On 7/29/2018 at 9:32 PM, nuceman said:

I'm not sure why a query would end up with "image_=" as there is no column in gallery_images called that. 

If the update went through without problems and I'm using just the default style/template, any ideas where the bad query coming from?

This install has been going for some 6 years dating back to IPS 3.x. 

I have the exact same problem, I recently upgraded 2 10 year old forums from 3.x to 4.x and after that ran the latest updates.

both forums show the same message in the error log.

Invision support is not really helpful atm...

 

Did you fix it / have a working workaround?

Share this post


Link to post
Share on other sites
  • 0

Unfortunately no fix or workaround so far. I haven't been able to find where in the code that query is defined. I suspect there must be some old file or cache in the database that's causing it, but my knowledge of PHP is pretty limited.

Share this post


Link to post
Share on other sites
What do you think? Remember the human.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×