Re: Is it possible to override internal function?

From: Date: Tue, 05 Apr 2005 08:52:05 +0000
Subject: Re: Is it possible to override internal function?
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-15808@lists.php.net to get a copy of this message
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

« previous php.internals (#15808) next »