[drupal-devel] PHP string functions overloading for multibyte support

Piotr Szotkowski shot at caltha.pl
Wed May 25 12:06:27 UTC 2005


My name is Piotr Szotkowski and I'm a developer responsible for
internationalisation, and, thus, UTF-8 support in the CiviCRM module.

One of the problems I've encountered is that we'd like PHP to overload
the string manipulation functions with their multibyte counterparts
(as per [1]). Unfortunately, the overloading is possible only at the
directory level, which means we'd have to overload all of the Drupal's
calls, not only CiviCRM's ones.

After adding

php_value mbstring.func_overload 7
php_value mbstring.internal_encoding UTF-8

to the end of my /var/www/drupal/.htaccess, every
Drupal page starts with the following warning:

warning: mb_strrpos() [function.mb-strrpos]: Empty
haystack in /var/www/drupal/includes/menu.inc on line 974.

which, of course, breaks any following header() calls.

What do you think about the whole idea of forcing this overload on
Drupal? Is it feasible and I should pursuit the warning (and any other
that follow), or should I simply drop this idea, as it will break Drupal
and/or any popular modules anyway?

// We could rewrite all of our substr(), split(), strpos() calls to
// their mb_* counterparts, the catch is we'd also have to rewrite
// parts of third-party code (like Smarty), and we'd rather try the
// overloading first.

We're using CiviCRM inside Drupal 4.6.0, running on PHP 5 and Apache 2.

[1] http://www.php.net/manual/en/ref.mbstring.php#mbstring.overload

-- Shot
 Anarchism is founded on the observation that since few men are wise enough to
 rule themselves, even fewer are wise enough to rule others.   -- Edward Abbey
====================== http://shot.pl/hovercraft/ === http://shot.pl/1/125/ ===

More information about the drupal-devel mailing list