diff --git a/include/value.h b/include/value.h index 084102c1..996eb48f 100644 --- a/include/value.h +++ b/include/value.h @@ -60,6 +60,7 @@ class PHPCPP_EXPORT Value : private HashParent Value(char value); Value(const std::string &value); Value(const char *value, int size = -1); + Value(struct _zend_string *value); Value(double value); Value(const IniValue &value); diff --git a/zend/value.cpp b/zend/value.cpp index 6f53af42..aa05efcb 100644 --- a/zend/value.cpp +++ b/zend/value.cpp @@ -128,6 +128,25 @@ Value::Value(const char *value, int size) } } +/** + * Constructor based on zend_string + * @param value + */ +Value::Value(struct _zend_string *value) +{ + // is there a value? + if (value) + { + // create a string zval + ZVAL_STRINGL(_val, value->val, value->len); + } + else + { + // store null + ZVAL_NULL(_val); + } +} + /** * Constructor based on decimal value * @param value