libming/libming — Issue #6: PHP module: version warnings under httpd
Author: ehy
Created: 2012-01-05 12:06:54+00:00
State: open

Hi, I had brought this up on the mailing list a few weeks ago, about
Ming_init() being called repeatedly by the php module.

This has been working well:

diff --git a/php_ext/ming.c b/php_ext/ming.c
index c4527a0..4504fe6 100644
--- a/php_ext/ming.c
+++ b/php_ext/ming.c
@@ -6199,12 +6199,20 @@ static void php_ming_error(const char *msg, ...) /* {{{ */

PHP_RINIT_FUNCTION(ming) /* {{{ */
{
+	/* guard against repeated calls to Ming_init() */
+	static int guard = 0;
+	if ( guard ) {
+	/* repeat previous success */
+	return SUCCESS;
+	}
/* XXX - this didn't work so well last I tried.. */

if (Ming_init() != 0) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error initializing Ming module");
return FAILURE;
}
+	/* guard against repeated calls to Ming_init() */
+	guard = 1;
return SUCCESS;
}
/* }}} */

-Ed