Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:15808 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68572 invoked by uid 1010); 5 Apr 2005 08:56:10 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 68557 invoked by uid 1007); 5 Apr 2005 08:56:10 -0000 Message-ID: <20050405085610.68556.qmail@lists.php.net> To: internals@lists.php.net Date: Tue, 05 Apr 2005 10:52:05 +0200 References: <200504050956.47234.Piotr_Roszatycki@netia.net.pl> Lines: 37 User-Agent: KNode/0.9.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8Bit X-Posted-By: 62.138.229.210 Subject: Re: Is it possible to override internal function? From: johannes@php.net (Johannes Schlueter) Hi, the funxtions are stored in the EG(function_table) hash table. So you could delete or rename the mail function from there and add a new one. APD has an override_function() and a rename_function() which can be used to replace/rename a function by a user defined one. Maybe the code of these help you a bit. http://lxr.php.net/source/pecl/apd/php_apd.c#608 For this being successfull it's important that your extension is loaded after the standard extension. Even though this works I doubt that you can can rely on it. (stability, changing APIs, ...) johannes Piotr Roszatycki wrote: > I'd like to create PECL module which could replace mail() function. The > new function would use SMTP protocol. I can't call any external utilities > so this is the only posibility to send the mails. The environment is > shared hosting platform so there are some limits, like forbidding the > calling suid-ed binaries (like /usr/sbin/sendmail) and low number of user > processes. > > This have to be hidden implementation so the users won't need to change > their code, especially calling of mail() function. > > Is it possible to override the internal function in additional module? > -- Johannes Schlüter Mayflower GmbH / ThinkPHP http://thinkphp.de http://blog.thinkphp.de