forum.coppermine-gallery.net

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Miscellaneous => Topic started by: LATH on February 12, 2005, 05:40:14 am

Title: Fatal error: Cannot redeclare clean_words()
Post by: LATH on February 12, 2005, 05:40:14 am
I installed Coppermine on about 2/6/2005 and now I'm getting this error:

Fatal error: Cannot redeclare clean_words() (previously declared in /home/johnlat/public_html/gallery/include/search.inc.php:44) in /home/johnlat/public_html/gallery/include/search.inc.php on line 44

It can be reproduced by:
1) go to http://www.johnlathrop.com/gallery/index.php
2) Click on Abell Family
3) Search using the word vivian
4) Click on any picture but the first picture

I used the "batch add files" functionality to add the pictures and a series of SQL statements like the following to add title, caption, etc:

UPDATE cpg132_pictures SET title='Emeline (ELIZA) Kidwell',caption=' ',keywords='Emeline (ELIZA) Kidwell Indianapolis, Indiana',user1='067',user2='Indianapolis, Indiana',user3='est 1870',user4='Ora Mae Suitcase' WHERE filename='067.jpg';

Some of the captions include HTML like &nbsp and <br>...this info came from another database that made use of the simple html.  As I type this I'm wondering if that is the cause of my problem.

 ???
Title: Re: Fatal error: Cannot redeclare clean_words()
Post by: LATH on February 12, 2005, 05:48:56 am
nope...I removed all of the &nbsp; and <br>...still get the error... :\'(
Title: Re: Fatal error: Cannot redeclare clean_words()
Post by: LATH on February 12, 2005, 07:29:14 am
I tried one more thing:

1) Delete category
2) Delete album
(I only had one category and one album...so, this cleaned out everything)
3) Created category and album
4) Used Batch Add to add pictures to album again
5) Gave several pictures the title "vivian"...to keep it simple
6) Repeated the steps in my initial message and now the message is "No image to display"

 :-[ :-\\ :\'(
Title: Re: Fatal error: Cannot redeclare clean_words()
Post by: donnoman on February 12, 2005, 07:48:40 am
Quote
Cannot redeclare clean_words()

Means you are trying to declare a function twice.

Either you are including the code twice and it's causing this error, or you've put the function clean_words in two different files.

use a text search utility that can search all of your php files for "function clean_words" report back the files that it exists in.

If you don't find any duplicates you can try using php's require_once or include_once functions on whatever line is including/requireing search.inc.php.
Title: Re: Fatal error: Cannot redeclare clean_words()
Post by: LATH on February 12, 2005, 07:49:22 am
one last idea:

1) set the keyword equal to the tile...just so the keyword is populated:

UPDATE cpg132_pictures SET keywords='vivian' WHERE title='vivian';

Still get the error: No image to display File: /home/johnlat/public_html/gallery/displayimage.php - Line: 590

Here is the debug output:

