Skip to content

Conversation

@maratth
Copy link
Contributor

@maratth maratth commented Dec 1, 2017

Add getter/setter for transferEncoding and modify the _getContentTranferEncoding for use transferEncoding if is set.

Write test in EmailTest for check it.

* @param string|null $encoding Encoding set.
* @return $this
*/
public function setTransferEncoding($encoding) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opening brace should be on a new line

*
* @return string|null Encoding
*/
public function getTransferEncoding() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opening brace should be on a new line

*
* @return string
*/
public function getContentTransferEncoding() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opening brace should be on a new line

*
* @return void
*/
public function testTransferEncoding(){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opening brace should be on a new line

public function testTransferEncoding(){
// Test new transfer encoding
$this->Email->setTransferEncoding('quoted-printable');
$this->assertSame($this->Email->getTransferEncoding(), 'quoted-printable');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Order is wrong, should be: expected, result.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum, sorry i fix this in #a006420
But i see, the tests above have the same issue.

*
* @var string|null
*/
public $transferEncoding;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to add another public properties and a pair of getter/setter for that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think no, but i follow what was done.
You can see the charset or headerCharset properties.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are public for BC reasons I suppose. I think we can make the new property protected.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah the property should be protected.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok i fix it

@codecov-io
Copy link

codecov-io commented Dec 1, 2017

Codecov Report

Merging #11488 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #11488      +/-   ##
============================================
+ Coverage     93.37%   93.39%   +0.01%     
- Complexity    13015    13019       +4     
============================================
  Files           436      436              
  Lines         32751    32765      +14     
============================================
+ Hits          30582    30600      +18     
+ Misses         2169     2165       -4
Impacted Files Coverage Δ Complexity Δ
src/Mailer/Email.php 97.26% <100%> (+0.04%) 332 <3> (+4) ⬆️
src/Cache/Engine/FileEngine.php 90.1% <0%> (+1.09%) 73% <0%> (ø) ⬇️
src/Cache/CacheEngine.php 93.47% <0%> (+2.17%) 19% <0%> (ø) ⬇️
src/Cache/CacheRegistry.php 100% <0%> (+4.16%) 11% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d7cf3e7...3a75517. Read the comment docs.

*/
public function setTransferEncoding($encoding)
{
$this->transferEncoding = $encoding;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we validate that for a valid/known transfer encoding?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know all content transfer encoding. But I found this.
I understand that there is BASE64 / QUOTED-PRINTABLE / 8BIT / 7BIT / BINARY / x-token but I'm not sure, I'm not a expert.

If you think is good, I can implement it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think checking the standard types (not x-token) is a good place to start.

@markstory markstory self-assigned this Dec 1, 2017
@markstory markstory added this to the 3.5.7 milestone Dec 1, 2017
@maratth
Copy link
Contributor Author

maratth commented Dec 1, 2017

Is possible add this pull request for cakephp v3.4.x or is only for 3.5.x ?

@markstory
Copy link
Member

Is possible add this pull request for cakephp v3.4.x or is only for 3.5.x ?

We're only doing security fixes for 3.4 at this point in time. The upgrade from 3.4 to 3.5 should be pretty painless if you need this in your app.

* @param string|null $encoding Encoding set.
* @return $this
*/
public function setTransferEncoding($encoding)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be handling encoding the message based on the indicated transfer encoding? Right now someone could set the transfer encoding to base64, but the email message will still be in 8bit (generally).

Copy link
Contributor Author

@maratth maratth Dec 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think they are two different parts. I don't know if have a link between transfer encoding and message encoding.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

@markstory markstory modified the milestones: 3.5.7, 3.5.8 Dec 6, 2017
@markstory markstory merged commit e7f5da5 into cakephp:master Dec 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants