Input Array does not match ?: SELECT DISTINCT g2_AccessMap.g_accessListId FROM g2_AccessMap WHERE (g2_AccessMap.g_userId = NULL OR g2_AccessMap.g_groupId IN ('00000000000000000000000000000001')) AND g2_AccessMap.g_permission & '00000000000000000000000000000001' =

warning: pg_exec(): Query failed: ERROR: syntax error at end of input at character 370 in /web/www/htdocs/iaeste/gallery2/lib/adodb/drivers/adodb-postgres64.inc.php on line 722.

This is the error that I get when I enable gallery block inside drupal 4.6. I don't know if it's the gallery or module that is creating problems, because gallery is working fine on its own. Probably it's something with postgres.inc.php file. If anyone knows something about it, please write!

Tnx

Oh yeah, and I can't log on like admin because it somehow that error logs me off, so I had to delete gallery.module before I could log on again.

Comments

zach harkey’s picture

Almost the same error here, using mysql, when I activate the gallery block I get...

Input Array does not match ?: SELECT DISTINCT g2_AccessMap.g_accessListId FROM g2_AccessMap WHERE (g2_AccessMap.g_userId = NULL OR g2_AccessMap.g_groupId IN (1)) AND g2_AccessMap.g_permission & 1 =

user 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 '' at line 10
query: SELECT DISTINCT(p.perm) FROM role r INNER JOIN permission p ON p.rid = r.rid INNER JOIN users_roles ur ON ur.rid = r.rid WHERE ur.uid = 0 in /home/httpd/vhosts/harkeydesign.com/httpdocs/includes/database.mysql.inc on line 66.

tdebruyn’s picture

Same problem here, but only for not logged in users.
Drupal 4.6.0 / Gallery2 30/05/2005 snapshot

Input Array does not match ?: SELECT DISTINCT t_AccessMap.c_accessListId FROM t_AccessMap WHERE (t_AccessMap.c_userId = NULL OR t_AccessMap.c_groupId IN (1)) AND t_AccessMap.c_permission & 1 =

Tom

tdebruyn’s picture

The problem seems to be due to the image bloc module in Gallery2, when you deactivate this option, the error message disappear.
Not a solution as the bloc is a nice feature, but a workaround.

Tom

florre’s picture

didn't really solve the above error...
I still get logged out...

fester’s picture

I had a similar error. It seemed to be a conflict between user accounts in drupal and G2, I had created an account in G2 with the same name as my administrator in drupal. Renaming the user in G2 allowed me to log in successfully with gallery.module enabled. This problem didn't arise until I upgraded to Gallery 2 Beta 3.

mmkassem’s picture

I have the same error here on a linux box where gallery is installed in folder "gallery2" but I do not get this error on the copy installed locally (windows) and the gallery is installed in folder "gallery" .. I am not sure if it is related to permissions or path problem.

Users: I changed back the administrator username back to Admin for the Gallery2
Versions: Both Beta3 and Drupal 4.6.1

seanmil’s picture

I am also seeing the exact same error the original poster pasted but (apparently) only for my login and only some of the time.

If I log in as the Drupal administrator (same ID as the Gallery admin) or as another Drupal user it seems to work just fine. It only seems to show up for me when I log in with my own (non-admin) user id. Also, if I click into the Gallery link from within Drupal and then back to some other non-Gallery Drupal page it seems to disappear.

I looked through the code for this module and didn't see anything that indicated it was necessarily a problem with the Drupal/Gallery integration module but this error never occurs when logging into Gallery from the Gallery main.php login page.

My Drupal and Gallery administrators had the same login name so, per fester's suggestion, I did try renaming the Drupal administrator so that the admin IDs didn't match. That didn't have any effect though - which makes sense since as I said, it seems to be related only to my non-admin login id. Now, that does match between Drupal and Gallery, but the whole point is to have one ID for both so changing it would defeat the whole intent.

In the mean time I have disabled the Gallery Image Block - which is too bad, but it seems to fix the problem.

