With my *special* Drupal/G2 configuration, I'm having a problem accessing the G2 Filter and G2Image tabs in the Gallery module admin interface. If I disable Clean URLs in Drupal, I do not get the errors. Here's the error output.

Error in function 'gallery_handle_request()' (gallery_base.inc:164):

* Error (ERROR_MISSING_OBJECT) : Parent 7 path report
o in modules/core/classes/helpers/GalleryFileSystemEntityHelper_simple.class at line 98 (GalleryCoreApi::error)
o in modules/core/classes/GalleryCoreApi.class at line 1934 (GalleryFileSystemEntityHelper_simple::fetchChildIdByPathComponent)
o in modules/core/classes/helpers/GalleryFileSystemEntityHelper_simple.class at line 53 (GalleryCoreApi::fetchChildIdByPathComponent)
o in modules/core/classes/GalleryCoreApi.class at line 1883 (GalleryFileSystemEntityHelper_simple::fetchItemIdByPath)
o in modules/rewrite/classes/RewriteSimpleHelper.class at line 45 (GalleryCoreApi::fetchItemIdByPath)
o in ??? at line 0 (RewriteSimpleHelper::loadItemIdFromPath)
o in modules/rewrite/classes/RewriteUrlGenerator.class at line 103
o in modules/rewrite/classes/parsers/modrewrite/ModRewriteUrlGenerator.class at line 56 (RewriteUrlGenerator::_onLoad)
o in init.inc at line 161 (ModRewriteUrlGenerator::initNavigation)
o in main.php at line 196
o in main.php at line 103
o in modules/core/classes/GalleryEmbed.class at line 189
o in /home/username/drupal/sites/all/modules/gallery/gallery_base.inc at line 146 (GalleryEmbed::handleRequest)
o in /home/username/drupal/sites/all/modules/gallery/gallery.module at line 383
o in ??? at line 0
o in /home/username/drupal/includes/menu.inc at line 418
o in /home/username/drupal/index.php at line 15

CommentFileSizeAuthor
#3 g2path.patch950 bytesprofix898

Comments

profix898’s picture

Title: Gallery.module admin tab errors with rewrite » Error (ERROR_MISSING_OBJECT) : Parent 7 path *
Component: Installation / Configuration » Code / API
Assigned: Unassigned » profix898
Priority: Normal » Critical

This seems to be a serious problem. There are three bug reports for this kind of issue in the queue (in different context). Marked http://drupal.org/node/193132 and http://drupal.org/node/192924 'duplicate', so that we can work together in this issue here.

You are all experiencing the same problem:

  • Error (ERROR_MISSING_OBJECT) : Parent 7 path users on user synchronization
  • Error (ERROR_MISSING_OBJECT) : Parent 7 path install on the install tab
  • Error (ERROR_MISSING_OBJECT) : Parent 7 path report on the G2Image and Filter tabs

As a immediate workaround you can simply disable URL Rewrite in Gallery2.

Although I cant tell why this happens only for some users and only on certain pages, I think I have a clue where the problem is originated in the code. The new 5.x-2.x series of gallery module directly manipulates the $_GET['g2_path'] variable to accomplish a closer link between Drupal and Gallery2 path-wise. This is required to get GalleryMenu module and locale/i18n working if URL Rewrite is enabled.
However I think a slight reorganization of the call-sequence in gallery module or a method to restore the variable after Drupal has finished its part can solve this problem shortly.

ThriLLz’s picture

got the same problem, have no idea what to do... i've tested everything but no way.... hope that this failure will be fixed...

profix898’s picture

Status: Active » Needs review
StatusFileSize
new950 bytes

I tried on 4 different servers and was unable to reproduce the issue. Is anyone willing to grant me access to his/her infrastructure, so that I can test patches on an affected system? Can anyone please give the patch a try? I realized that I restructured g2_path handling in an earlier patch, so that we can possibly live without it completely now.

fuzzydru’s picture

I gave the patch a try on drupal 5.3, i18n.module 5.x-2.2, gallery.module 5.x-2.0-beta6 and still get the same error on 'admin/settings/gallery/filter':