USER:
------------------
Array
(
    [ID] => eb48518a5e1fc97063ffe4404759df87
    [am] => 1
    [liv] => Array
        (
            [search] => ###18th person
)

==========================
USER DATA:
------------------
Array
(
    [user_id] => 1
    [user_group] => 1
    [user_active] => YES
    [user_name] => ********
    [user_password] => ********
    [user_lastvisit] => 2005-02-12 01:30:30
    [user_regdate] => 2005-02-06 13:21:20
    [user_group_list] =>
    [user_email] =>
    [user_website] =>
    [user_location] =>
    [user_interests] =>
    [user_occupation] =>
    [user_actkey] =>
    [disk_max] => 0
    [disk_min] => 0
    [can_rate_pictures] => 0
    [can_send_ecards] => 1
    [ufc_max] => 3
    [ufc_min] => 3
    [custom_user_upload] => 0
    [num_file_upload] => 5
    [num_URI_upload] => 3
    [can_post_comments] => 1
    [can_upload_pictures] => 1
    [can_create_albums] => 1
    [has_admin_access] => 1
    [pub_upl_need_approval] => 0
    [priv_upl_need_approval] => 0
    [group_name] => Administrators
    [upload_form_config] => 3
    [group_quota] => 0
    [can_see_all_albums] => 1
    [group_id] => 1
    [groups] => Array
        (
            [1] => 1
        )

)

==========================
Queries:
------------------
Array
(
    [album] => search
    [cat] => 0
    [pos] => 1
)

==========================
POST :
------------------
Array
(
)

==========================
VERSION INFO :
------------------
PHP version: 4.3.10 - OK
------------------
mySQL version: 4.0.22-standard
------------------
Coppermine version: 1.3.2
==========================
Module: gd
------------------
GD Support enabled
GD Version bundled (2.0.28 compatible)
FreeType Support enabled
FreeType Linkage with freetype
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled
==========================
Module: mysql
------------------
Active Persistent Links 0
Active Links 1
Client API version 4.0.22
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /var/lib/mysql/mysql.sock
MYSQL_INCLUDE -I/usr/include/mysql
MYSQL_LIBS -L/usr/lib -lmysqlclient  
==========================
Module: zlib
------------------
ZLib Support enabled
Compiled Version 1.1.4
Linked Version 1.1.4
==========================
Server restrictions (safe mode)?
------------------
Directive | Local Value | Master Value
safe_mode | Off | Off
safe_mode_exec_dir | no value | no value
safe_mode_gid | Off | Off
safe_mode_include_dir | no value | no value
safe_mode_exec_dir | no value | no value
sql.safe_mode | Off | Off
disable_functions | no value | no value
file_uploads | On | On
include_path | .:/usr/lib/php:/usr/local/lib/php | .:/usr/lib/php:/usr/local/lib/php
open_basedir | /home/johnlat:/usr/lib/php:/usr/local/lib/php:/tmp | no value
==========================
email
------------------
Directive | Local Value | Master Value
sendmail_from | no value | no value
sendmail_path | /usr/sbin/sendmail -t -i | /usr/sbin/sendmail -t -i
SMTP | localhost | localhost
smtp_port | 25 | 25
==========================
Size and Time
------------------
Directive | Local Value | Master Value
max_execution_time | 30 | 30
max_input_time | -1 | -1
upload_max_filesize | 2M | 2M
post_max_size | 55M | 55M
==========================
Page generated in 0.057 seconds - 10 queries in 0.001 seconds - Album set :
Title: Re: Fatal error: Cannot redeclare clean_words()
Post by: kegobeer on February 12, 2005, 01:44:59 pm
donnoman already told you what to do.
Title: Re: Fatal error: Cannot redeclare clean_words()
Post by: LATH on February 12, 2005, 04:44:44 pm
donnoman and kegobeer saw one line and jumped to a conclusion.  I guess I need to post this again without the alluring subject line.

By the way, I have not change your source code in any way.  This is a standard install.  If you were to read all of my messages you would see that I changed the data and the error message changed.  Conclusion->>"error messages aren't always what they seem"
Title: No image to display after search
Post by: LATH on February 12, 2005, 04:49:15 pm
No image to display after search  >:( >:( >:(

This can be reproduced by:
1) go to http://www.johnlathrop.com/gallery/index.php
2) Click on Abell Family
3) Search using the word vivian
4) Click on any picture but the first picture

I used the "batch add files" functionality to add the pictures.  I gave several pictures the title and keyword "vivian"...to keep it simple.


Here is the debug output:

