{"action":"created","issue":{"url":"https://api.github.com/repos/zendframework/zend-mail/issues/33","labels_url":"https://api.github.com/repos/zendframework/zend-mail/issues/33/labels{/name}","comments_url":"https://api.github.com/repos/zendframework/zend-mail/issues/33/comments","events_url":"https://api.github.com/repos/zendframework/zend-mail/issues/33/events","html_url":"https://github.com/zendframework/zend-mail/issues/33","id":115307028,"number":33,"title":"\\Zend\\Mail\\Storage\\Imap Header value must be composed of printable US-ASCII characters and valid folding sequences.","user":{"login":"Nirzol","id":1618033,"avatar_url":"https://avatars.githubusercontent.com/u/1618033?v=3","gravatar_id":"","url":"https://api.github.com/users/Nirzol","html_url":"https://github.com/Nirzol","followers_url":"https://api.github.com/users/Nirzol/followers","following_url":"https://api.github.com/users/Nirzol/following{/other_user}","gists_url":"https://api.github.com/users/Nirzol/gists{/gist_id}","starred_url":"https://api.github.com/users/Nirzol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nirzol/subscriptions","organizations_url":"https://api.github.com/users/Nirzol/orgs","repos_url":"https://api.github.com/users/Nirzol/repos","events_url":"https://api.github.com/users/Nirzol/events{/privacy}","received_events_url":"https://api.github.com/users/Nirzol/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-05T15:23:45Z","updated_at":"2016-01-01T14:30:29Z","closed_at":null,"body":"I have an other issue : \r\n```php\r\n        $mail = new \\Zend\\Mail\\Storage\\Imap(array('host' => 'myhost',\r\n            'user' => 'mylogin',\r\n            'password' => 'mypassword'));\r\n$mail->getMessage(194)\r\n```\r\nFrom debug : \r\n```php\r\n( ! ) Notice: iconv_mime_encode(): Unknown error (7) in .../vendor/zendframework/zend-mail/src/Header/HeaderWrap.php on line 119\r\nCall Stack\r\n#\tTime\tMemory\tFunction\tLocation\r\n1\t0.0025\t241792\t{main}( )\t.../index.php:0\r\n2\t0.4338\t5131376\tZend\\Mvc\\Application->run( )\t.../index.php:17\r\n3\t0.6873\t5857424\tZend\\EventManager\\EventManager->trigger( )\t.../Application.php:314\r\n4\t0.6873\t5857472\tZend\\EventManager\\EventManager->triggerListeners( )\t.../EventManager.php:205\r\n5\t0.6886\t5865392\tcall_user_func:{/.../vendor/zendframework/zend-eventmanager/src/EventManager.php:444} ( )\t.../EventManager.php:444\r\n6\t0.6886\t5865888\tZend\\Mvc\\DispatchListener->onDispatch( )\t.../EventManager.php:444\r\n7\t0.6921\t5911392\tZend\\Mvc\\Controller\\AbstractController->dispatch( )\t.../DispatchListener.php:93\r\n8\t0.6922\t5911856\tZend\\EventManager\\EventManager->trigger( )\t.../AbstractController.php:118\r\n9\t0.6922\t5911904\tZend\\EventManager\\EventManager->triggerListeners( )\t.../EventManager.php:205\r\n10\t0.6939\t5927832\tcall_user_fun:{.../vendor/zendframework/zend-eventmanager/src/EventManager.php:444} ( )\t.../EventManager.php:444\r\n11\t0.6939\t5927960\tZend\\Mvc\\Controller\\AbstractActionController->onDispatch( )\t.../EventManager.php:444\r\n12\t0.6940\t5928152\t...\\IndexController->indexAction( )\t.../AbstractActionController.php:82\r\n13\t1.2227\t5997920\tZend\\Mail\\Storage\\Imap->getMessage( )\t.../IndexController.php:58\r\n14\t1.2503\t6042432\tZend\\Mail\\Storage\\Message->__construct( )\t.../Imap.php:118\r\n15\t1.2503\t6042944\tZend\\Mail\\Storage\\Part->__construct( )\t.../Message.php:54\r\n16\t1.2512\t6047184\tZend\\Mime\\Decode::splitMessage( )\t.../Part.php:106\r\n17\t1.2542\t6132128\tZend\\Mail\\Headers::fromString( )\t.../Decode.php:141\r\n18\t1.2852\t6191952\tZend\\Mail\\Headers->addHeaderLine( )\t.../Headers.php:95\r\n19\t1.2852\t6192000\tZend\\Mail\\Header\\GenericHeader::fromString( )\t.../Headers.php:231\r\n20\t1.2935\t6193568\tZend\\Mail\\Header\\GenericHeader->__construct( )\t.../GenericHeader.php:37\r\n21\t1.2936\t6193648\tZend\\Mail\\Header\\GenericHeader->setFieldValue( )\t.../GenericHeader.php:83\r\n22\t1.2936\t6194856\tZend\\Mail\\Header\\HeaderWrap::canBeEncoded( )\t.../GenericHeader.php:129\r\n23\t1.2936\t6195304\ticonv_mime_encode ( )\t.../HeaderWrap.php:119\r\n```\r\n\r\nFrom zf trace\r\n```php\r\nMessage:\r\nHeader value must be composed of printable US-ASCII characters and valid folding sequences.\r\nPile d'exécution:\r\n#0 .../vendor/zendframework/zend-mail/src/Header/GenericHeader.php(83): Zend\\Mail\\Header\\GenericHeader->setFieldValue('ELIE Caroline <...')\r\n#1 .../vendor/zendframework/zend-mail/src/Header/GenericHeader.php(37): Zend\\Mail\\Header\\GenericHeader->__construct('To', 'ELIE Caroline <...')\r\n#2 .../vendor/zendframework/zend-mail/src/Headers.php(231): Zend\\Mail\\Header\\GenericHeader::fromString('To: ELIE Caroli...')\r\n#3 .../vendor/zendframework/zend-mail/src/Headers.php(95): Zend\\Mail\\Headers->addHeaderLine('To: ELIE Caroli...')\r\n#4 .../vendor/zendframework/zend-mime/src/Decode.php(141): Zend\\Mail\\Headers::fromString('MIME-Version: 1...', '\\n')\r\n#5 .../vendor/zendframework/zend-mail/src/Storage/Part.php(106): Zend\\Mime\\Decode::splitMessage('MIME-Version: 1...', 'MIME-Version: 1...', '')\r\n#6 .../vendor/zendframework/zend-mail/src/Storage/Message.php(54): Zend\\Mail\\Storage\\Part->__construct(Array)\r\n#7 .../vendor/zendframework/zend-mail/src/Storage/Imap.php(118): Zend\\Mail\\Storage\\Message->__construct(Array)\r\n#8 .../module/Ent/src/Ent/Controller/IndexController.php(58): Zend\\Mail\\Storage\\Imap->getMessage(194)\r\n#9 .../vendor/zendframework/zend-mvc/src/Controller/AbstractActionController.php(82): Ent\\Controller\\IndexController->indexAction()\r\n#10 [internal function]: Zend\\Mvc\\Controller\\AbstractActionController->onDispatch(Object(Zend\\Mvc\\MvcEvent))\r\n#11 .../vendor/zendframework/zend-eventmanager/src/EventManager.php(444): call_user_func(Array, Object(Zend\\Mvc\\MvcEvent))\r\n#12 .../vendor/zendframework/zend-eventmanager/src/EventManager.php(205): Zend\\EventManager\\EventManager->triggerListeners('dispatch', Object(Zend\\Mvc\\MvcEvent), Object(Closure))\r\n#13 .../vendor/zendframework/zend-mvc/src/Controller/AbstractController.php(118): Zend\\EventManager\\EventManager->trigger('dispatch', Object(Zend\\Mvc\\MvcEvent), Object(Closure))\r\n#14 .../vendor/zendframework/zend-mvc/src/DispatchListener.php(93): Zend\\Mvc\\Controller\\AbstractController->dispatch(Object(Zend\\Http\\PhpEnvironment\\Request), Object(Zend\\Http\\PhpEnvironment\\Response))\r\n#15 [internal function]: Zend\\Mvc\\DispatchListener->onDispatch(Object(Zend\\Mvc\\MvcEvent))\r\n#16 .../vendor/zendframework/zend-eventmanager/src/EventManager.php(444): call_user_func(Array, Object(Zend\\Mvc\\MvcEvent))\r\n#17 .../vendor/zendframework/zend-eventmanager/src/EventManager.php(205): Zend\\EventManager\\EventManager->triggerListeners('dispatch', Object(Zend\\Mvc\\MvcEvent), Object(Closure))\r\n#18 .../vendor/zendframework/zend-mvc/src/Application.php(314): Zend\\EventManager\\EventManager->trigger('dispatch', Object(Zend\\Mvc\\MvcEvent), Object(Closure))\r\n#19 .../public/index.php(17): Zend\\Mvc\\Application->run()\r\n#20 {main}\r\n```"},"comment":{"url":"https://api.github.com/repos/zendframework/zend-mail/issues/comments/168310973","html_url":"https://github.com/zendframework/zend-mail/issues/33#issuecomment-168310973","issue_url":"https://api.github.com/repos/zendframework/zend-mail/issues/33","id":168310973,"user":{"login":"steffenweber","id":1138129,"avatar_url":"https://avatars.githubusercontent.com/u/1138129?v=3","gravatar_id":"","url":"https://api.github.com/users/steffenweber","html_url":"https://github.com/steffenweber","followers_url":"https://api.github.com/users/steffenweber/followers","following_url":"https://api.github.com/users/steffenweber/following{/other_user}","gists_url":"https://api.github.com/users/steffenweber/gists{/gist_id}","starred_url":"https://api.github.com/users/steffenweber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steffenweber/subscriptions","organizations_url":"https://api.github.com/users/steffenweber/orgs","repos_url":"https://api.github.com/users/steffenweber/repos","events_url":"https://api.github.com/users/steffenweber/events{/privacy}","received_events_url":"https://api.github.com/users/steffenweber/received_events","type":"User","site_admin":false},"created_at":"2016-01-01T14:30:29Z","updated_at":"2016-01-01T14:30:29Z","body":"Reduced test-case:\r\n```\r\n$mail = new \\Zend\\Mail\\Message();\r\n$mail->setSubject('xxxxxxxxxxxxxxxxx xxxxxxxü');\r\n```\r\n\r\nError message:\r\n```\r\nNotice: iconv_mime_encode(): Unknown error (7) in vendor/zendframework/zend-mail/src/Header/HeaderWrap.php on line 119\r\nFatal error: Uncaught exception 'Zend\\Mail\\Header\\Exception\\InvalidArgumentException' with message 'Subject value must be composed of printable US-ASCII or UTF-8 characters.' in vendor/zendframework/zend-mail/src/Header/Subject.php:84\r\n```\r\n\r\nRelated PHP bug: https://bugs.php.net/bug.php?id=53891\r\n\r\nUsing the given test string \"xxxxxxxxxxxxxxxxx xxxxxxxü\", `iconv_mime_encode()` fails for the following `line-length` values: 36, 40, 76. Just setting `line-length` to PHP_INT_MAX causes an out-of-memory error. Maybe it could be set to some multiple of the string length.\r\n\r\neZMail was affected by this bug, too: https://jira.ez.no/browse/EZP-21567\r\n\r\nTheir workaround is a fallback to `mb_encode_mimeheader()`: https://github.com/zetacomponents/Mail/pull/8\r\n\r\n"}}