Error in function 'gallery_handle_request()' (gallery_base.inc:159):

    * Error (ERROR_MISSING_OBJECT) : Parent 7 path filter
          o in modules/core/classes/helpers/GalleryFileSystemEntityHelper_simple.class at line 98 (gallerycoreapi::error)
          o in modules/core/classes/GalleryCoreApi.class at line 1845 (galleryfilesystementityhelper_simple::fetchchildidbypathcomponent)
          o in modules/core/classes/helpers/GalleryFileSystemEntityHelper_simple.class at line 53 (gallerycoreapi::fetchchildidbypathcomponent)
          o in modules/core/classes/GalleryCoreApi.class at line 1796 (galleryfilesystementityhelper_simple::fetchitemidbypath)
          o in modules/rewrite/classes/RewriteSimpleHelper.class at line 45 (gallerycoreapi::fetchitemidbypath)
          o in ??? at line 0 (rewritesimplehelper::loaditemidfrompath)
          o in modules/rewrite/classes/RewriteUrlGenerator.class at line 103
          o in modules/rewrite/classes/parsers/modrewrite/ModRewriteUrlGenerator.class at line 43 (modrewriteurlgenerator::_onload)
          o in init.inc at line 147 (modrewriteurlgenerator::initnavigation)
          o in main.php at line 180
          o in main.php at line 94
          o in modules/core/classes/GalleryEmbed.class at line 179
          o in /home/gaiatrav/public_html/new/sites/all/modules/gallery/gallery_base.inc at line 141 (galleryembed::handlerequest)
          o in /home/gaiatrav/public_html/new/sites/all/modules/gallery/gallery.module at line 383
          o in ??? at line 0
          o in /home/gaiatrav/public_html/new/includes/menu.inc at line 418
          o in /home/gaiatrav/public_html/new/index.php at line 15

this is how my .htacces file in the gallery2 folder looks like:

# BEGIN Url Rewrite section
# (Automatically generated.  Do not edit this section)
<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteBase /gallery2/

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} gallery\_remote2\.php
    RewriteCond %{REQUEST_URI} !/gallery2/main\.php$
    RewriteRule .   -   [L]

    RewriteCond %{THE_REQUEST} /gallery2/gallery/([^?]+)(\?.|\ .)
    RewriteCond %{REQUEST_URI} !/gallery2/main\.php$
    RewriteRule .   /gallery2/main.php?g2_path=%1   [QSA,L]
</IfModule>

# END Url Rewrite section

this is the .htaccess file in the drupal directory:

# BEGIN Url Rewrite section
# (Automatically generated.  Do not edit this section)
<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} gallery\_remote2\.php
    RewriteCond %{REQUEST_URI} !/index\.php$
    RewriteRule .   -   [L]

    RewriteCond %{THE_REQUEST} /gallery/([^?]+)(\?.|\ .)
    RewriteCond %{REQUEST_URI} !/index\.php$
    RewriteRule .   /index.php?q=gallery&g2_path=%1   [QSA,L]
</IfModule>

# END Url Rewrite section

#
# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template)$">
  Order allow,deny
</FilesMatch>

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks

# Customized error messages.
ErrorDocument 404 /index.php

# Set the default handler.
DirectoryIndex index.php

# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

# PHP 4, Apache 1.
<IfModule mod_php4.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# PHP 4, Apache 2.
<IfModule sapi_apache2.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
  # Enable expirations.
  ExpiresActive On
  # Cache all files for 2 weeks after access (A).
  ExpiresDefault A1209600
  # Do not cache dynamically generated pages.
  ExpiresByType text/html A1
