Bug #21136 [Com]: Empty header value causes notice

From: Date: Wed, 21 Feb 2018 19:53:22 +0000
Subject: Bug #21136 [Com]: Empty header value causes notice
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-11417@lists.php.net to get a copy of this message
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

« previous php.pear.bugs (#11417) next »