# mail() into separate extension?

- Thread: https://externals.io/message/17314
- Original archive: https://news-web.php.net/php.internals/17314
- Started by Piotr Roszatycki on 2005-07-18T13:57:23+00:00
- Messages: 5
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #17314 — Piotr Roszatycki — 2005-07-18T13:57:23+00:00

URL: https://externals.io/message/17314#17314

Hi. I'd like to see `mail()` function in separate extension module. It would be 
possible to replace i.e. standard `extension=mail.so' with i.e. 
`extension=sendmail.so'.

What do you think? Is it worth to prepare the patch?
-- 
 .''`.    Piotr Roszatycki, Netia SA
: :' :    mailto:Piotr_Roszatycki@netia.net.pl
`. `'     mailto:dexter@debian.org
  `

---

## #17315 — George Schlossnagle — 2005-07-18T14:15:37+00:00

URL: https://externals.io/message/17314#17315 · In reply to: #17314

Drop-in replacements are evil.  If you want to do this, you should  
just create a new function that does what you need to do and name it  
differently.  If you're dead-set on doing a name-based replacement,  
then you should have your extension modify the symbol table directly,  
but again, this is evil.

George



> Hi. I'd like to see `mail()` function in separate extension module.  
> It would be
> possible to replace i.e. standard `extension=mail.so' with i.e.
> `extension=sendmail.so'.
>
> What do you think? Is it worth to prepare the patch?
> -- 
>  .''`.    Piotr Roszatycki, Netia SA
> : :' :    mailto:Piotr_Roszatycki@netia.net.pl
> `. `'     mailto:dexter@debian.org
>   `-
>
> -- 
> 
> 
>
>

George Schlossnagle

-- Vice President of Engineering
-- OmniTI Computer Consulting
-- http://www.omniti.com

---

## #17316 — Andrew Yochum — 2005-07-18T14:30:43+00:00

URL: https://externals.io/message/17314#17316 · In reply to: #17315

> Drop-in replacements are evil.  If you want to do this, you should  
> just create a new function that does what you need to do and name  
> it differently.  If you're dead-set on doing a name-based  
> replacement, then you should have your extension modify the symbol  
> table directly, but again, this is evil.
>
> George

George,

Can you please substantiate your statement that drop-in replacements  
are evil?

I could only see them being a problem if they don't fully implement  
the existing API.

Andrew
--
Andrew Yochum
Plexpod
andrew@plexpod.com

---

## #17317 — George Schlossnagle — 2005-07-18T14:35:22+00:00

URL: https://externals.io/message/17314#17317 · In reply to: #17316

> 
>
>
> > […]
>
> George,
>
> Can you please substantiate your statement that drop-in  
> replacements are evil?
>
> I could only see them being a problem if they don't fully implement  
> the existing API.

Sure.  They inevitably will have differing behaviors (if not, why not  
just have a single unified function).  Given that, you'll have  
different behaviors on different machines in a way that is not  
terribly transparent to end-users.  That's evil.

Not that there's anything wrong with being evil from time to time.   
That's the reason that apd had a replace_function call for mucking  
with the symbol table.  But that's something that should be done  
locally.

George

---

## #17318 — Piotr Roszatycki — 2005-07-18T14:38:42+00:00

URL: https://externals.io/message/17314#17318 · In reply to: #17317

> Sure.  They inevitably will have differing behaviors (if not, why not
> just have a single unified function).  Given that, you'll have
> different behaviors on different machines in a way that is not
> terribly transparent to end-users.  That's evil.

In fact the replacement for `mail()` function have to be transparent for 
end-users. They won't replace manually calls for `mail()` function with i.e. 
mail_smtp() function. That is the reason I would like to replace original 
function.

-- 
 .''`.    Piotr Roszatycki, Netia SA
: :' :    mailto:Piotr_Roszatycki@netia.net.pl
`. `'     mailto:dexter@debian.org
  `
