summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2015-01-12 21:54:59 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2015-01-12 21:54:59 +0100
commit75944e3e755053bc2ebe9a2a8c55575941f79a56 (patch)
tree7d2231c219f223b5fd1f2bf1facf6cedc7f341bd /include
parenta3007b9915a0ca3eec024b714cecc609e6356e17 (diff)
Added missing executestate.h file (forgot that in previous commit), and solved issue #158, the Php::Object constructor for multiple parameters accidentally matched the call to Php::Object(name, implementation)
Diffstat (limited to 'include')
-rw-r--r--include/base.h12
-rw-r--r--include/object.h13
2 files changed, 22 insertions, 3 deletions
diff --git a/include/base.h b/include/base.h
index f5ebed1..417aef0 100644
--- a/include/base.h
+++ b/include/base.h
@@ -34,6 +34,18 @@ protected:
*/
Base() {}
+ /**
+ * Copy constructor
+ *
+ * This copy constructor is explicitly defined to make sure that the
+ * copied object does not already have an implementation in the zend engine.
+ * Otherwise the copied object has the same object handle as the original
+ * object.
+ *
+ * @param base
+ */
+ Base(const Base &base) : _impl(nullptr) {}
+
public:
/**
* Virtual destructor
diff --git a/include/object.h b/include/object.h
index 2e92f6a..0cdeb5c 100644
--- a/include/object.h
+++ b/include/object.h
@@ -66,15 +66,22 @@ public:
/**
* Constructor to create a new instance
+ * @param name Name of the class to instantiate
+ */
+ Object(const char *name) : Value() { if (instantiate(name)) call("__construct"); }
+
+ /**
+ * Constructor to create a new instance
*
- * This constructor comes in many different forms, to support all possible
- * number of parameters that are passed to the constructor
+ * Note that it was not possible to create a constructor with signature
+ * Object(const char *name, Args&&... args) because that overrides the
+ * Object(const char *name, Base *base) constructor.
*
* @param name Name of the class to instantiate
* @param args Optional arguments
*/
template <typename ...Args>
- Object(const char *name, Args&&... args) : Value() { if (instantiate(name)) call("__construct", std::forward<Value>(args)...); }
+ Object(const char *name, Value arg0, Args&&... args) : Value() { if (instantiate(name)) call("__construct", arg0, std::forward<Value>(args)...); }
/**
* Destructor