php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch mail_skipif.patch.txt for Testing related Bug #62148

Patch version 2012-05-24 23:13 UTC

Return to Bug #62148 | Download this patch
Patch Revisions:

Developer: mattficken

--- a/ext/standard/tests/mail/mail_skipif.inc	Thu May 24 08:35:20 2012
+++ b/ext/standard/tests/mail/mail_skipif.inc	Thu May 24 15:21:13 2012
@@ -2,2 +2,12 @@
 extension_loaded('imap') or die('skip imap extension not available in this build');
+
+if( substr(PHP_OS, 0, 3) == 'WIN' && extension_loaded('sockets')) {
+	// be sure mail server is accessible... on PHP 5.3.13 release build, using test-pack PHP-5.3-r1af8b3f,
+	// the code below didn't skip test even though there was no mail server
+	//     test then failed (no mail server to test against)
+	$socket  = socket_create(AF_INET, SOCK_RAW, 1);
+	socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array('sec' => 10, 'usec' => 10));
+	// imap uses tcp port 143
+	socket_connect($socket, "localhost", 143) or die ("skip can't socket to mail server");
+}
  
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Jan 26 18:01:23 2021 UTC