Patch ipv6-pktinfo-and-tiny-test-fix for Sockets related Bug #64340
Patch version 2013-03-02 18:05 UTC
Return to Bug #64340 |
Download this patch
Patch Revisions:
Developer: reeze@php.net
From 28219d830fcfa66e5b734de8537627ae0d402807 Mon Sep 17 00:00:00 2001
From: Reeze Xia <reeze@php.net>
Date: Sun, 3 Mar 2013 01:13:25 +0800
Subject: [PATCH] - Fixed IPV6_PKTINFO related tests failed on OSX by explict
speicfy RFC3542 - Option SO_DEBUG didn't require root on OSX
---
ext/sockets/conversions.c | 2 +-
ext/sockets/conversions.h | 4 ++--
ext/sockets/php_sockets.h | 4 ++++
ext/sockets/tests/socket_set_option_error_socket_option.phpt | 7 ++++++-
4 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/ext/sockets/conversions.c b/ext/sockets/conversions.c
index e3ff271..6ce131e 100644
--- a/ext/sockets/conversions.c
+++ b/ext/sockets/conversions.c
@@ -1,5 +1,5 @@
-#include "sockaddr_conv.h"
#include "conversions.h"
+#include "sockaddr_conv.h"
#include "sendrecvmsg.h" /* for ancillary registry */
#ifdef PHP_WIN32
# include "windows_common.h"
diff --git a/ext/sockets/conversions.h b/ext/sockets/conversions.h
index 7d51524..82e90fc 100644
--- a/ext/sockets/conversions.h
+++ b/ext/sockets/conversions.h
@@ -3,6 +3,8 @@
#include <php.h>
+#include "php_sockets.h"
+
#ifndef PHP_WIN32
# include <netinet/in.h>
# include <sys/socket.h>
@@ -10,8 +12,6 @@
# include <Ws2tcpip.h>
#endif
-#include "php_sockets.h"
-
/* TYPE DEFINITIONS */
struct err_s {
int has_error;
diff --git a/ext/sockets/php_sockets.h b/ext/sockets/php_sockets.h
index 17abf95..a3b2959 100644
--- a/ext/sockets/php_sockets.h
+++ b/ext/sockets/php_sockets.h
@@ -24,6 +24,10 @@
/* $Id$ */
+#ifdef __APPLE__
+#define __APPLE_USE_RFC_3542
+#endif
+
#if HAVE_CONFIG_H
# include "config.h"
#endif
diff --git a/ext/sockets/tests/socket_set_option_error_socket_option.phpt b/ext/sockets/tests/socket_set_option_error_socket_option.phpt
index eaa0e64..444a6a3 100644
--- a/ext/sockets/tests/socket_set_option_error_socket_option.phpt
+++ b/ext/sockets/tests/socket_set_option_error_socket_option.phpt
@@ -5,6 +5,11 @@ Test if socket_set_option() returns 'unable to set socket option' failure for in
if (!extension_loaded('sockets')) {
die('SKIP sockets extension not available.');
}
+
+if (PHP_OS == 'Darwin') {
+ die('skip Not for OSX');
+}
+
$filename = dirname(__FILE__) . '/006_root_check.tmp';
$fp = fopen($filename, 'w');
fclose($fp);
@@ -20,7 +25,7 @@ if (!$socket) {
die('Unable to create AF_INET socket [socket]');
}
-socket_set_option( $socket, SOL_SOCKET, 1, 1);
+socket_set_option( $socket, SOL_SOCKET, SO_DEBUG, 1);
socket_close($socket);
?>
--CLEAN--
--
1.8.1.3
|