1--TEST-- 2imap_fetchbody() errors: ValueError and Warnings 3--EXTENSIONS-- 4imap 5--SKIPIF-- 6<?php 7require_once(__DIR__.'/setup/skipif.inc'); 8?> 9--FILE-- 10<?php 11 12require_once(__DIR__.'/setup/imap_include.inc'); 13 14$imap_mail_box = setup_test_mailbox("imapfetchbodyerrors", 0); 15 16$section = ''; 17 18try { 19 imap_fetchbody($imap_mail_box, -1, $section); 20} catch (\ValueError $e) { 21 echo $e->getMessage() . \PHP_EOL; 22} 23try { 24 imap_fetchbody($imap_mail_box, 1, $section, -1); 25} catch (\ValueError $e) { 26 echo $e->getMessage() . \PHP_EOL; 27} 28 29// Access not existing 30var_dump(imap_fetchbody($imap_mail_box, 255, $section)); 31var_dump(imap_fetchbody($imap_mail_box, 255, $section, FT_UID)); 32 33imap_close($imap_mail_box); 34 35?> 36--CLEAN-- 37<?php 38$mailbox_suffix = 'imapfetchbodyerrors'; 39require_once(__DIR__ . '/setup/clean.inc'); 40?> 41--EXPECTF-- 42Create a temporary mailbox and add 0 msgs 43New mailbox created 44imap_fetchbody(): Argument #2 ($message_num) must be greater than 0 45imap_fetchbody(): Argument #4 ($flags) must be a bitmask of FT_UID, FT_PEEK, and FT_INTERNAL 46 47Warning: imap_fetchbody(): Bad message number in %s on line %d 48bool(false) 49 50Warning: imap_fetchbody(): UID does not exist in %s on line %d 51bool(false) 52