unbreak build with php-5.6

ok aja@
This commit is contained in:
robert 2015-06-05 05:58:34 +00:00
parent 8cf6099e62
commit 42c24c50e2
2 changed files with 45 additions and 1 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.34 2014/11/06 17:13:39 sthen Exp $
# $OpenBSD: Makefile,v 1.35 2015/06/05 05:58:34 robert Exp $
MULTI_PACKAGES= -utils -main -php -perl
SHARED_ONLY= Yes
@ -16,6 +16,7 @@ PKGNAME-utils= mapserver-utils-${V}
PKGNAME-php= php-mapscript-${V}
PKGNAME-perl= p5-mapscript-${V}
SHARED_LIBS += mapserver 1.0
REVISION-php= 0
CATEGORIES= geo www

View File

@ -0,0 +1,43 @@
$OpenBSD: patch-mapscript_php_owsrequest_c,v 1.1 2015/06/05 05:58:34 robert Exp $
--- mapscript/php/owsrequest.c.orig Thu Jan 2 13:41:49 2014
+++ mapscript/php/owsrequest.c Thu Jun 4 20:22:17 2015
@@ -32,6 +32,9 @@
#include "php_mapscript.h"
#include "SAPI.h"
#include "php_variables.h"
+#if PHP_VERSION_ID >= 50600
+#include "php_streams.h"
+#endif
char *owsrequest_getenv(const char *name, void *thread_context);
@@ -193,9 +196,29 @@ PHP_METHOD(OWSRequestObj, loadParams)
cgirequestObj_loadParams(php_owsrequest->cgirequest, owsrequest_getenv, NULL, 0, thread_context);
}
} else {
+#if PHP_VERSION_ID >= 50600
+ php_stream *s = php_stream_temp_new();
+ php_stream *input = php_stream_open_wrapper("php://input", "r", 0, NULL);
+
+ /* php://input does not support stat */
+ php_stream_copy_to_stream_ex(input, s, -1, NULL);
+ php_stream_close(input);
+
+ php_stream_rewind(s);
+
+ char *raw_post_data = NULL;
+ long raw_post_data_length = 0;
+
+ raw_post_data_length = php_stream_copy_to_mem(s, raw_post_data, -1, 0);
+
cgirequestObj_loadParams(php_owsrequest->cgirequest, owsrequest_getenv,
+ raw_post_data,
+ raw_post_data_length, thread_context);
+#else
+ cgirequestObj_loadParams(php_owsrequest->cgirequest, owsrequest_getenv,
SG(request_info).raw_post_data,
SG(request_info).raw_post_data_length, thread_context);
+#endif
}
}