ergophobe’s picture

This issue comes up here and in

http://drupal.org/node/22340

http://drupal.org/node/25207

Using Gallery B4 and Drupal 4.6.2
I followed several of the suggestions mentioned above or in other threads on this.

1. I set $full = true

That got rid of the SQL errors, but then I ended up with Access Denied and can no longer log into Drupal.

2. I changed the Drupal admin name. No effect. Still can't log into Drupal. Gallery login and admin works fine but Drupal is completely foobarred.

I did have the Gallery Block activated, but deactivated and am getting these problems when trying to configure the block.

ergophobe’s picture

The SQL errors are coming from the query being built in

GalleryPermissionHelper_simple.class, lines 69-80, in the function fetchAccessListIds()

 $query = sprintf('
	    SELECT DISTINCT
	      [GalleryAccessMap::accessListId]
	    FROM
	      [GalleryAccessMap]
	    WHERE
	      ([GalleryAccessMap::userId] = ?
	      OR
	      [GalleryAccessMap::groupId] IN (%s))
	      AND
	      ' . $bitAndPermission . ' = ?
	    ', $groupIdMarkers);

It seems to be messing up the sprintf and substituting for the last ? before and after the equals or something.

ergophobe’s picture

Got it (sort of). The above query plugs in the data in the array $data, which is build based on the $userId.

When you are logged into Drupal as the admin, your UID #1 is mapped to the Gallery Admin userId and this gets used.

When you are using Gallery as a standalone and are not logged in, you default to the 'guest' account.

When you are using Drupal and are not logged in, you default to a user id of NULL. This does NOT map to anything in Gallery and the Gallery

function fetchAccessListIds($permission, $userId)

does not expect a null user id. This results in the wrong parameter count in the $data array so that when the query and the $data get plugged in in line 87 (or thereabouts)

list ($ret, $results) = $gallery->search($query, $data);

there is one too few parameters to fill out the query. I don't have a fix yet, but that's progress.

Naturally, it's easy to hack the Gallery function, but that's definitely the wrong approach as it's Drupal that messing up Gallery, not the other way around. So the trick is to figure out where upstream to intervene here.

If anyone knows where/how Drupal maps users to Gallery, please post and save me some time with that. I'm brand new to both scripts and it woudl save me some hunting.

ergophobe’s picture

Barking up a wrong tree. It seems like just setting $full=true as mentioned above helps in most cases.

gallery_block() sends no user id on line 148

list($ret, $content) = GalleryEmbed::getImageBlock($params);

which Gallery seems to expect, but Gallery can also accept a NULL user, so that can't be the problem. This is what results in no user id making it into the query mentioned above in the previous two posts, but even if you set the user id, that query is still missing the last parameter and I can't figure out how Drupal could set that.

I'm also not sure why $full=true works.

Now on to the broken thumbnail images...

sethmay’s picture

I had all these same problems. drupal is in /var/www/drupal and gallery2 is in /var/www/gallery2. Havoc ensues. My hack solution was to first set $full=true (as discussed earlier).
Second, the gallery2 location as set in drupal admin/settings/gallery (suppose to be relative with trailing /). When set as '/gallery2', images appear properly, but embed.php can't be found. When set as '/var/www/gallery2' embed.php can be found but images don't appear correctly. So here is the simple hack:

Modify function _gallery_init() (the bold is the changed section):
Set admin/settings/gallery location to '/gallery2'

/**
 * fetch a galleryEmbed object
 */
function _gallery_init($full = true) {
 global $user, $base_url;

  $galleryDir = variable_get('gallery_dir', 'gallery2/');

<b>
$galleryAbDir = '/var/www/gallery2';  
include_once($galleryAbDir . '/embed.php');
</b> 

Please note: This is not a good solution, it is just a solution.

alexandreracine’s picture

Status: Active » Closed (fixed)

Please update the version of this module, drupal, and try again.

For the random image block issue, get the fix here. http://drupal.org/node/31398