summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartijn Otto <martijn.otto@copernica.com>2016-05-17 15:19:37 +0200
committerMartijn Otto <martijn.otto@copernica.com>2016-05-17 15:19:37 +0200
commit37123a5474f73f3db51cb726cfb512acca4682c8 (patch)
treed629eacc679b30da20f20be33d3d916f5906da29
parentdd5f3a635053aa03417cdab1228e03c94b9c3136 (diff)
Fix crash during module finding and fix incomplete types for Value::call() members
-rw-r--r--zend/callable.h4
-rw-r--r--zend/extensionimpl.cpp7
-rw-r--r--zend/extensionimpl.h2
-rw-r--r--zend/value.cpp6
4 files changed, 11 insertions, 8 deletions
diff --git a/zend/callable.h b/zend/callable.h
index 65a971f..b2a7047 100644
--- a/zend/callable.h
+++ b/zend/callable.h
@@ -113,9 +113,9 @@ protected:
/**
* Required number of arguments
- * @var integer
+ * @var unsigned integer
*/
- int _required = 0;
+ unsigned int _required = 0;
/**
* Total number of arguments
diff --git a/zend/extensionimpl.cpp b/zend/extensionimpl.cpp
index 5261b0d..bc29cf1 100644
--- a/zend/extensionimpl.cpp
+++ b/zend/extensionimpl.cpp
@@ -63,8 +63,11 @@ static std::map<int,ExtensionImpl*> number2extension;
*
* @param zend_module_entry
*/
-static int match_module(zend_module_entry *entry)
+static int match_module(zval *value TSRMLS_DC)
{
+ // retrieve the module entry from the zval
+ auto *entry = (zend_module_entry*)Z_PTR_P(value);
+
// check if there is an extension with this name
auto iter = name2extension.find(entry->name);
if (iter == name2extension.end()) return ZEND_HASH_APPLY_KEEP;
@@ -89,7 +92,7 @@ static ExtensionImpl *find(int number TSRMLS_DC)
if (iter != number2extension.end()) return iter->second;
// no, not yet, loop through all modules
- zend_hash_apply(&module_registry, (apply_func_t)match_module TSRMLS_CC);
+ zend_hash_apply(&module_registry, match_module TSRMLS_CC);
// find again
iter = number2extension.find(number);
diff --git a/zend/extensionimpl.h b/zend/extensionimpl.h
index b933624..aef4802 100644
--- a/zend/extensionimpl.h
+++ b/zend/extensionimpl.h
@@ -103,7 +103,7 @@ public:
private:
/**
- * Initialize the namespace after it was registered
+ * Initialize the extension after it was registered
* @param module_number
* @param tsrm_ls
* @return bool
diff --git a/zend/value.cpp b/zend/value.cpp
index 40308f4..547ff85 100644
--- a/zend/value.cpp
+++ b/zend/value.cpp
@@ -893,7 +893,7 @@ Value Value::exec(int argc, Value *argv) const
zval params[argc];
// convert all the values
- for(unsigned i=0; i < argc; i++) { params[i] = *argv[i]._val; }
+ for(int i = 0; i < argc; i++) { params[i] = *argv[i]._val; }
// call helper function
return do_exec(nullptr, _val, argc, params);
@@ -915,7 +915,7 @@ Value Value::exec(const char *name, int argc, Value *argv) const
zval params[argc];
// convert all the values
- for(unsigned i=0; i < argc; i++) { params[i] = *argv[i]._val; }
+ for(int i = 0; i < argc; i++) { params[i] = *argv[i]._val; }
// call helper function
return do_exec(_val, method._val, argc, params);
@@ -937,7 +937,7 @@ Value Value::exec(const char *name, int argc, Value *argv)
zval params[argc];
// convert all the values
- for(unsigned i=0; i < argc; i++) { params[i] = *argv[i]._val; }
+ for(int i = 0; i < argc; i++) { params[i] = *argv[i]._val; }
// call helper function
return do_exec(_val, method._val, argc, params);