Each time I upload an image into a gallery I get this warning in drupal.

warning: urldecode() expects parameter 1 to be string, array given in /usr/www/virtual/gateway/www.mysite.com/modules/path/path.module on line 90.

Comments

dddave’s picture

Assigned: gateway69 » Unassigned

#757572: urldecode() Error on manage/sort/edit of Node Gallery reports this with sorting and managing...

Note: Assigning an issue to yourself means that you are working on a patch... (see: http://drupal.org/node/317)

I cannot recreate this...

justintime’s picture

Status: Active » Postponed (maintainer needs more info)

Can you post exactly what you did to get this error? What modules are enabled, what values do you fill in on the gallery, what values are on the image, and what your NG settings are?

It's probably an NG bug, and it's in the batch API implmentation, but it's only been reported twice and I've never seen it.

gateway69’s picture

hmm im not at home right now to check, but in general I everything I submit a photo, doesn't matter what size but mainly just jpegs 800x600 this warning shows up after the image is submitted.

dfelix’s picture

I get this warning after enabling the field 'Path settings' on the second page of 'Node Gallery - Edit Configuration'.
Each time I click on the 'Manage Images' or 'Sort Images' tab and then on 'Save' I get a whole list of this warnings (for example: 20 images in the gallery, 20 warnings).

System configuration:
php 5.2.6
drupal 6.16
node gallery 6.x-2.0-beta2
node gallery access 6.x-2.0-beta2
pathauto 6.x-1.3

dbeall’s picture

I am trying to provoke an error by putting in weird paths(spaces and slashes in the wrong place) stuff like that.. But I still can't get an error.
I am wondering what the path is that you are using, and what the db log says. Are you sure the php is 5.2
This issue shows an 'upload' warning, but yours is a sort/manage page warning.. so it is a different warning?

dfelix’s picture

When uploading an image I get the same warning, not only when managing or sorting images (I didn't check that before).
After enabling the field 'Path settings' the section 'URL path settings' is displayed when you want to upload or manage an image. Under the 'Manage Images' tab the checkbox 'Automatic alias' and a textfield with the automatically generated alias (module pathauto) are displayed. The alias uses the default settings (see admin/build/path/pathauto, section 'Node path settings'), so the generated alias is something like 'node-gallery/gallery-title/image-name'.
The log says:
...
Location http://www.example.com/batch?id=39&op=do
Referrer http://www.example.com/batch?op=start&id=39
Message urldecode() expects parameter 1 to be string, array given in /home/www/aegir.mysite.dom/platforms/standard-6.16/modules/path/path.module on line 90.
Severity error
...

And yes, php is 5.2.6; that's what you get from Debian Lenny :-)

adamip’s picture

Yes, deflix, you are correct (see above #4).
When I check-off "Path Settings" on the second page of "Site Configuration" "Node Gallery", all these warnings are no longer showing up. The warning messages used to show up on Upload images, Manage images, Sort images.

The followings are site settings. The only different is checking ON and OFF the "Path Settings" as mentioned above will toggle this warning message.

System configuration:
PHP Version 5.2.10
Apache/2.2.3 (CentOS)
Drupal 6.17

----------------------
Administer › Site configuration › Node Gallery
-- Gallery Type Name: Node Gallery Default
-- Gallery Directory: %uid-%gid
-- Default Cover Image: ( blank )

----------------------
Administer › Site building › URL aliases --> Automated alias settings
-- Default path pattern for Image (applies to all Image node types with blank patterns below):
-- [user-id]-[site-date-yyyy][site-date-mm][site-date-dd]-i-

----------------------
Administer › Content management -> Content Types
Node Gallery - Gallery --> Workflow settings --> Upload Path settings
-- File path: node-gallery
-- File name: [user-id]-[site-date-yyyy][site-date-mm][site-date-dd]-ng-[filefield-onlyname-original].[filefield-extension-original]
-- File alias: files/Node Gallery/[filefield-onlyname-original].[filefield-extension-original]
-- File path cleanup settings : ( of all above three )
-- -- Cleanup using Pathauto --> unchecked
-- -- Convert File path to lower case --> unchecked
-- -- Transliterate --> unchecked
After quite some file uploading, I find zero number of files in this folder :
/var/www/html/sites/default/files/node-gallery

----------------------
Administer › Content management -> Content Types
Node Gallery Image --> Workflow settings --> Upload Path settings
-- File path: node-gallery-image
-- File name: [user-id]-[site-date-yyyy][site-date-mm][site-date-dd]-i-[filefield-onlyname-original].[filefield-extension-original]
-- File alias: files/Node Gallery/[filefield-onlyname-original].[filefield-extension-original]
-- File path cleanup settings : ( of all above three )
-- -- Cleanup using Pathauto --> unchecked
-- -- Convert File path to lower case --> unchecked
-- -- Transliterate --> unchecked
After quite some file uploading, I find many files in this folder :
/var/www/html/sites/default/files/node-gallery-image

----------------------
Active modules:
Node Gallery 6.x-2.0-beta2
Node Gallery Access 6.x-2.0-beta2
Node Gallery Lightbox2 Integration 6.x-2.0-beta2
Node Gallery Sildeshow Integration 6.x-2.x-dev
Global Redirect 6.x-1.2
File Aliases 6.x-1.1
FileField Paths 6.x-1.4
'me' Aliases 6.x-2.7
Pathauto 6.x-1.3
Image 6.x-1.0-beta5
Path 6.17 (Core)

I personally guess this warning message was caused by a modules conflict.

If you need any further information, please let me know.

Sincerely yours,
Adam

justintime’s picture

Do you have a filefield CCK on your node_gallery_image content type? If so, why?

adamip’s picture

No. I did not add any CCK to the default node_gallery_gallery and node_gallery_image. There is no added field in these 2 node_gallery content types. Thank you.

justintime’s picture

What module is giving you the "Path Settings" checkbox? I don't have it on any of my installs.

adamip’s picture

I thought the "Path Settings" was there once I install Node Gallery module.

To seek for an answer, I un-check the following modules in http://www.yoursite.com/admin/build/modules
1. Pathauto 6.x-1.4
2. FileField Paths 6.x-1.4
3. File Aliases 6.x-1.1
4. Global Redirect 6.x-1.2
After un-check, the "Path Settings" was still there ( http://www.mysite.com/admin/settings/node_gallery/edit/node_gallery_gallery , second page).

I then un-check "Path 6.19 (Core optional)". After that , the "Path Settings" was no longer there.

Does the above help? Please kindly advise.

justintime’s picture

Can you try the patch in #910450: Some CCK Fields not working on the upload screen and see if that resolves the issue? It's a stretch, but eliminating the AHAH stuff may have fixed this issue as well.

dddave’s picture

Version: 6.x-2.0-beta1 » 6.x-2.x-dev

Still an issue?

pixelsweatshop’s picture

unchecking "path Settings" does resolve this issue.

dddave’s picture

Status: Postponed (maintainer needs more info) » Fixed
justintime’s picture

Version: 6.x-2.x-dev » 6.x-3.x-dev
Status: Fixed » Active

As reported in #970538: Invalid argument supplied for foreach() when saving no changes on Manage Images tab, this is still an issue, and just needs to be tracked and resolved in both branches.

justintime’s picture

Okay, I can finally reproduce this now.

Enable path module, set the manage images tab to show "Path Settings", visit manage images, error occurs.

The problem is that $node->path is an array, like this:

$node->path['path'] == 'content/mytitle';

If pathauto is enabled, the problem gets worse:

$node->path = array(
  'path' => 'content/mytitle',
  'pid' => 34,
  'pathauto_perform_alias' => 1,
  'old_alias' =>'galleries/singularis/pb047935jpg-0'
);

Just leaving some notes in case anyone else wants to look. I didn't get much further than that.

scroogie’s picture

The problem is not directly related to the path module. I think its because of the fieldset, and that we retain the tree structure in the form_state array by setting $form['images']['#tree'] = TRUE;
I think we do that so we can iterate all images in the submit function. I'm investigating how we can work around that.

justintime’s picture

I slept on it, and came to the same conclusion. Two thoughts:

- Fieldsets can be nested, so we'll need some recursion to strip it.

- The node_form submit handler must already handle this - we should dig through that code to see what they do in core.

scroogie’s picture

Got it. Will upload patch later, have to go.

scroogie’s picture

Here is a patch. Sorry for killing kittens, but it also fixes the pagination on the manage images form, which was using an old global variable instead of the per relationship settings.

scroogie’s picture

There seems to be something wrong with my CVS status, not?

scroogie’s picture

Status: Active » Needs review

Oh, I think the second one is okay. What irritated me is that you actually submitted that dpm() in the submit function in your last commit. :)

scroogie’s picture

Okay, this one should be really okay (again something slipped in).

justintime’s picture

Interesting approach. I was thinking about stripping all fieldsets *before* rendering the form. After all the manage images page is meant to be quick and efficient. If something like "Path Settings" is on that page, it's because the user specifically said to put it there. However, with the fieldset there, "Path Settings" is collapsed, and requires an extra click to enter any data for each image.

Pseudocode would be something like this:

foreach ($form as $element) {
  if ($element['type'] == 'fieldset') {
    $element = fieldset_flatten($element)
  }
}

Thoughts? We could certainly reuse your flatten function. See any flaws with my approach?

scroogie’s picture

I saw that this approach was prepared with a function call somewhere (get_image_form_item_recursive), but in the end decided that you probably wanted to preserve the fieldsets on purpose. :)
Do you want to preserve the grouping (so just uncollapse all fieldsets) or do you want to completely get rid of them? Don't know if the ordering migth get messed up for pathauto or any other property that groups more than one field in a fieldset. I'll have to try that out.

justintime’s picture

Funny, get_image_form_item_recursive() is Wilson's code from ages ago AFAIK -- I've never looked at the code in there.. I would prefer preserving order, but since we're dealing with the array after hook_form_alter, I think we'll be okay (all weights will have been applied).

justintime’s picture

Status: Needs review » Fixed

In the interest of keeping things atomic, I'm committing this patch since it fixes the bug. I'll start another issue regarding fieldsets. Thanks for the patch @scroogie, and sorry for the dpm(). I can't wait for git and all it's branching goodness. It will help so much when working on multiple things at once.

Status: Fixed » Closed (fixed)

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