ZF-9483: Zend_Mail charset configuration

Description

Zend_Mail constructor sets charset value from passed argument. This is not a problem, but there is no way to set it after you have an object of this class, there is no a setCharset(), but it still is not a problem.

The constructor has one argument, this one has as default value "iso-8859-1", it does not look good. The construct method also makes hard to extends the class and to overwrite it, once this not follow the code standard, users must send default charset encoding to parent constructor.

http://framework.zend.com/wiki/display/…

Sample


class My_Mail extends Zend_Mail
{
    public function __construct()
    {
        // do something...
    }
}

$mail = new My_Mail();

or


class My_Mail extends Zend_Mail
{
    public function __construct($charset = null)
    {
        // do something...
        parent::__construct($charset);
    }
}

$mail = new My_Mail();

Expected result


$mail->_charset; // "iso-8859-1"

Actual result


$mail->_charset; // null

Comments

attached is test file and Zend_Mail class with changes: default value for $_charset attribute, default value of constructor argument and setCharset() method (ps: i haven't run the test)

Sorry, I have been inactive since last April.

Reopening because tests have not been applied yet. Also; this will not be released in a mini release because this in specific circumstances may be a BC break

Why Renan has applied only modifications about constructor without add the setCharset method?

Benoit, Freeaqingme has assign this issue to himself to fix something. Actually the issue is about constructor problem, anyway i think we should add setCharset() to Zend_Mail class.

There are some issues that could be affected, see ZF-4955 ZF-9990

+1 for adding setCharset()

Issue will be implemented with ZF2. Kinda impossible with current architecture.