summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/value.h2
-rw-r--r--zend/value.cpp16
2 files changed, 13 insertions, 5 deletions
diff --git a/include/value.h b/include/value.h
index 63e8e6f..c6b1af9 100644
--- a/include/value.h
+++ b/include/value.h
@@ -441,8 +441,6 @@ public:
template <typename T>
std::vector<T> vectorValue() const
{
-
-
// only works for arrays, other types return an empty vector
if (!isArray()) return std::vector<T>();
diff --git a/zend/value.cpp b/zend/value.cpp
index 9040234..d3ad06f 100644
--- a/zend/value.cpp
+++ b/zend/value.cpp
@@ -124,9 +124,19 @@ Value::Value(const std::string &value)
*/
Value::Value(const char *value, int size)
{
- // create a string zval
- MAKE_STD_ZVAL(_val);
- ZVAL_STRINGL(_val, value, size < 0 ? ::strlen(value) : size, 1);
+ // is there a value?
+ if (value)
+ {
+ // create a string zval
+ MAKE_STD_ZVAL(_val);
+ ZVAL_STRINGL(_val, value, size < 0 ? ::strlen(value) : size, 1);
+ }
+ else
+ {
+ // create a null zval
+ MAKE_STD_ZVAL(_val);
+ ZVAL_NULL(_val);
+ }
}
/**