forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: gtgillis on March 21, 2012, 10:48:24 pm

Title: implode error updating photo description
Post by: gtgillis on March 21, 2012, 10:48:24 pm
While viewing any photo I click on "Edit File Information" below the photo to show the edit form. When I try to add text to a photo description I get the following error.

Code: [Select]
An error has occurred:

(This text is only displayed to users in the group 'Root')

2 - implode(): Invalid arguments passed @ /var/www/coppermine/edit_one_pic.php line 116

I am running 1.5.18.
Title: Re: implode error updating photo description
Post by: Joe Carver on March 22, 2012, 02:08:27 am
That line is looking at keywords.
Code: [Select]
    $keywords = implode($CONFIG['keyword_separator'], $keywords_new);
I could not reproduce the effect.
Remove / change the keywords.
Look at interference from plugins and your theme.
Otherwise post a link to your Coppermine so someone can take a look.
Title: Re: implode error updating photo description
Post by: Αndré on March 22, 2012, 09:54:10 am
What's your keyword separator setting?
What have you entered in the keywords field? Have you entered anything at all?
Title: Re: Re: implode error updating photo description
Post by: gtgillis on March 22, 2012, 03:09:18 pm
That line is looking at keywords.
Code: [Select]
    $keywords = implode($CONFIG['keyword_separator'], $keywords_new);
I could not reproduce the effect.
Remove / change the keywords.
Look at interference from plugins and your theme.
Otherwise post a link to your Coppermine so someone can take a look.

I was only entering text in the description. I did not use keywords when I got the error. Oddly, when I enter a keyword and a description it saves just fine. I'll keep looking.
Title: Re: Re: implode error updating photo description
Post by: gtgillis on March 22, 2012, 03:11:14 pm
What's your keyword separator setting?
What have you entered in the keywords field? Have you entered anything at all?

I have Enable clickable keywords in search checked and Keyword separator set to space.
Title: Re: implode error updating photo description
Post by: Αndré on March 22, 2012, 03:23:26 pm
Works as expected for me with that settings. I assume it's a server-sided issue, but we can try to fix it anyway.

Please open edit_one_pic.php, find
Code: [Select]
$keywords = explode($CONFIG['keyword_separator'], trim(html_entity_decode($keywords)));and below, add
Code: [Select]
$keywords_new = array();
Please report if it works as expected for you.
Title: Re: Re: implode error updating photo description
Post by: gtgillis on March 22, 2012, 03:33:29 pm
Works as expected for me with that settings. I assume it's a server-sided issue, but we can try to fix it anyway.

Please open edit_one_pic.php, find
Code: [Select]
$keywords = explode($CONFIG['keyword_separator'], trim(html_entity_decode($keywords)));and below, add
Code: [Select]
$keywords_new = array();
Please report if it works as expected for you.

That fixed it! Thanks.
Now I guess the question is why did this work?
Title: Re: implode error updating photo description
Post by: Αndré on March 22, 2012, 03:48:21 pm
The function implode (http://www.php.net/manual/en/function.implode.php) expects an array as second parameter. If you haven't entered a keyword, $keywords_new is undefined. With the new line we define $keywords_new as array regardless if keywords have been submitted or not.

However, this is the first time for me that PHP behaves like that (the error message is not from Coppermine by the way).
Title: Re: Re: implode error updating photo description
Post by: gtgillis on March 22, 2012, 04:06:18 pm
The function implode (http://www.php.net/manual/en/function.implode.php) expects an array as second parameter. If you haven't entered a keyword, $keywords_new is undefined. With the new line we define $keywords_new as array regardless if keywords have been submitted or not.

However, this is the first time for me that PHP behaves like that (the error message is not from Coppermine by the way).

I am using PHP version 5.3.6-13ubuntu3.6.

I am marking this as solved. Thanks again.
Title: Re: implode error updating photo description
Post by: Αndré on March 23, 2012, 11:29:18 am
Committed fix in SVN revision 8348.