Home » Mail » Mail_IMAPv2 » Bug #4264
foreach() called without argument check
Details
| Submitted | 2005-05-02 21:46 UTC |
|---|---|
| From | miker at life-captured dot com |
| Assigned | richy |
| Status | Closed |
| Package | Mail_IMAPv2 |
| PHP Version | 5.0.3 |
| OS | GNU/Linux |
| Roadmaps | (Not assigned) |
Comments
[2005-05-02 21:46 UTC] miker at life-captured dot com
Description:
------------
PHP warnings WRT invalid arguments to foreach() are thrown when I access my mailbox using MailIMAPv2.
Reproduce code:
---------------
Line 1182 (in function _getDefaultPid) is as follows:
foreach ($this->structure[$mid]['pid'] as $p => $id) {
Expected result:
----------------
I've added
if (is_array($this->structure[$mid]['pid'] {
..
}
around the aforementioned loop, and the warnings went away.
Suggest inclusion in future releases of package.
Actual result:
--------------
I get numerous occurrences of the following (using my own error-logging method):
Warning: Invalid argument supplied for foreach() in /usr/local/lib/php/Mail/IMAPv2.php on line 1182
[2005-05-03 18:16 UTC] miker at life-captured dot com
Message (w/ audio content) has generated by our system and sent to myself and demo@smilingsouls.net.
Hope it contains helpful information. :)
[2005-05-03 18:25 UTC] miker at life-captured dot com
Here's a dump of a partial context, as generated by my error handler. MailConnection is my own structure, encapsulating the Mail_IMAPv2 object (among other things).
[MailConnection] => Mail_IMAPv2 Object
(
[error] => PEAR_ErrorStack Object
(
[_errors] => Array
(
)
[_errorsByLevel] => Array
(
)
[_package] => Mail_IMAPv2
[_compat] =>
[_msgCallback] => Array
(
[0] => PEAR_ErrorStack Object
*RECURSION*
[1] => getErrorMessage
)
[_contextCallback] => Array
(
[0] => PEAR_ErrorStack Object
*RECURSION*
[1] => getFileLine
)
[_errorCallback] => Array
(
)
[_logger] =>
[_errorMsgs] => Array
(
)
)
[mailbox] => Resource id #35
[mailboxInfo] => Array
(
[Mail_IMAPv2] => Array
(
[version] => Mail_IMAPv2 0.1.0 Beta
)
[host] => {myhost.foobar.com:143/imap}
[folder] => INBOX
[user] => someuser@myhost.com
)
[option] => Array
(
[fetchbody] => 2
[body] => 2
)
[structure] => Array
(
[1] => Array
(
[pid] => 0
)
)
[msg] => Array
(
)
[header] => Array
(
)
[_dataTypes] => Array
(
[0] => text
[1] => multipart
[2] => message
[3] => application
[4] => audio
[5] => image
[6] => video
[7] => other
)
[_encodingTypes] => Array
(
[0] => 7bit
[1] => 8bit
[2] => binary
[3] => base64
[4] => quoted-printable
[5] => other
)
[fields] => Array
(
[0] => fname
[1] => pid
[2] => ftype
[3] => fsize
[4] => has_at
[5] => charset
[6] => cid
)
)