[PEAR-BUG] Bug #21136 [Com]: Empty header value causes notice
| Newsgroups | php.pear.bugs |
|---|---|
| Message-ID | <[email protected]> |
Edit report at https://pear.php.net/bugs/bug.php?id=21136&edit=1 ID: 21136 Comment by: slgundam at gmail dot com Reported By: jorrit at ncode dot nl Summary: Empty header value causes notice Status: Open Type: Bug Package: Mail_mimeDecode Operating System: Linux Package Version: 1.5.6 PHP Version: Irrelevant Roadmap Versions: New Comment: "isset($hdr_value[0]) && " should fix this as well Previous Comments: ------------------------------------------------------------------------ [2016-10-25 03:04:21] jorrit Description: ------------ On line 492 of mimeDecode.php the first space of the header value is removed. However, I encounter mails that have an empty $hdr_value so checking $hdr_value[0] causes a 'Uninitialized string offset: 0' notice in PHP 7. The addition of a simple '!empty($hdr_value) && ' would fix this. Test script: --------------- <?php error_reporting(E_ALL | E_NOTICE); require_once 'Mail/mimeDecode.php'; $mail = 'X-TestHeader: Testbody'; $decoder = new Mail_mimeDecode($mail); $decoder->decode([]); Expected result: ---------------- No notices Actual result: -------------- The notice mentioned above. ------------------------------------------------------------------------ -- Edit this bug report at https://pear.php.net/bugs/bug.php?id=21136&edit=1