[mapserver-commits] r9180 - in branches/branch-5-4/mapserver: .
mapscript/php3
svn at osgeo.org
svn at osgeo.org
Fri Jul 17 10:23:42 EDT 2009
Author: aboudreault
Date: 2009-07-17 10:23:42 -0400 (Fri, 17 Jul 2009)
New Revision: 9180
Modified:
branches/branch-5-4/mapserver/HISTORY.TXT
branches/branch-5-4/mapserver/configure
branches/branch-5-4/mapserver/configure.in
branches/branch-5-4/mapserver/mapregex.c
branches/branch-5-4/mapserver/mapregex.h
branches/branch-5-4/mapserver/mapscript/php3/Makefile.in
branches/branch-5-4/mapserver/mapscript/php3/php_mapscript_util.h
branches/branch-5-4/mapserver/mapscript/php3/php_regex.c
Log:
backporting support for PHP 5.3 in branch-5-4
Modified: branches/branch-5-4/mapserver/HISTORY.TXT
===================================================================
--- branches/branch-5-4/mapserver/HISTORY.TXT 2009-07-17 13:45:52 UTC (rev 9179)
+++ branches/branch-5-4/mapserver/HISTORY.TXT 2009-07-17 14:23:42 UTC (rev 9180)
@@ -14,6 +14,8 @@
Current Version:
----------------
+- Fixed PHP/Mapscript to support PHP 5.3 (#3065, #3066)
+
- New fix for incomplete CVE-2009-0840 security fix made in 5.4.0 (#2943)
- Add centroid geomtransform (#2825)
Modified: branches/branch-5-4/mapserver/configure
===================================================================
--- branches/branch-5-4/mapserver/configure 2009-07-17 13:45:52 UTC (rev 9179)
+++ branches/branch-5-4/mapserver/configure 2009-07-17 14:23:42 UTC (rev 9180)
@@ -12931,17 +12931,27 @@
test -f "$PHP_SRC_DIR/regex/regex_extra.h" && PHP_NO_SOURCE="1"
if test -n "$PHP_NO_SOURCE" ; then
USE_PHP_REGEX="-DUSE_PHP_REGEX"
+ PHP_REGEX_INC="$PHP_SRC_DIR/"
PHP_REGEX_OBJ=php_regex.o
{ echo "$as_me:$LINENO: result: found regex_extra.h - building PHP MapScript with PHP's bundled regex " >&5
echo "${ECHO_T} found regex_extra.h - building PHP MapScript with PHP's bundled regex " >&6; }
else
- { { echo "$as_me:$LINENO: error:
-!!! PHP uses its bundled regex library but regex/regex_extra.h cannot be !!!
-!!! found. !!!" >&5
+ test -f "$PHP_SRC_DIR/ext/ereg/regex/regex.h" && PHP_NO_SOURCE="1"
+ if test -n "$PHP_NO_SOURCE" ; then
+ USE_PHP_REGEX="-DUSE_PHP_REGEX"
+ PHP_REGEX_INC="$PHP_SRC_DIR/ext/ereg/"
+ PHP_REGEX_OBJ=php_regex.o
+ { echo "$as_me:$LINENO: result: found regex.h - building PHP MapScript with PHP's bundled regex " >&5
+echo "${ECHO_T} found regex.h - building PHP MapScript with PHP's bundled regex " >&6; }
+ else
+ { { echo "$as_me:$LINENO: error:
+!!! PHP uses its bundled regex library but regex/regex_extra.h (PHP <=5.2) or !!!
+!!! ext/ereg/regex/regex.h (PHP >=5.3) cannot be found. !!!" >&5
echo "$as_me: error:
-!!! PHP uses its bundled regex library but regex/regex_extra.h cannot be !!!
-!!! found. !!!" >&2;}
+!!! PHP uses its bundled regex library but regex/regex_extra.h (PHP <=5.2) or !!!
+!!! ext/ereg/regex/regex.h (PHP >=5.3) cannot be found. !!!" >&2;}
{ (exit 1); exit 1; }; }
+ fi
fi
else
Modified: branches/branch-5-4/mapserver/configure.in
===================================================================
--- branches/branch-5-4/mapserver/configure.in 2009-07-17 13:45:52 UTC (rev 9179)
+++ branches/branch-5-4/mapserver/configure.in 2009-07-17 14:23:42 UTC (rev 9180)
@@ -2347,12 +2347,23 @@
if test -n "$PHP_NO_SOURCE" ; then
dnl Found regex_extra.h
USE_PHP_REGEX="-DUSE_PHP_REGEX"
+ PHP_REGEX_INC="$PHP_SRC_DIR/"
PHP_REGEX_OBJ=php_regex.o
AC_MSG_RESULT([ found regex_extra.h - building PHP MapScript with PHP's bundled regex ])
else
- AC_MSG_ERROR([
-!!! PHP uses its bundled regex library but regex/regex_extra.h cannot be !!!
-!!! found. !!!])
+ dnl PHP 5.3 changed the layout of regex-related files.
+ test -f "$PHP_SRC_DIR/ext/ereg/regex/regex.h" && PHP_NO_SOURCE="1"
+ if test -n "$PHP_NO_SOURCE" ; then
+ dnl Found regex.h
+ USE_PHP_REGEX="-DUSE_PHP_REGEX"
+ PHP_REGEX_INC="$PHP_SRC_DIR/ext/ereg/"
+ PHP_REGEX_OBJ=php_regex.o
+ AC_MSG_RESULT([ found regex.h - building PHP MapScript with PHP's bundled regex ])
+ else
+ AC_MSG_ERROR([
+!!! PHP uses its bundled regex library but regex/regex_extra.h (PHP <=5.2) or !!!
+!!! ext/ereg/regex/regex.h (PHP >=5.3) cannot be found. !!!])
+ fi
fi
else
Modified: branches/branch-5-4/mapserver/mapregex.c
===================================================================
--- branches/branch-5-4/mapserver/mapregex.c 2009-07-17 13:45:52 UTC (rev 9179)
+++ branches/branch-5-4/mapserver/mapregex.c 2009-07-17 14:23:42 UTC (rev 9180)
@@ -52,7 +52,7 @@
#include "mapregex.h"
#include <regex.h>
-API_EXPORT(int) ms_regcomp(ms_regex_t *regex, const char *expr, int cflags)
+MS_API_EXPORT(int) ms_regcomp(ms_regex_t *regex, const char *expr, int cflags)
{
/* Must free in regfree() */
regex_t* sys_regex = (regex_t*) malloc(sizeof(regex_t));
@@ -60,12 +60,12 @@
return regcomp(sys_regex, expr, cflags);
}
-API_EXPORT(size_t) ms_regerror(int errcode, const ms_regex_t *regex, char *errbuf, size_t errbuf_size)
+MS_API_EXPORT(size_t) ms_regerror(int errcode, const ms_regex_t *regex, char *errbuf, size_t errbuf_size)
{
return regerror(errcode, (regex_t*)(regex->sys_regex), errbuf, errbuf_size);
}
-API_EXPORT(int) ms_regexec(const ms_regex_t *regex, const char *string, size_t nmatch, ms_regmatch_t pmatch[], int eflags)
+MS_API_EXPORT(int) ms_regexec(const ms_regex_t *regex, const char *string, size_t nmatch, ms_regmatch_t pmatch[], int eflags)
{
/*This next line only works because we know that regmatch_t
and ms_regmatch_t are exactly alike (POSIX STANDARD)*/
@@ -74,7 +74,7 @@
(regmatch_t*) pmatch, eflags);
}
-API_EXPORT(void) ms_regfree(ms_regex_t *regex)
+MS_API_EXPORT(void) ms_regfree(ms_regex_t *regex)
{
regfree((regex_t*)(regex->sys_regex));
free(regex->sys_regex);
Modified: branches/branch-5-4/mapserver/mapregex.h
===================================================================
--- branches/branch-5-4/mapserver/mapregex.h 2009-07-17 13:45:52 UTC (rev 9179)
+++ branches/branch-5-4/mapserver/mapregex.h 2009-07-17 14:23:42 UTC (rev 9180)
@@ -37,9 +37,11 @@
/* We want these to match the POSIX standard, so we need these*/
/* === regex2.h === */
#ifdef WIN32
-#define API_EXPORT(type) __declspec(dllexport) type __stdcall
+#define MS_API_EXPORT(type) __declspec(dllexport) type __stdcall
+#elif defined(__GNUC__) && __GNUC__ >= 4
+#define MS_API_EXPORT(type) __attribute__ ((visibility("default"))) type
#else
-#define API_EXPORT(type) type
+#define MS_API_EXPORT(type) type
#endif
typedef struct {
@@ -53,10 +55,10 @@
ms_regoff_t rm_eo; /* Byte offset from string's start to substring's end. */
} ms_regmatch_t;
- API_EXPORT(int) ms_regcomp(ms_regex_t *, const char *, int);
- API_EXPORT(size_t) ms_regerror(int, const ms_regex_t *, char *, size_t);
- API_EXPORT(int) ms_regexec(const ms_regex_t *, const char *, size_t, ms_regmatch_t [], int);
- API_EXPORT(void) ms_regfree(ms_regex_t *);
+ MS_API_EXPORT(int) ms_regcomp(ms_regex_t *, const char *, int);
+ MS_API_EXPORT(size_t) ms_regerror(int, const ms_regex_t *, char *, size_t);
+ MS_API_EXPORT(int) ms_regexec(const ms_regex_t *, const char *, size_t, ms_regmatch_t [], int);
+ MS_API_EXPORT(void) ms_regfree(ms_regex_t *);
#ifndef BUILDING_REGEX_PROXY
Modified: branches/branch-5-4/mapserver/mapscript/php3/Makefile.in
===================================================================
--- branches/branch-5-4/mapserver/mapscript/php3/Makefile.in 2009-07-17 13:45:52 UTC (rev 9179)
+++ branches/branch-5-4/mapserver/mapscript/php3/Makefile.in 2009-07-17 14:23:42 UTC (rev 9180)
@@ -54,7 +54,7 @@
# uses the same version of the REGEX library that PHP was compiled with:
#
PHP_REGEX_OBJ=@PHP_REGEX_OBJ@
-PHP_REGEX_INC=@PHP_REGEX_INC@
+PHP_REGEX_INC=-I at PHP_REGEX_INC@
#
Modified: branches/branch-5-4/mapserver/mapscript/php3/php_mapscript_util.h
===================================================================
--- branches/branch-5-4/mapserver/mapscript/php3/php_mapscript_util.h 2009-07-17 13:45:52 UTC (rev 9179)
+++ branches/branch-5-4/mapserver/mapscript/php3/php_mapscript_util.h 2009-07-17 14:23:42 UTC (rev 9180)
@@ -44,6 +44,11 @@
#define TSRMLS_CC
#endif
+/* PHP >=5.3 replaced ZVAL_DELREF by Z_DELREF_P */
+#if ZEND_MODULE_API_NO >= 20090626
+#define ZVAL_DELREF Z_DELREF_P
+#define ZVAL_ADDREF Z_ADDREF_P
+#endif
/**********************************************************************
* macros for setting object properties
Modified: branches/branch-5-4/mapserver/mapscript/php3/php_regex.c
===================================================================
--- branches/branch-5-4/mapserver/mapscript/php3/php_regex.c 2009-07-17 13:45:52 UTC (rev 9179)
+++ branches/branch-5-4/mapserver/mapscript/php3/php_regex.c 2009-07-17 14:23:42 UTC (rev 9180)
@@ -54,12 +54,19 @@
#include "mapregex.h"
+/* regex_extra.h doesn't exist in PHP >=5.3 */
+#include "php.h"
+
+#if ZEND_MODULE_API_NO < 20090626
#include "regex/regex_extra.h"
#include "regex/regex.h"
+#else
+#include "php_regex.h"
+#endif
-API_EXPORT(int) ms_regcomp(ms_regex_t *regex, const char *expr, int cflags)
+MS_API_EXPORT(int) ms_regcomp(ms_regex_t *regex, const char *expr, int cflags)
{
/* Must free in regfree() */
regex_t* sys_regex = (regex_t*) malloc(sizeof(regex_t));
@@ -67,21 +74,21 @@
return regcomp(sys_regex, expr, cflags);
}
-API_EXPORT(size_t) ms_regerror(int errcode, const ms_regex_t *regex, char *errbuf, size_t errbuf_size)
+MS_API_EXPORT(size_t) ms_regerror(int errcode, const ms_regex_t *regex, char *errbuf, size_t errbuf_size)
{
return regerror(errcode, (regex_t*)(regex->sys_regex), errbuf, errbuf_size);
}
-API_EXPORT(int) ms_regexec(const ms_regex_t *regex, const char *string, size_t nmatch, ms_regmatch_t pmatch[], int eflags)
+MS_API_EXPORT(int) ms_regexec(const ms_regex_t *regex, const char *string, size_t nmatch, ms_regmatch_t pmatch[], int eflags)
{
/*This next line only works because we know that regmatch_t
and ms_regmatch_t are exactly alike (POSIX STANDARD)*/
return regexec((const regex_t*)(regex->sys_regex),
- string, nmatch,
- (regmatch_t*) pmatch, eflags);
+ string, nmatch,
+ (regmatch_t*) pmatch, eflags);
}
-API_EXPORT(void) ms_regfree(ms_regex_t *regex)
+MS_API_EXPORT(void) ms_regfree(ms_regex_t *regex)
{
regfree((regex_t*)(regex->sys_regex));
free(regex->sys_regex);
More information about the mapserver-commits
mailing list