4images Forum & Community

4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: Matthias70 on December 07, 2005, 06:43:55 PM

Title: Warning message when posting comment with multilang mod
Post by: Matthias70 on December 07, 2005, 06:43:55 PM
When I post a comment on my site. I have the following warning message

Quote
Warning: preg_match() expects parameter 2 to be string, resource given in /www/htdocs/v030672/bildergalerie/includes/functions.php on line 1437

Warning: preg_match() expects parameter 2 to be string, resource given in /www/htdocs/v030672/bildergalerie/includes/functions.php on line 1441

Warning: preg_match() expects parameter 2 to be string, resource given in /www/htdocs/v030672/bildergalerie/includes/functions.php on line 1445

I think it's a problem with the multilang mod, because the lines in functions.php are part of the multilang mod.
This is the code in functions.php:

Code: [Select]
function multilang($text, $show_first = 0, $remove = 0){
  global $config;
  preg_match("#\[".$config['language_dir']."\](.*)(\[\/?".$config['language_list']."\]|$)#iDUs", $text, $match);
  if (!empty($match[1])) {
    return $match[1];
  }
  preg_match("#^(.*)\[".$config['language_list']."\]#iDUs", $text, $match);
  if (!empty($match[1])) {
    return $match[1];
  }
  preg_match("#\[".$config['language_dir_default']."\](.*)(\[\/?".$config['language_list']."\]|$)#iDUs", $text, $match);
  if (!empty($match[1])) {
    return $match[1];
  }

Do you have any suggestions?
Matthias
Title: Re: Warning message when posting comment with multilang mod
Post by: V@no on December 08, 2005, 12:24:12 AM
Well, nothing wrong with that function, its how you use it.
Apperently u use it somewhere with a wrong "text" variable.
Trace back the changes you've made in details.php (like removing one-by-one multilang() function out of it.) and see where the error messages stops.
Title: Re: Warning message when posting comment with multilang mod
Post by: Matthias70 on December 08, 2005, 04:19:42 PM
Hi V@no,
I found the problem :-)
Code: [Select]
$clickstream .= multilang($image_name)."</span>";
must be
Code: [Select]
$clickstream .= $image_name."</span>";
Thank you V@no
Matthias