Jump to content

Strange DB Error from Gallery


nuceman

Recommended Posts

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.

Link to comment
Share on other sites

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

VAEfvMI.png

Liked what i posted remember to feed me a cookie ->
Or you can add a cookie to myCookieJar

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

VAEfvMI.png

Liked what i posted remember to feed me a cookie ->
Or you can add a cookie to myCookieJar

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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

VAEfvMI.png

Liked what i posted remember to feed me a cookie ->
Or you can add a cookie to myCookieJar

Link to comment
Share on other sites

  • 2 weeks later...
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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...