Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Warning: Invalid argument supplied for foreach()  (Read 5859 times)

0 Members and 1 Guest are viewing this topic.

mwaidmann

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Warning: Invalid argument supplied for foreach()
« on: October 22, 2003, 12:11:44 am »

i got an error that is driving me crazy. after creating an album there is following error:
Warning: Invalid argument supplied for foreach() in /phpnuke/modules/coppermine/delete.php on line 249

i checked the line and found the array that causes the trouble: $HTTP_POST_VARS['to']

on my local webserver the script runs perfect, the real running webserver shows up with the error. i checked "phpinfo()" to see if there is anything wrong with the server configuration, but it is ok. i got another foreach problem while putting a batch to an album in searchnew.php. again it is a http_post_vars reference!!!

i'm thankful for any help!

maik
Logged

gtroll

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 618
    • CPG-Nuke
Warning: Invalid argument supplied for foreach()
« Reply #1 on: October 22, 2003, 01:31:31 am »

I had the same problem when I started... I checked the oldboard and no fix was offered but since the function still works and admin is the only one who see the error,it was left as is. I will be sure to test for that in the new version...

mwaidmann

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Warning: Invalid argument supplied for foreach()
« Reply #2 on: October 22, 2003, 01:12:26 pm »

ok. but i need only two users out of the registered who are able to create albums and upload batch files. i thought it would be best changing their status from registered to admin. but if they are admins they can't upload anything because of the described bug. any suggestions what to do?
Logged

gtroll

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 618
    • CPG-Nuke
Warning: Invalid argument supplied for foreach()
« Reply #3 on: October 22, 2003, 01:24:26 pm »

Are you sure the error keeps the uploads from happening- it didn't with me...
It's a "Warning:" not an error.... so it shouldn't stop things up...

mwaidmann

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Warning: Invalid argument supplied for foreach()
« Reply #4 on: October 22, 2003, 04:22:01 pm »

first step todo would be to create an album. after typing in the album title and pressing the submit button, the error shows up. here it ist the $HTTP_POST_VARS['to'] array causing the trouble. if i ignore the warnung and press continue, the new album wasn't created. and without any album i can't upload a batch!
after creating the album manually in phpmyadmin i can upload the batch. at the overview page i can choose the images i want to have in my album. now i click the continue button and the "processing page" shows up. but nothing happens. only the warning is there again. this time in searchnew.php.
Logged

mwaidmann

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Warning: Invalid argument supplied for foreach()
« Reply #5 on: October 23, 2003, 12:40:23 am »

got it.

the problem is caused by an html bug. you use "[]" in the name attribute in input tags which belong to an array in php. i removed it and got the array in two steps working. first collect all values for the array with javascript
Code: [Select]

function summe(){
 laenge = document.formular.elements.length;
 sammlung = "";
 j = 0;
 for(i=0;i<laenge;i++){
  if(document.formular.elements[i].name == "pics" && document.formular.elements[i].checked){
   sammlung += document.formular.elements[i].value+"|";
  }
  j = i;
 }
document.formular.elements[j].value = sammlung;
}


after this i got a string with all checked images divided by "|".
in searchnew.php i explode the string and got the array.

not as fine as the original but working  :D
Logged
Pages: [1]   Go Up
 

Page created in 0.033 seconds with 19 queries.