summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
authorMichael Wallner <mike@php.net>2014-07-30 20:12:50 +0200
committerMichael Wallner <mike@php.net>2014-07-30 20:12:50 +0200
commit6ed9991a6f327242a1214a485775a106f5eb015e (patch)
treeab6c63b9fec394af88f51585591e446b7c98c747 /sapi
parent579c9066a0f37144f0be66e0b62431ba15a118be (diff)
parent12b2127b72543710590887d8bcf26be9e02bcc71 (diff)
downloadphp-git-6ed9991a6f327242a1214a485775a106f5eb015e.tar.gz
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4: Fixed bug #67715 (php-milter does not build and crashes randomly).
Diffstat (limited to 'sapi')
-rw-r--r--sapi/milter/Makefile.frag4
-rw-r--r--sapi/milter/config.m44
-rw-r--r--sapi/milter/php_milter.c8
3 files changed, 10 insertions, 6 deletions
diff --git a/sapi/milter/Makefile.frag b/sapi/milter/Makefile.frag
index 26200a196c..f193f56b01 100644
--- a/sapi/milter/Makefile.frag
+++ b/sapi/milter/Makefile.frag
@@ -1,8 +1,8 @@
milter: $(SAPI_MILTER_PATH)
-$(SAPI_MILTER_PATH): $(PHP_GLOBAL_OBJS) $(PHP_BINARY_OBJS) $(PHP_SAPI_OBJS)
+$(SAPI_MILTER_PATH): $(PHP_GLOBAL_OBJS) $(PHP_BINARY_OBJS) $(PHP_MILTER_OBJS)
$(BUILD_MILTER)
install-milter: $(SAPI_MILTER_PATH)
- @$(INSTALL) -m 0755 $(SAPI_MILTER_PATH) $(bindir)/php-milter
+ @$(INSTALL) -m 0755 $(SAPI_MILTER_PATH) $(INSTALL_ROOT)$(bindir)/php-milter
diff --git a/sapi/milter/config.m4 b/sapi/milter/config.m4
index 4bcad80bb4..a69ab2e1e7 100644
--- a/sapi/milter/config.m4
+++ b/sapi/milter/config.m4
@@ -22,10 +22,10 @@ if test "$PHP_MILTER" != "no"; then
SAPI_MILTER_PATH=sapi/milter/php-milter
PHP_BUILD_THREAD_SAFE
- PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/milter/Makefile.frag)
+ PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/milter/Makefile.frag,$abs_srcdir/sapi/milter,sapi/milter)
PHP_SELECT_SAPI(milter, program, php_milter.c getopt.c,,'$(SAPI_MILTER_PATH)')
PHP_ADD_LIBRARY_WITH_PATH(milter, $MILTERPATH,)
- BUILD_MILTER="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_MILTER_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_MILTER_PATH)"
+ BUILD_MILTER="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_MILTER_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_MILTER_PATH)"
PHP_SUBST(SAPI_MILTER_PATH)
PHP_SUBST(BUILD_MILTER)
fi
diff --git a/sapi/milter/php_milter.c b/sapi/milter/php_milter.c
index 432fd806c2..4a11707239 100644
--- a/sapi/milter/php_milter.c
+++ b/sapi/milter/php_milter.c
@@ -525,6 +525,10 @@ static sfsistat mlfi_close(SMFICTX *ctx)
int status;
TSRMLS_FETCH();
+ if (!SG(sapi_started) && SUCCESS != php_request_startup(TSRMLS_C)) {
+ return ret;
+ }
+
/* call userland */
INIT_ZVAL(function_name);
ZVAL_STRING(&function_name, "milter_close", 0);
@@ -550,7 +554,7 @@ static sfsistat mlfi_close(SMFICTX *ctx)
/* {{{ Milter entry struct
*/
-struct smfiDesc smfilter = {
+static struct smfiDesc smfilter = {
"php-milter", /* filter name */
SMFI_VERSION, /* version code -- leave untouched */
0, /* flags */
@@ -1015,6 +1019,7 @@ int main(int argc, char *argv[])
tsrm_startup(1, 1, 0, NULL);
+ tsrm_ls = ts_resource(0);
sapi_startup(&milter_sapi_module);
while ((c=ap_php_getopt(argc, argv, OPTSTRING))!=-1) {
@@ -1032,7 +1037,6 @@ int main(int argc, char *argv[])
milter_sapi_module.executable_location = argv[0];
- tsrm_ls = ts_resource(0);
sapi_module.startup(&milter_sapi_module);