cvs: /php4/ext/standard dl.c
| From: | Andi Gutmans | Date: | Sat, 11 Mar 2000 16:23:30 +0000 |
| Subject: | cvs: /php4/ext/standard dl.c | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-11919@lists.php.net to get a copy of this message | ||
andi Sat Mar 11 08:23:30 2000 EDT
Modified files:
/php4/ext/standard dl.c
Log:
- Don't load modules which have different debug and ZTS information than
PHP() (untested). Not sure how to handle API version. Should it also not
load? It probably should but it might bite us at some point.
@ Prevent from loading dynamic PHP modules which were compiled with different
debug and thread safety modes than PHP, which resulted in a crash (Andi)
Index: php4/ext/standard/dl.c
diff -u php4/ext/standard/dl.c:1.28 php4/ext/standard/dl.c:1.29
--- php4/ext/standard/dl.c:1.28 Tue Mar 7 07:50:51 2000
+++ php4/ext/standard/dl.c Sat Mar 11 08:23:30 2000
@@ -70,6 +70,12 @@
#ifdef HAVE_LIBDL
+#ifdef ZTS
+#define USING_ZTS 1
+#else
+#define USING_ZTS 0
+#endif
+
void php_dl(pval *file,int type,pval *return_value)
{
void *handle;
@@ -126,6 +132,17 @@
RETURN_FALSE;
}
module_entry = get_module();
+ if ((module_entry->zend_debug != ZEND_DEBUG) || (module_entry->zts != USING_ZTS)) {
+ php_error(E_CORE_WARNING,
+ "%s: Unable to initialize module\n"
+ "Module compiled with debug=%d, thread-safety=%d\n"
+ "PHP compiled with debug=%d, thread-safety=%d\n"
+ "These options need to match\n",
+ module_entry->name, module_entry->zend_debug, module_entry->zts,
+ ZEND_DEBUG, USING_ZTS);
+ DL_UNLOAD(handle);
+ RETURN_FALSE;
+ }
module_entry->type = type;
module_entry->module_number = zend_next_free_module();
if (module_entry->module_startup_func) {