USER:
------------------
Array
(
    [ID] => eb48518a5e1fc97063ffe4404759df87
    [am] => 1
    [liv] => Array
        (
            [search] => ###18th person
)

==========================
USER DATA:
------------------
Array
(
    [user_id] => 1
    [user_group] => 1
    [user_active] => YES
    [user_name] => ********
    [user_password] => ********
    [user_lastvisit] => 2005-02-12 01:30:30
    [user_regdate] => 2005-02-06 13:21:20
    [user_group_list] =>
    [user_email] =>
    [user_website] =>
    [user_location] =>
    [user_interests] =>
    [user_occupation] =>
    [user_actkey] =>
    [disk_max] => 0
    [disk_min] => 0
    [can_rate_pictures] => 0
    [can_send_ecards] => 1
    [ufc_max] => 3
    [ufc_min] => 3
    [custom_user_upload] => 0
    [num_file_upload] => 5
    [num_URI_upload] => 3
    [can_post_comments] => 1
    [can_upload_pictures] => 1
    [can_create_albums] => 1
    [has_admin_access] => 1
    [pub_upl_need_approval] => 0
    [priv_upl_need_approval] => 0
    [group_name] => Administrators
    [upload_form_config] => 3
    [group_quota] => 0
    [can_see_all_albums] => 1
    [group_id] => 1
    [groups] => Array
        (
            [1] => 1
        )

)

==========================
Queries:
------------------
Array
(
    [album] => search
    [cat] => 0
    [pos] => 1
)

==========================
POST :
------------------
Array
(
)

==========================
VERSION INFO :
------------------
PHP version: 4.3.10 - OK
------------------
mySQL version: 4.0.22-standard
------------------
Coppermine version: 1.3.2
==========================
Module: gd
------------------
GD Support enabled
GD Version bundled (2.0.28 compatible)
FreeType Support enabled
FreeType Linkage with freetype
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled
==========================
Module: mysql
------------------
Active Persistent Links 0
Active Links 1
Client API version 4.0.22
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /var/lib/mysql/mysql.sock
MYSQL_INCLUDE -I/usr/include/mysql
MYSQL_LIBS -L/usr/lib -lmysqlclient 
==========================
Module: zlib
------------------
ZLib Support enabled
Compiled Version 1.1.4
Linked Version 1.1.4
==========================
Server restrictions (safe mode)?
------------------
Directive | Local Value | Master Value
safe_mode | Off | Off
safe_mode_exec_dir | no value | no value
safe_mode_gid | Off | Off
safe_mode_include_dir | no value | no value
safe_mode_exec_dir | no value | no value
sql.safe_mode | Off | Off
disable_functions | no value | no value
file_uploads | On | On
include_path | .:/usr/lib/php:/usr/local/lib/php | .:/usr/lib/php:/usr/local/lib/php
open_basedir | /home/johnlat:/usr/lib/php:/usr/local/lib/php:/tmp | no value
==========================
email
------------------
Directive | Local Value | Master Value
sendmail_from | no value | no value
sendmail_path | /usr/sbin/sendmail -t -i | /usr/sbin/sendmail -t -i
SMTP | localhost | localhost
smtp_port | 25 | 25
==========================
Size and Time
------------------
Directive | Local Value | Master Value
max_execution_time | 30 | 30
max_input_time | -1 | -1
upload_max_filesize | 2M | 2M
post_max_size | 55M | 55M
==========================
Page generated in 0.057 seconds - 10 queries in 0.001 seconds - Album set :
Title: Re: No image to display after search
Post by: Nibbler on February 12, 2005, 04:50:17 pm
WFM, try clearing your cookies.
Title: Re: No image to display after search
Post by: LATH on February 12, 2005, 05:06:20 pm
Thank you Nibbler.

Interesting...I gave this a try and it worked.

Title: Re: Fatal error: Cannot redeclare clean_words()
Post by: donnoman on February 12, 2005, 06:11:55 pm
Sometimes an error message is exactly what it says.

Changing DATA can change the execution of the code, such that you would get different errors or none at all.

You haven't given us a lot to go on. It may NOT be something you added, it may be a problem with the possibility in the code to try to redeclare clean_words  depending on some bizaree situation that the devs never thought would happen.

The advice is still sound. You got that error for a reason, if you find out WHY you will be closer to finding out what's going wrong.

The debug code by itself isn't very helpful to be honest with you.

Turn on notices, reproduce the problem, post the contents of the error, the debug output, and all of the notices.

FYI, I did as your first post suggested and I didn't have a problem getting ANY of the photos that came up in the search to come up. Either you've fixed the problem, or maybe its related to your cookies.

Title: Re: No image to display after search
Post by: donnoman on February 12, 2005, 06:19:24 pm
This is a double post, you were recieving help within your first post, and they both came to the same conclusion.

You are wasting multiple supporters time by doing this.

I'll be merging your posts.
Title: Re: Fatal error: Cannot redeclare clean_words()
Post by: kegobeer on February 12, 2005, 06:19:47 pm
I noticed your keywords are things like - , (space) and the like.  Keywords are single words separated by spaces.  If you have the following keywords:

this - is - really, cool

your keywords are:

this
-
really,
cool

One of your pictures has this for keywords:

Quote
Vivian Colleta (Abell) Strawbridge - Clara Harvey - Blanche M - Merta Y unknown -  , 

I imagine that is causing your problems, which can lead to bizarre, unexplainable error messages, since one of those rogue characters can interrupt php parsing.  I also can't reproduce your error messages.
Title: Re: Fatal error: Cannot redeclare clean_words()
Post by: LATH on February 12, 2005, 06:24:06 pm
The problem appears to be related to the cookie.
Title: Re: Fatal error: Cannot redeclare clean_words()
Post by: Joachim Müller on February 14, 2005, 07:50:55 am
so you probably deleted you cookie and the problem was gone, right? Case closed?

Joachim
Title: Re: Fatal error: Cannot redeclare clean_words()
Post by: LATH on February 14, 2005, 09:56:16 am
Ya...case closed.  I've pretty much decided that the thing to do is to reset the cookie to a new value as admin after every major change.  :-\\
Title: Re: Fatal error: Cannot redeclare clean_words()
Post by: Joachim Müller on February 14, 2005, 10:02:21 am
that shouldn't be necessary, but it won't hurt either. Marking this thread as "solved" then.

Joachim