diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-05-06 09:33:22 +0200 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-05-06 09:33:22 +0200 |
commit | 927e54ecde25ed7ba718697631dc8ffd208e361a (patch) | |
tree | 97f8adc4f34be17af7fdc392b69bc94009123184 /zend | |
parent | 66e8672fc0902220e5a606438d208f7a8e52ddd5 (diff) |
Value objects constructed with (const char *)NULL caused a crash, this has been fixed so they hold a PHP NULL value
Diffstat (limited to 'zend')
-rw-r--r-- | zend/value.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/zend/value.cpp b/zend/value.cpp index 9040234..7fc45d6 100644 --- a/zend/value.cpp +++ b/zend/value.cpp @@ -124,9 +124,20 @@ Value::Value(const std::string &value) */ Value::Value(const char *value, int size) { - // create a string zval + // allocate the zval MAKE_STD_ZVAL(_val); - ZVAL_STRINGL(_val, value, size < 0 ? ::strlen(value) : size, 1); + + // do we have a valid value? + if (value) + { + // create a string zval + ZVAL_STRINGL(_val, value, size < 0 ? ::strlen(value) : size, 1); + } + else + { + // store null + ZVAL_NULL(_val); + } } /** |