Adding comment problem

When adding comment Zp Demo Gallery you'll get error the following message:

`Warning: Invalid argument supplied for foreach() in /home/www/zenphoto/zenphoto/zp-core/kses.php on line 429

Warning: Cannot modify header information - headers already sent by (output started at /home/www/zenphoto/zenphoto/zp-core/kses.php:429) in /home/www/zenphoto/zenphoto/zp-core/functions-controller.php on line 164

Warning: Cannot modify header information - headers already sent by (output started at /home/www/zenphoto/zenphoto/zp-core/kses.php:429) in /home/www/zenphoto/zenphoto/zp-core/functions-controller.php on line 169

`

The error is resulted by my demo site (ZP Version 1.1.3) as well as Zp Demo Gallery.

«1

Comments

  • This is possibly because your zp-config.php file is missing the `$conf['allowed_tags'] = array (` array. Or, if you have installed the nightly build you may not have run the setup.php program.
  • Try to add a comment in demo-gallery http://www.zenphoto.org/zenphoto/demo-gallery/ and you'll see the error message.
  • Comments are working perfectly on my site. It is quite possible that the zenphoto demo gallery also is missing the allowed_tags. Did you check yours?
  • There is definitely something weird with this kses.php thing. I had the same problem with a perfectly fine zp-config.php (1&1 host, PHP5, MySQL 5). I tried to debug it and found that the problem has something to do with getOption('allowed_tags') in functions-controller.php. Looks like it doesn't even return an array...

    I fixed this bug by adding "$inarray = getOption('allowed_tags');" in kses.php line 428.

    I don't get any warning anymore, but I don't think you really can consider this as a fix, it's just a workaround.
    Does anybody have an idea about how to solve the *real* bug?
  • I installed the latest version: zenPHOTO 1.1.3 12/17/2007 and run the setup. My zp-config.php file includes the following lines:
    ...
    `

    $conf['allowed_tags'] = array (

    'a' => array ('href' => array (), 'title' => array ()),

    'abbr' => array ('title' => array ()),

    'acronym' => array ('title' => array ()),

    'b' => array (),

    'blockquote' => array ('cite' => array ()),

    'code' => array (),

    'em' => array (),

    'i' => array (),

    'strike' => array (),

    'strong' => array (),

    'ul' => array (),

    'ol' => array (),

    'li' => array (),

    );

    `
    ...

    The workaround by Schnouki gets the warning message out. The bug is still there...
  • The following comments refer to the nightly build only, not to the released 1.1.3 version. If you are running the 1.1.3 released version, check you config.php file for the code quoted by sepkort above.

    There is a change in how the html tags allowed for comments as processed by kses are handled. There is now an option for these rather than code in zp-config.php.

    first: the "fix" by Schnouki is not correct and should not be necessary. `getOption('allowed_tags')` does not return an array. It returns the option string. That must be parsed by the call on `parseAllowedTags` which is on the following line.

    If you have not run setup.php, the kses allowed_tags option default will not have been set. This should be corrected, but does not seem to cause the errors you are describing.

    The only way I have been able to generate the error described above is by manually editing the database option table row for `allowed_tags` and setting it to something invalid.

    So, if you have run setup.php on the nightly build and are still having this problem you will need to delete the `allowed_tags` option row and re-run setup.php. If this still does not work, add a line below the call on `parseAllowedTags` in functions-controller as follows:
    `if ($allowed === false) { $allowed = array(); } // someone has screwed with the allowed_tags option row in the database, but better safe than sorry`
  • I run setup.php on the nightly build and have no problem any more. Thanks!
  • I have this same problem (ish).

    With the current release AND the nightly build on IIS 5.

    If I attempt to add a comment it will add 26 duplicates of the same comment and then redirect to a blank page.

    Yes I have run setup.php and I've checked the allowed_tags.
    I'd been tracking this problem and had come to the same Kses.php when I came across this post.
  • I'd better add that I only get the same error as above if I comment out the header redirect, else I get multiple comment entries.
  • Elgar:

    Do you get any cgi errors? Kses.php's task is to screen the information posted for html tags. It does not appear to be involved in the redirect.

    It is strange that you get 26 duplicates. One would think that if the redirect is causing a repost, nothing would terminate the loop.

    How about a link to your site so we can take a look.
  • No errors.

    I'll turn comments back on so you can look.

    http://elgarl.acemulator.com
  • OK, you can turn them off now. I got 54 repeats.

    For some reason, the POST information is not cleared by the redirect. You can try adding `unset($_POST);` just before the header statement. It is only a guess, though.
  • I'm afraid

    unset($_POST);

    did nothing when placed right before

    header('Location: ' . $redirectTo);
  • Sorry, then, I am out of ideas.
  • i got the same problem ...
  • I have this error :

    Warning: Invalid argument supplied for foreach() in /var/www_data/zenphoto/zp-core/kses.php on line 429

    Warning: Cannot modify header information - headers already sent by (output started at /var/www_data/zenphoto/zp-core/kses.php:429) in /var/www_data/zenphoto/zp-core/functions-controller.php on line 164

    Warning: Cannot modify header information - headers already sent by (output started at /var/www_data/zenphoto/zp-core/kses.php:429) in /var/www_data/zenphoto/zp-core/functions-controller.php on line 169

    But the comment is added.
  • gregb34:

    Please see my posting above regarding the allowed_tags array.
  • I have installed the nighty buildand everything it's ok. THANKS !!!
  • No fix here. I've also noted that adding tags and descriptions does nothing.
  • Sounds like a mySQL issue. Storing tags and descriptions are fairly simple mySQL queries.
  • The SQL server has no issues. I run 3 forums and other assorted games related programs on the same SQL server.

    I even gave ZP root access to make sure.
  • i got same problem :P

    try nighty build (http://www.zenphoto.org/files/nightly/zenphoto-2007-12-21-trunk.zip) and run setup.php again

    it's work!
  • I am using the nightly build and I have run setup.php

    I just re-downloaded it all again to be sure, and it's the same.
  • Just to note the problems are.

    1. Header redirect isn't clearing the post data which causes multiple comments to be posted.
    2. Tags and descriptions are not displayed or saved when added.
  • Just to note the problems are.

    1. Header redirect isn't clearing the post data which causes multiple comments to be posted.
    2. Tags and descriptions are not displayed or saved when added.
    3. Tags and descriptions are saved when added, but kses.php still throws an error (what is the case for Schnouki (see above) and for me)
  • ianboo:

    Which is it, are Tags and descriptions saved (#2) or not(#3)?

    Have you upgraded to the nightly build? If so, have you run setup? If not, have you checked your zp-config file as described above?
  • 'Tags' and 'Desc' columns always remain empty in the zp_images table. No matter how many times you try to add a description on an image.

    Yes I have upgraded to the nightly build.
    Yes I have checked the config file. I've deleted it and used the new one that comes with the nightly build.
  • Elgar: Sorry, above question was if ianboo.

    Perhaps if you and ianboo could compare information about your installations, we might get somewhere. There must be some similarity between you that would flag what is causing these problems. At present I have no ideas.
  • I also have the same problem, plus my theme does not longer works after the update :( ... wonder why did I updated :(

    ***After adding:

    "$inarray = getOption('allowed_tags');"

    ...to line 428 as per Schnouki, comments are now working.
  • zucye:

    You should really read this thread thouroughly. (Wonder why you didn't) What you did is NOT a fix.

    Please review my message Posted: 2007-12-20 14:24:19 # 88.112.152.116
Sign In or Register to comment.