cvs: php4 /ext/mbstring mbstring.c mbstring.h

From: Date: Sun, 16 Dec 2001 22:58:24 +0000
Subject: cvs: php4 /ext/mbstring mbstring.c mbstring.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-8685@lists.php.net to get a copy of this message
hirokawa Sun Dec 16 17:58:24 2001 EDT Modified files: /php4/ext/mbstring mbstring.c mbstring.h Log: added an option mbstring.func_overload to overload some function by multibyte enabled version of function in mbstring. Index: php4/ext/mbstring/mbstring.c diff -u php4/ext/mbstring/mbstring.c:1.34 php4/ext/mbstring/mbstring.c:1.35 --- php4/ext/mbstring/mbstring.c:1.34 Tue Dec 11 10:29:50 2001 +++ php4/ext/mbstring/mbstring.c Sun Dec 16 17:58:24 2001 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mbstring.c,v 1.34 2001/12/11 15:29:50 sebastian Exp $ */ +/* $Id: mbstring.c,v 1.35 2001/12/16 22:58:24 hirokawa Exp $ */ /* * PHP4 Multibyte String module "mbstring" (currently only for Japanese) @@ -373,11 +373,12 @@ /* php.ini directive registration */ PHP_INI_BEGIN() - PHP_INI_ENTRY("mbstring.detect_order", NULL, PHP_INI_ALL, OnUpdate_mbstring_detect_order) - PHP_INI_ENTRY("mbstring.http_input", NULL, PHP_INI_ALL, OnUpdate_mbstring_http_input) - PHP_INI_ENTRY("mbstring.http_output", NULL, PHP_INI_ALL, OnUpdate_mbstring_http_output) - PHP_INI_ENTRY("mbstring.internal_encoding", NULL, PHP_INI_ALL, OnUpdate_mbstring_internal_encoding) - PHP_INI_ENTRY("mbstring.substitute_character", NULL, PHP_INI_ALL, OnUpdate_mbstring_substitute_character) + PHP_INI_ENTRY("mbstring.detect_order", NULL, PHP_INI_ALL, OnUpdate_mbstring_detect_order) + PHP_INI_ENTRY("mbstring.http_input", NULL, PHP_INI_ALL, OnUpdate_mbstring_http_input) + PHP_INI_ENTRY("mbstring.http_output", NULL, PHP_INI_ALL, OnUpdate_mbstring_http_output) + PHP_INI_ENTRY("mbstring.internal_encoding", NULL, PHP_INI_ALL, OnUpdate_mbstring_internal_encoding) + PHP_INI_ENTRY("mbstring.substitute_character", NULL, PHP_INI_ALL, OnUpdate_mbstring_substitute_character) + STD_PHP_INI_ENTRY("mbstring.func_overload", "0", PHP_INI_SYSTEM, OnUpdateInt, func_overload, zend_mbstring_globals, mbstring_globals) PHP_INI_END() @@ -406,6 +407,8 @@ pglobals->filter_illegal_substchar = 0x3f; /* '?' */ pglobals->current_filter_illegal_mode = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; pglobals->current_filter_illegal_substchar = 0x3f; /* '?' */ + pglobals->func_overload = 0; + pglobals->orig_mail = (zend_function *)NULL; pglobals->outconv = NULL; } @@ -466,6 +469,18 @@ n--; } } + + /* override original mail() function with mb_send_mail(). */ + if ((MBSTRG(func_overload) & MB_OVERLOAD_MAIL) == MB_OVERLOAD_MAIL && + !MBSTRG(orig_mail)){ + zend_hash_find(EG(function_table), "mb_send_mail", sizeof("mb_send_mail"), (void **)&func); + zend_hash_find(EG(function_table), "mail", sizeof("mail"), (void **)&MBSTRG(orig_mail)); + if (zend_hash_del(EG(function_table), "mail",sizeof("mail")) != FAILURE) { + zend_hash_add(EG(function_table), "mail",sizeof("mail"),func, sizeof(zend_function), NULL); + } else { + zend_error(E_ERROR, "mbtring couldn't replace mail()."); + } + } return SUCCESS; } Index: php4/ext/mbstring/mbstring.h diff -u php4/ext/mbstring/mbstring.h:1.8 php4/ext/mbstring/mbstring.h:1.9 --- php4/ext/mbstring/mbstring.h:1.8 Tue Dec 11 10:29:50 2001 +++ php4/ext/mbstring/mbstring.h Sun Dec 16 17:58:24 2001 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mbstring.h,v 1.8 2001/12/11 15:29:50 sebastian Exp $ */ +/* $Id: mbstring.h,v 1.9 2001/12/16 22:58:24 hirokawa Exp $ */ /* * PHP4 Multibyte String module "mbstring" (currently only for Japanese) @@ -55,6 +55,8 @@ #include "mbfilter.h" +#define MB_OVERLOAD_MAIL 1 + extern zend_module_entry mbstring_module_entry; #define mbstring_module_ptr &mbstring_module_entry @@ -113,6 +115,8 @@ int filter_illegal_substchar; int current_filter_illegal_mode; int current_filter_illegal_substchar; + int func_overload; + zend_function *orig_mail; mbfl_buffer_converter *outconv; ZEND_END_MODULE_GLOBALS(mbstring);

« previous php.cvs (#8685) next »