summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/base.cpp29
-rw-r--r--src/classbase.cpp5
-rw-r--r--src/includes.h2
-rw-r--r--src/value.cpp12
4 files changed, 16 insertions, 32 deletions
diff --git a/src/base.cpp b/src/base.cpp
deleted file mode 100644
index 867fd9c..0000000
--- a/src/base.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * Base.cpp
- *
- * Implementation of the base class
- *
- * @documentation private
- */
-#include "includes.h"
-
-/**
- * Set up namespace
- */
-namespace Php {
-
-/**
- * Convert the object to a Php::Value object (how it is used externally)
- * @return Value
- */
-Value Base::value() const
-{
- // wrap the properties table, as a reference
- return Object(*_object->properties_table, true);
-}
-
-/**
- * End of namespace
- */
-}
-
diff --git a/src/classbase.cpp b/src/classbase.cpp
index 6a679b3..87a1cd2 100644
--- a/src/classbase.cpp
+++ b/src/classbase.cpp
@@ -49,7 +49,8 @@ static void clone_object(void *object, void **clone TSRMLS_DC)
/**
* Function that is called when an instance of the class needs to be created.
* This function will create the C++ class, and the PHP object
- * @param type Pointer to the class
+ * @param type Pointer to the class information
+ * @return zend_object_value The newly created object
*/
static zend_object_value create_object(zend_class_entry *type TSRMLS_DC)
{
@@ -100,7 +101,7 @@ static zend_object_value create_object(zend_class_entry *type TSRMLS_DC)
result.handle = zend_objects_store_put(object, NULL, deallocate_object, clone_object TSRMLS_CC);
// finally, construct the cpp object
- object->cpp = info->construct(&object->php);
+ object->cpp = info->construct(Value(result));
// done
return result;
diff --git a/src/includes.h b/src/includes.h
index c15ae93..8babe21 100644
--- a/src/includes.h
+++ b/src/includes.h
@@ -45,6 +45,7 @@
/**
* Include other files from this library
*/
+#include "../include/exception.h"
#include "../include/type.h"
#include "../include/value.h"
#include "../include/forcedvalue.h"
@@ -66,7 +67,6 @@
#include "../include/interface.h"
#include "../include/namespace.h"
#include "../include/extension.h"
-#include "../include/exception.h"
#include "../include/init.h"
/**
diff --git a/src/value.cpp b/src/value.cpp
index 644e60c..f7eff56 100644
--- a/src/value.cpp
+++ b/src/value.cpp
@@ -170,6 +170,18 @@ Value::Value(struct _zval_struct *val, bool ref)
}
/**
+ * Wrap around an object
+ * @param value The object value
+ */
+Value::Value(const struct _zend_object_value &value)
+{
+ // make a normal zval
+ MAKE_STD_ZVAL(_val);
+ Z_TYPE_P(_val) = IS_OBJECT;
+ Z_OBJVAL_P(_val) = value;
+}
+
+/**
* Copy constructor
* @param value
*/