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
Posted by Renan de Lima (renanbr) on 2010-03-19T12:22:38.000+0000
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)
Posted by Satoru Yoshida (satoruyoshida) on 2010-06-09T00:30:47.000+0000
Sorry, I have been inactive since last April.
Posted by Dolf Schimmel (Freeaqingme) (freak) on 2010-06-19T18:39:19.000+0000
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
Posted by Benoît Durand (intiilapa) on 2010-09-19T05:15:43.000+0000
Why Renan has applied only modifications about constructor without add the setCharset method?
Posted by Renan de Lima (renanbr) on 2010-09-19T07:42:45.000+0000
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()
Posted by Dolf Schimmel (Freeaqingme) (freak) on 2010-09-19T11:12:45.000+0000
Issue will be implemented with ZF2. Kinda impossible with current architecture.