</IfModule>

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on

  # If your site can be accessed both with and without the 'www.' prefix, you
  # can use one of the following settings to redirect users to your preferred
  # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  #
  # To redirect all users to access the site WITH the 'www.' prefix,
  # (http://example.com/... will be redirected to http://www.example.com/...)
  # adapt and uncomment the following:
  # RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
  # RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
  #
  # To redirect all users to access the site WITHOUT the 'www.' prefix,
  # (http://www.example.com/... will be redirected to http://example.com/...)
  # adapt and uncomment the following:
  # RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
  # RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

  # Modify the RewriteBase if you are using Drupal in a subdirectory and
  # the rewrite rules are not working properly.
  #RewriteBase /drupal

  # Rewrite old-style URLs of the form 'node.php?id=x'.
  #RewriteCond %{REQUEST_FILENAME} !-f
  #RewriteCond %{REQUEST_FILENAME} !-d
  #RewriteCond %{QUERY_STRING} ^id=([^&]+)$
  #RewriteRule node.php index.php?q=node/view/%1 [L]

  # Rewrite old-style URLs of the form 'module.php?mod=x'.
  #RewriteCond %{REQUEST_FILENAME} !-f
  #RewriteCond %{REQUEST_FILENAME} !-d
  #RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
  #RewriteRule module.php index.php?q=%1 [L]

  # Rewrite current-style URLs of the form 'index.php?q=x'.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>

# $Id: .htaccess,v 1.81.2.3 2007/09/21 12:24:22 drumm Exp $

hope that gives you a the right info to circle the issue.
Thanks for your help.

fuzzydru’s picture

Well, just found something else which could have to do with the error.
it seems that the auto install routine of gallery.module 5.x-2.0-beta6 picks up some old (and wrong settings of the previous gallery.module install.
in the gallery settings it shows under "Step 2: Gallery2 location settings - Auto Configuration (OK)" the "Embed URI:" as "/de/index.php?q=gallery" which might result in conflicts with the hole URL Rewrite routine.
I just can't seem to find a way to change this setting. ;)

ThriLLz’s picture

this might be the failure... i got the failure only after ive installed the gallery again...
everytime the same failure. tryed everything, now im out of ideas. there must be a way to fix this....

the embed url seems ok at my installation (the same as the first time)!
index.php?=gallery

i have no other languages...

greetings
dorian
____
www.kukljica.org

profix898’s picture

Status: Needs review » Needs work

Thanks fuzzydru for the details. Helped a lot :)
I was amazed to see that handleRequest is called for your filter page at all as it usually handles the gallery page only. But looking at your rewrite rules, it appears that the RewriteCond %{THE_REQUEST} /gallery/([^?]+)(\?.|\ .) rule applies to all paths containing /gallery/. Can you please try to change this to ^/gallery... so that only paths starting with gallery are rewritten!? Or change your 'ShowItem' rule from gallery/%path% to gallery/v/%path%.

Actually this starts to look more like a configuration issue than a bug in the gallery module code ...

fuzzydru’s picture

the change of ^/gallery... did work and the install routine works now.

on thing still persists. in the install page of gallery.module it still shows Embed URI: /de/index.php?q=gallery. I don't know where the /de is coming from. (even after deinstall of the module)
I'm assuming the standard Embed URI should just read /index.php?q=gallery so that the module can parse the request through i18n (if given).

profix898’s picture

Category: bug » task

Marking this 'task' as I plan to improve the documentation (especially FAQ) and submit an issue for Gallery2. The G2 rewrite rules should never apply to Drupal paths just because a ^ is missing IMO. Forcing users to set the 'Show Item' rule to gallery/something/%path% is not a solution either.

@fuzzydru: Are you using the i18n module or multilingual plugin in G2? The code that detects the Embed URI can be found in gallery_install.inc line 790+. Could you please add some print_r or sth. to find out where exactly the language prefix is added? I cant see why this should happen from just looking at the code.

profix898’s picture

Status: Needs work » Fixed

Feature request for G2 submitted (see http://sourceforge.net/tracker/?func=detail&atid=357130&aid=1835153&grou...) and installation instructions updated to always recommend gallery/v/%path%. A paragraph for this has also been added to the Troubleshooting page (http://codex.gallery2.org/Integration:Drupal:Troubleshooting#URL_Rewrite...).

I have created a separate issue for the i18n prefix in Embed URI stuff at http://drupal.org/node/193910

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.