diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-08-26 12:49:40 +0200 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-08-26 12:49:40 +0200 |
commit | a286c34777e48d59410e7511f52f4a6f08000ba3 (patch) | |
tree | 0d6b20409d80a4073b8448e1ecc526e8165de034 /zend | |
parent | 0e24f714fa8ddc4e45b858a1eec25ef1d84e7654 (diff) |
Value objects allocated with a const char * that is set to null, will not create NULL php values
Diffstat (limited to 'zend')
-rw-r--r-- | zend/value.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
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); + } } /** |