php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #54433
Patch API_Module_Differences revision 2011-03-31 13:15 UTC by RQuadling at GMail dot com

Patch API_Module_Differences for *Configuration Issues Bug #54433

Patch version 2011-03-31 13:15 UTC

Return to Bug #54433 | Download this patch
Patch Revisions:

Developer: RQuadling@GMail.com

Index: ext/standard/dl.c
===================================================================
--- ext/standard/dl.c	(revision 309853)
+++ ext/standard/dl.c	(working copy)
@@ -110,6 +110,7 @@
 	zend_module_entry *(*get_module)(void);
 	int error_type;
 	char *extension_dir;
+	int result;
 
 	if (type == MODULE_PERSISTENT) {
 		extension_dir = INI_STR("extension_dir");
@@ -161,7 +162,6 @@
 		efree(libpath);
 		return FAILURE;
 	}
-	efree(libpath);
 
 	get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, "get_module");
 
@@ -175,8 +175,9 @@
 
 	if (!get_module) {
 		DL_UNLOAD(handle);
-		php_error_docref(NULL TSRMLS_CC, error_type, "Invalid library (maybe not a PHP library) '%s'", filename);
-		return FAILURE;
+		php_error_docref(NULL TSRMLS_CC, error_type, "Invalid library (maybe not a PHP library) '%s'", libpath);
+		result = FAILURE;
+		goto Completed;
 	}
 	module_entry = get_module();
 	if (module_entry->zend_api != ZEND_MODULE_API_NO) {
@@ -215,23 +216,25 @@
 			}
 
 			php_error_docref(NULL TSRMLS_CC, error_type,
-					"%s: Unable to initialize module\n"
-					"Module compiled with module API=%d\n"
-					"PHP    compiled with module API=%d\n"
+					"%s : Unable to initialize module\n"
+					"Module compiled with module API=%d (%s)\n"
+					"PHP    compiled with module API=%d (%s)\n"
 					"These options need to match\n",
-					name, zend_api, ZEND_MODULE_API_NO);
+					name, zend_api, libpath, ZEND_MODULE_API_NO, sapi_module.executable_location);
 			DL_UNLOAD(handle);
-			return FAILURE;
+			result = FAILURE;
+			goto Completed;
 	}
 	if(strcmp(module_entry->build_id, ZEND_MODULE_BUILD_ID)) {
 		php_error_docref(NULL TSRMLS_CC, error_type,
-				"%s: Unable to initialize module\n"
-				"Module compiled with build ID=%s\n"
-				"PHP    compiled with build ID=%s\n"
+				"%s : Unable to initialize module\n"
+				"Module compiled with build ID=%s (%s)\n"
+				"PHP    compiled with build ID=%s (%s)\n"
 				"These options need to match\n",
-				module_entry->name, module_entry->build_id, ZEND_MODULE_BUILD_ID);
+				module_entry->name, module_entry->build_id, libpath, ZEND_MODULE_BUILD_ID, sapi_module.executable_location);
 		DL_UNLOAD(handle);
-		return FAILURE;
+		result = FAILURE;
+		goto Completed;
 	}
 	module_entry->type = type;
 	module_entry->module_number = zend_next_free_module();
@@ -239,22 +242,28 @@
 
 	if ((module_entry = zend_register_module_ex(module_entry TSRMLS_CC)) == NULL) {
 		DL_UNLOAD(handle);
-		return FAILURE;
+		result = FAILURE;
+		goto Completed;
 	}
 
 	if ((type == MODULE_TEMPORARY || start_now) && zend_startup_module_ex(module_entry TSRMLS_CC) == FAILURE) {
 		DL_UNLOAD(handle);
-		return FAILURE;
+		result = FAILURE;
+		goto Completed;
 	}
 
 	if ((type == MODULE_TEMPORARY || start_now) && module_entry->request_startup_func) {
 		if (module_entry->request_startup_func(type, module_entry->module_number TSRMLS_CC) == FAILURE) {
-			php_error_docref(NULL TSRMLS_CC, error_type, "Unable to initialize module '%s'", module_entry->name);
+			php_error_docref(NULL TSRMLS_CC, error_type, "Unable to initialize module '%s' (%s)", module_entry->name, libpath);
 			DL_UNLOAD(handle);
-			return FAILURE;
+			result = FAILURE;
+			goto Completed;
 		}
 	}
-	return SUCCESS;
+
+Completed:
+	free(libpath);
+	return result;
 }
 /* }}} */
 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 16:01:29 2024 UTC