After installation got such error:

array_map() [function.array-map]: The first argument, 'utf8_encode', should be either NULL or a valid callback in /virt/homes/valine/htdocs/includes/common.inc on line 1775.

You can see it here

Comments

Nobody knows?

Nobody knows?
Drupal version 4.6.3, PHP 5

Can you find out where this

Can you find out where this is called from? Put in a debug_backtrace().
--
Drupal services
My Drupal services

Re:

Can anyone tell me how to resolve this as I have the same problem.

Tnx.

re:debug_backtrace

This is the debug log:

array(4) { [0]=> array(4) { ["file"]=> string(40) "/var/www/html/drupal/includes/common.inc" ["line"]=> int(625) ["function"]=> string(15) "decode_entities" ["args"]=> array(2) { [0]=> &string(1) "q" [1]=> &array(3) { [0]=> string(1) "<" [1]=> string(1) "&" [2]=> string(1) """ } } } [1]=> array(4) { ["file"]=> string(40) "/var/www/html/drupal/includes/common.inc" ["line"]=> int(616) ["function"]=> string(16) "valid_input_data" ["args"]=> array(1) { [0]=> &string(1) "q" } } [2]=> array(4) { ["file"]=> string(40) "/var/www/html/drupal/includes/common.inc" ["line"]=> int(1926) ["function"]=> string(16) "valid_input_data" ["args"]=> array(1) { [0]=> &array(1) { ["q"]=> string(4) "node" } } } [3]=> array(4) { ["file"]=> string(30) "/var/www/html/drupal/index.php" ["line"]=> int(14) ["args"]=> array(1) { [0]=> string(40) "/var/www/html/drupal/includes/common.inc" } ["function"]=> string(12) "include_once" } }

warning: array_map(): The first argument, 'utf8_encode', should be either NULL or a valid callback in /var/www/html/drupal/includes/common.inc on line 1776.

Re:

I commented this line, it works fine.
$table = array_map('utf8_encode', $table);

But looks that this statement is for unicode conversion. Can anyone tell me what is wrong with this line of code?

Thanks, it works. In my case

Thanks, it works. In my case UTF8 locale is set in MySQL. May be that is the reason?

Missing php5-xml module

After some headache with the same problem, I finally worked out what was wrong. What happens is that PHP is missing its xml module which, in some distributions, like Mandriva Linux 2005 (my case), comes built-in with PHP4 but not with PHP5.

So you only have to install php5-xml with the appropriate admin tool (urpmi in Mandriva's case) and restart the apache server to get Drupal working properly.

Thank You!!

Your work just saved me many hours of research and anguish and I still would not have solved this problem since I am not a coder. I am using Mandriva 2005 also, for me this is very timely and helpful information.

I still can not remove this warning !!

I have the same problem !

My configuration :

Apache-AdvancedExtranetServer/2.0.53 (Mandrakelinux/PREFORK-9mdk) mod_ssl/2.0.53 OpenSSL/0.9.7e PHP/4.3.10 mod_perl/1.999.21 Perl/v5.8.6 Server at 127.0.0.1 Port 80
MySQL 4.1.11

Although I installed the php5-xml, this warning still exists !!

Maybe this is a bug ??

And with this warning , it seems that I can not create the first account ??

----------------------------------------
Using it, Digesting it, absorbing it !

I omitted this waining !

As the guy above said, I commented that code, and all run well !

Maybe it is not necessary to transform this character encoding way ?

-----------------------------------------
Using it, Digesting it, absorbing it !

----------------------------------------
Using it, Digesting it, absorbing it !

the error is in bad version

you use php 4.3.10, and php5-xml will simply doesn't work with it, but i can't recommend upgrade because i had serrious problems even get it back to work with php4

yay!

thanks pablobm, I'm using Mandriva Linux 2005 LE and had the same problem. I'm also using PHP5 (at command line, type "php -v" to check).

I'm working remotely via ssh, and urpmi wasn't working properly, so I found the file at rpmfind.net and downloaded it: "wget ftp://rpmfind.net/linux/Mandrake/2006.0/i586/media/main/php-xml-5.0.4-1mdk.i586.rpm"

Note that you will also require the php-iconv module from the same location.

then I installed it with "rpm -Uvh [name of rpm]".

I restarted the server with "service httpd restart" and all is well!

[10 min later...]

Oops, spoke too soon. I was okay adding text content, but as soon as I added a page with an Only local images are allowed. tag in it, drupal barfed with the following error:
Fatal error: Call to undefined function: iconv() in /var/www/html/bikecalgary/includes/common.inc on line 1725
now what?

S

Mandriva2006 to Mandriva2007

Had the same problem upgrading from Mandriva2006 to Mandriva2007.

After installing php-xml as suggested I was still having the same warning.

After some investigation it turns out that it was php-mbstring that was missing as well.

Installed it with urpmi php-mbstring and everyhting seems normal again.

The clue for finding ths problem was in:
administer-settings-String handling.

Should have Multi-byte if php-mbstring is installed.

P.S. I have tried it without php-xml (only php-mbstring), and it was giving the same warning.
Having both php-xml and php-mbstring seem to be working.

Absolutely the same on

Absolutely the same on Mandriva 2007

Simple workaround function

If you, like me, are using php5 on a hosted site and don't have the power to install the php5-xml package, then you can get around the error using the following hack.

In includes/common.inc add this function:

function utf8_encode($s) {
  return iconv('iso-8859-1', 'utf-8', $s);
}

That will accomplish the same thing as the missing function. I suggest adding it right before the decode_entities function, since that's the one that needs it. That way if you ever get php5-xml installed you can find that addition and remove it.

In case anyone's wondering, the hack is based on this comment from the php.net documentation:
http://us3.php.net/manual/en/function.utf8-encode.php#52994

Having same problem on a

Having same problem on a fresh drupal 4.7 install

Errors seem to pop up whenever there is a request to rss.xml page.

Alternative solution -- Drupal 5.1

Thanks Jeoffw,

Your solution worked for me (I know – but I haven’t been working on it for over 18 months) and it seemed to be the cleanest solution.

I found the call to iconv() that your function uses in drupal_convert_to_utf8(), so I called that instead because it can use GNU recode or mbstring as well, so doesn’t rely on iconv.

<?php
function utf8_encode($data) {
 
drupal_convert_to_utf8($data, 'iso-8859-1');
}
?>

___________________
It’s in the detaιls…

Still true in Mandriva 2008

Just FYI, php-xml can still be missing with Mandriva 2008. URPMI php-xml, and then stop -> start apache fixed it.

nobody click here